diff --git a/MQL4/Experts/Position Sizer/Defines.mqh b/MQL4/Experts/Position Sizer/Defines.mqh index d025d02..dc9427c 100644 --- a/MQL4/Experts/Position Sizer/Defines.mqh +++ b/MQL4/Experts/Position Sizer/Defines.mqh @@ -117,6 +117,13 @@ enum ADDITIONAL_TRADE_BUTTONS ADDITIONAL_TRADE_BUTTONS_BOTH // Both }; +enum IGNORE_SYMBOLS +{ + IGNORE_SYMBOLS_NONE, // No symbols + IGNORE_SYMBOLS_OTHER, // Other symbols + IGNORE_SYMBOLS_CURRENT, // Current symbol +}; + struct Settings { ENTRY_TYPE EntryType; @@ -137,7 +144,7 @@ struct Settings bool CountPendingOrders; bool IgnoreOrdersWithoutSL; bool IgnoreOrdersWithoutTP; - bool IgnoreOtherSymbols; + IGNORE_SYMBOLS IgnoreSymbols; bool HideAccSize; bool ShowLines; TABS SelectedTab; @@ -151,6 +158,7 @@ struct Settings int MaxSpread; int MaxEntrySLDistance; int MinEntrySLDistance; + double MaxRiskPercentage; // For SL/TP distance modes: bool SLDistanceInPoints; bool TPDistanceInPoints; diff --git a/MQL4/Experts/Position Sizer/Position Sizer Trading.mqh b/MQL4/Experts/Position Sizer/Position Sizer Trading.mqh index d45c1ad..c496ef4 100644 --- a/MQL4/Experts/Position Sizer/Position Sizer Trading.mqh +++ b/MQL4/Experts/Position Sizer/Position Sizer Trading.mqh @@ -14,19 +14,25 @@ void Trade() if (!TerminalInfoInteger(TERMINAL_TRADE_ALLOWED)) { - Alert("AutoTrading disabled! Please enable AutoTrading."); + Alert(TRANSLATION_MESSAGE_ALGO_TRADING_DISABLED_1); + return; + } + + if (!MQLInfoInteger(MQL_TRADE_ALLOWED)) + { + Alert(TRANSLATION_MESSAGE_ALGO_TRADING_DISABLED_2); return; } if ((WarningSL != "") && (!sets.DoNotApplyStopLoss)) // Too close or wrong value. { - Alert("Stop-loss problem: " + WarningSL); + Alert(TRANSLATION_MESSAGE_STOPLOSS_PROBLEM + ": " + WarningSL); return; } if (OutputPositionSize <= 0) { - Alert("Wrong position size value!"); + Alert(TRANSLATION_MESSAGE_WRONG_POSITION_SIZE_VALUE); return; } @@ -37,10 +43,10 @@ void Trade() if (sets.TakeProfitsNumber > 1) { - Print("Multiple TP volume share sum = ", TotalVolumeShare, "."); + Print(TRANSLATION_MESSAGE_MULTIPLE_TP_VOLUME_SHARE_SUM + " = ", TotalVolumeShare, "."); if ((TotalVolumeShare < 99) || (TotalVolumeShare > 100)) { - Alert("Incorrect volume sum for multiple TPs - not taking any trades."); + Alert(TRANSLATION_MESSAGE_INCORRECT_VOLUME_SUM); return; } for (int i = 0; i < sets.TakeProfitsNumber; i++) @@ -62,7 +68,7 @@ void Trade() if ((sets.DisableTradingWhenLinesAreHidden) && (!sets.ShowLines)) { - Alert("Not taking a trade - lines are hidden and panel is set not to trade when they are hidden."); + Alert(TRANSLATION_MESSAGE_NOT_TAKING_A_TRADE + " - " + TRANSLATION_MESSAGE_NTAT_LINES); return; } @@ -73,7 +79,7 @@ void Trade() int spread = (int)((Ask - Bid) / Point); if (spread > sets.MaxSpread) { - Alert("Not taking a trade - current spread (", spread, ") > maximum spread (", sets.MaxSpread, ")."); + Alert(TRANSLATION_MESSAGE_NOT_TAKING_A_TRADE + " - " + TRANSLATION_MESSAGE_NTAT_SPREAD + " (", spread, ") > " + TRANSLATION_MESSAGE_MAXIMUM_SPREAD + " (", sets.MaxSpread, ")."); return; } } @@ -83,7 +89,7 @@ void Trade() int CurrentEntrySLDistance = (int)(MathAbs(sets.StopLossLevel - sets.EntryLevel) / Point); if (CurrentEntrySLDistance > sets.MaxEntrySLDistance) { - Alert("Not taking a trade - current Entry/SL distance (", CurrentEntrySLDistance, ") > maximum Entry/SL distance (", sets.MaxEntrySLDistance, ")."); + Alert(TRANSLATION_MESSAGE_NOT_TAKING_A_TRADE + " - " + TRANSLATION_MESSAGE_NTAT_ENTRY_SL_DISTANCE + " (", CurrentEntrySLDistance, ") > " + TRANSLATION_LABEL_MAX_ENTRY_SL_DISTANCE + " (", sets.MaxEntrySLDistance, ")."); return; } } @@ -93,7 +99,21 @@ void Trade() int CurrentEntrySLDistance = (int)(MathAbs(sets.StopLossLevel - sets.EntryLevel) / Point); if (CurrentEntrySLDistance < sets.MinEntrySLDistance) { - Alert("Not taking a trade - current Entry/SL distance (", CurrentEntrySLDistance, ") < minimum Entry/SL distance (", sets.MinEntrySLDistance, ")."); + Alert(TRANSLATION_MESSAGE_NOT_TAKING_A_TRADE + " - " + TRANSLATION_MESSAGE_NTAT_ENTRY_SL_DISTANCE + " (", CurrentEntrySLDistance, ") < " + TRANSLATION_LABEL_MIN_ENTRY_SL_DISTANCE + " (", sets.MinEntrySLDistance, ")."); + return; + } + } + + if (sets.MaxRiskPercentage > 0) + { + double risk_percentage_output = 100; // In case AccSize = 0; + if (AccSize != 0) + { + risk_percentage_output = Round(OutputRiskMoney / AccSize * 100, 2); // Not stored anywhere. Have to recalculate each time. + } + if (risk_percentage_output > sets.MaxRiskPercentage) + { + Alert(TRANSLATION_MESSAGE_NOT_TAKING_A_TRADE + " - " + TRANSLATION_MESSAGE_NTAT_CURRENT_RISK + " (", risk_percentage_output, "%) > " + TRANSLATION_MESSAGE_NTAT_MAX_RISK + " (", sets.MaxRiskPercentage, "%)."); return; } } @@ -111,59 +131,20 @@ void Trade() } if ((cnt + sets.TakeProfitsNumber > sets.MaxNumberOfTradesTotal) && (sets.MaxNumberOfTradesTotal > 0)) { - Alert("Not taking a trade - current total # of trades (", cnt, ") + number of trades in execution (", sets.TakeProfitsNumber, ") > maximum total number of trades allowed (", sets.MaxNumberOfTradesTotal, ")."); + Alert(TRANSLATION_MESSAGE_NOT_TAKING_A_TRADE + " - " + TRANSLATION_MESSAGE_NTAT_TOTAL_NUMBER + " (", cnt, ") + " + TRANSLATION_MESSAGE_NUMBER_OF_TRADES_IN_EXECUTION + " (", sets.TakeProfitsNumber, ") > " + TRANSLATION_MESSAGE_MAXIMUM_TOTAL_NUMBER_OF_TRADES_ALLOWED + " (", sets.MaxNumberOfTradesTotal, ")."); return; } if ((persymbol_cnt + sets.TakeProfitsNumber > sets.MaxNumberOfTradesPerSymbol) && (sets.MaxNumberOfTradesPerSymbol > 0)) { - Alert("Not taking a trade - current # of trades per symbol (", persymbol_cnt, ") + number of trades in execution (", sets.TakeProfitsNumber, ") > maximum number of trades per symbol allowed (", sets.MaxNumberOfTradesPerSymbol, ")."); - return; - } - } - - if (sets.MaxRiskTotal > 0) - { - CalculatePortfolioRisk(CALCULATE_RISK_FOR_TRADING_TAB_TOTAL); - double risk; - if (PortfolioLossMoney != DBL_MAX) - { - risk = (PortfolioLossMoney + OutputRiskMoney) / AccSize * 100; - if (risk > sets.MaxRiskTotal) - { - Alert("Not taking a trade - total potential risk (", DoubleToString(risk, 2), ") >= maximum total risk allowed (", DoubleToString(sets.MaxRiskTotal, 2), ")."); - return; - } - } - else - { - Alert("Not taking a trade - infinite total potential risk."); - return; - } - } - if (sets.MaxRiskPerSymbol > 0) - { - CalculatePortfolioRisk(CALCULATE_RISK_FOR_TRADING_TAB_PER_SYMBOL); - double risk; - if (PortfolioLossMoney != DBL_MAX) - { - risk = (PortfolioLossMoney + OutputRiskMoney) / AccSize * 100; - if (risk > sets.MaxRiskPerSymbol) - { - Alert("Not taking a trade - potential risk per symbol (", DoubleToString(risk, 2), ") >= maximum risk per symbol allowed (", DoubleToString(sets.MaxRiskPerSymbol, 2), ")."); - return; - } - } - else - { - Alert("Not taking a trade - infinite potential risk per symbol."); + Alert(TRANSLATION_MESSAGE_NOT_TAKING_A_TRADE + " - " + TRANSLATION_MESSAGE_NTAT_PER_SYMBOL_NUMBER + " (", persymbol_cnt, ") + " + TRANSLATION_MESSAGE_NUMBER_OF_TRADES_IN_EXECUTION + " (", sets.TakeProfitsNumber, ") > " + TRANSLATION_MESSAGE_MAXIMUM_PER_SYMBOL_NUMBER_OF_TRADES_ALLOWED + " (", sets.MaxNumberOfTradesPerSymbol, ")."); return; } } - + ENUM_SYMBOL_TRADE_EXECUTION Execution_Mode = (ENUM_SYMBOL_TRADE_EXECUTION)SymbolInfoInteger(Symbol(), SYMBOL_TRADE_EXEMODE); string warning_suffix = ""; - if ((Execution_Mode == SYMBOL_TRADE_EXECUTION_MARKET) && (IgnoreMarketExecutionMode) && (sets.EntryType == Instant)) warning_suffix = ", but IgnoreMarketExecutionMode = true. Switch to false if trades aren't executing."; - Print("Execution mode: ", EnumToString(Execution_Mode), warning_suffix); + if ((Execution_Mode == SYMBOL_TRADE_EXECUTION_MARKET) && (IgnoreMarketExecutionMode) && (sets.EntryType == Instant)) warning_suffix = TRANSLATION_MESSAGE_IGNORE_MARKET_EXECUTION_MODE_WARNING; + Print(TRANSLATION_MESSAGE_EXECUTION_MODE + ": ", EnumToString(Execution_Mode), warning_suffix); ENUM_ORDER_TYPE ot; if (sets.EntryType == Pending) @@ -200,14 +181,14 @@ void Trade() { double existing_volume_buy = 0, existing_volume_sell = 0; CalculateOpenVolume(existing_volume_buy, existing_volume_sell); - Print("Found existing buy volume = ", DoubleToString(existing_volume_buy, LotStep_digits)); - Print("Found existing sell volume = ", DoubleToString(existing_volume_sell, LotStep_digits)); + Print(TRANSLATION_MESSAGE_FOUND_EXISTING_BUY_VOLUME + " = ", DoubleToString(existing_volume_buy, LotStep_digits)); + Print(TRANSLATION_MESSAGE_FOUND_EXISTING_SELL_VOLUME + " = ", DoubleToString(existing_volume_sell, LotStep_digits)); if ((ot == OP_BUY) || (ot == OP_BUYLIMIT) || (ot == OP_BUYSTOP)) PositionSize -= existing_volume_buy; else PositionSize -= existing_volume_sell; - Print("Adjusted position size = ", DoubleToString(PositionSize, LotStep_digits)); + Print(TRANSLATION_MESSAGE_ADJUSTED_POSITION_SIZE + " = ", DoubleToString(PositionSize, LotStep_digits)); if (PositionSize <= 0) { - Alert("Adjusted position size is less or equal to zero. Not executing any trade."); + Alert(TRANSLATION_MESSAGE_ADJUSTED_POSITION_SIZE_LESS_THAN_ZERO); return; } if (PositionSize != OutputPositionSize) // If changed, recalculate the array of position sizes. @@ -229,12 +210,131 @@ void Trade() } if ((volume + PositionSize > sets.MaxPositionSizeTotal) && (sets.MaxPositionSizeTotal > 0)) { - Alert("Not taking a trade - current total volume (", DoubleToString(volume, LotStep_digits), ") + new position volume (", DoubleToString(PositionSize, LotStep_digits), ") >= maximum total volume allowed (", DoubleToString(sets.MaxPositionSizeTotal, LotStep_digits), ")."); - return; + string alert_text = TRANSLATION_MESSAGE_NOT_TAKING_A_TRADE + " - " + TRANSLATION_MESSAGE_NTAT_TOTAL_VOLUME + " (" + DoubleToString(volume, LotStep_digits) + ") + " + TRANSLATION_MESSAGE_NTAT_NEW_POSITION_VOLUME + " (" + DoubleToString(PositionSize, LotStep_digits) + ") >= " + TRANSLATION_MESSAGE_NTAT_MAXIMUM_TOTAL_VOLUME + " (" + DoubleToString(sets.MaxPositionSizeTotal, LotStep_digits) + ")."; + if (!LessRestrictiveMaxLimits) + { + Alert(alert_text); + return; + } + else + { + double new_ps = sets.MaxPositionSizeTotal - volume; + if (new_ps >= MinLot) + { + new_ps = AdjustPositionSizeByMinMaxStep(new_ps); + Alert(TRANSLATION_MESSAGE_TAKING_SMALLER_TRADE + " - " + TRANSLATION_MESSAGE_NTAT_TOTAL_VOLUME + " (" + DoubleToString(volume, LotStep_digits) + ") + " + TRANSLATION_MESSAGE_NTAT_NEW_POSITION_VOLUME + " (" + DoubleToString(PositionSize, LotStep_digits) + ") >= " + TRANSLATION_MESSAGE_NTAT_MAXIMUM_TOTAL_VOLUME + " (" + DoubleToString(sets.MaxPositionSizeTotal, LotStep_digits) + "). " + TRANSLATION_MESSAGE_NEW_POSITION_SIZE + " = " + DoubleToString(new_ps, LotStep_digits)); + PositionSize = new_ps; + PositionSizeToArray(PositionSize); // Re-fills ArrayPositionSize[]. + } + else + { + Alert(alert_text + " " + TRANSLATION_MESSAGE_CANNOT_TAKE_SMALLER_TRADE); + return; + } + } } if ((volume_persymbol + PositionSize > sets.MaxPositionSizePerSymbol) && (sets.MaxPositionSizePerSymbol > 0)) { - Alert("Not taking a trade - current volume per symbol (", DoubleToString(volume_persymbol, LotStep_digits), ") + new position volume (", DoubleToString(PositionSize, LotStep_digits), ") >= maximum volume per symbol allowed (", DoubleToString(sets.MaxPositionSizePerSymbol, LotStep_digits), ")."); + string alert_text = TRANSLATION_MESSAGE_NOT_TAKING_A_TRADE + " - " + TRANSLATION_MESSAGE_NTAT_PER_SYMBOL_VOLUME + " (" + DoubleToString(volume, LotStep_digits) + ") + " + TRANSLATION_MESSAGE_NTAT_NEW_POSITION_VOLUME + " (" + DoubleToString(PositionSize, LotStep_digits) + ") >= " + TRANSLATION_MESSAGE_NTAT_MAXIMUM_PER_SYMBOL_VOLUME + " (" + DoubleToString(sets.MaxPositionSizePerSymbol, LotStep_digits) + ")."; + if (!LessRestrictiveMaxLimits) + { + Alert(alert_text); + return; + } + else + { + double new_ps = sets.MaxPositionSizePerSymbol - volume_persymbol; + if (new_ps >= MinLot) + { + new_ps = AdjustPositionSizeByMinMaxStep(new_ps); + Alert(TRANSLATION_MESSAGE_TAKING_SMALLER_TRADE + " - " + TRANSLATION_MESSAGE_NTAT_PER_SYMBOL_VOLUME + " (" + DoubleToString(volume, LotStep_digits) + ") + " + TRANSLATION_MESSAGE_NTAT_NEW_POSITION_VOLUME + " (" + DoubleToString(PositionSize, LotStep_digits) + ") >= " + TRANSLATION_MESSAGE_NTAT_MAXIMUM_PER_SYMBOL_VOLUME + " (" + DoubleToString(sets.MaxPositionSizePerSymbol, LotStep_digits) + ")." + TRANSLATION_MESSAGE_NEW_POSITION_SIZE + " = " + DoubleToString(new_ps, LotStep_digits)); + PositionSize = new_ps; + PositionSizeToArray(PositionSize); // Re-fills ArrayPositionSize[]. + } + else + { + Alert(alert_text + " " + TRANSLATION_MESSAGE_CANNOT_TAKE_SMALLER_TRADE); + return; + } + } + } + } + + if (sets.MaxRiskTotal > 0) + { + CalculatePortfolioRisk(CALCULATE_RISK_FOR_TRADING_TAB_TOTAL); + double risk; + if (PortfolioLossMoney != DBL_MAX) + { + risk = (PortfolioLossMoney + OutputRiskMoney) / AccSize * 100; + if (risk > sets.MaxRiskTotal) + { + string alert_text = TRANSLATION_MESSAGE_NOT_TAKING_A_TRADE + " - " + TRANSLATION_MESSAGE_TOTAL_POTENTIAL_RISK + " (" + DoubleToString(risk, 2) + ") >= " + TRANSLATION_MESSAGE_MAXIUMUM_TOTAL_RISK + " (" + DoubleToString(sets.MaxRiskTotal, 2) + ")."; + if (!LessRestrictiveMaxLimits) + { + Alert(alert_text); + return; + } + else + { + double new_ps = (sets.MaxRiskTotal / 100 * AccSize - PortfolioLossMoney) * (OutputPositionSize / OutputRiskMoney); + if (new_ps >= MinLot) + { + PositionSize = Round(new_ps, LotStep_digits, RoundDown); + PositionSize = AdjustPositionSizeByMinMaxStep(PositionSize); + PositionSizeToArray(PositionSize); // Re-fills ArrayPositionSize[]. + Alert(TRANSLATION_MESSAGE_TAKING_SMALLER_TRADE + " - " + TRANSLATION_MESSAGE_TOTAL_POTENTIAL_RISK + " (" + DoubleToString(risk, 2) + ") >= " + TRANSLATION_MESSAGE_MAXIUMUM_TOTAL_RISK + " (" + DoubleToString(sets.MaxRiskTotal, 2) + "). " + TRANSLATION_MESSAGE_NEW_POSITION_SIZE + " = " + DoubleToString(PositionSize, LotStep_digits)); + } + else + { + Alert(alert_text + " " + TRANSLATION_MESSAGE_CANNOT_TAKE_SMALLER_TRADE); + return; + } + } + } + } + else + { + Alert(TRANSLATION_MESSAGE_NOT_TAKING_A_TRADE + " - " + TRANSLATION_MESSAGE_INFINITE_TOTAL_POTENTIAL_RISK + "."); + return; + } + } + if (sets.MaxRiskPerSymbol > 0) + { + CalculatePortfolioRisk(CALCULATE_RISK_FOR_TRADING_TAB_PER_SYMBOL); + double risk; + if (PortfolioLossMoney != DBL_MAX) + { + risk = (PortfolioLossMoney + OutputRiskMoney) / AccSize * 100; + if (risk > sets.MaxRiskPerSymbol) + { + string alert_text = TRANSLATION_MESSAGE_NOT_TAKING_A_TRADE + " - " + TRANSLATION_MESSAGE_PER_SYMBOL_POTENTIAL_RISK + " (" + DoubleToString(risk, 2) + ") >= " + TRANSLATION_MESSAGE_MAXIMUM_PER_SYMBOL_RISK + " (" + DoubleToString(sets.MaxRiskPerSymbol, 2) + ")."; + if (!LessRestrictiveMaxLimits) + { + Alert(alert_text); + return; + } + else + { + double new_ps = (sets.MaxRiskPerSymbol / 100 * AccSize - PortfolioLossMoney) * (OutputPositionSize / OutputRiskMoney); + if (new_ps >= MinLot) + { + PositionSize = Round(new_ps, LotStep_digits, RoundDown); + PositionSize = AdjustPositionSizeByMinMaxStep(PositionSize); + PositionSizeToArray(PositionSize); // Re-fills ArrayPositionSize[]. + Alert(TRANSLATION_MESSAGE_TAKING_SMALLER_TRADE + " - " + TRANSLATION_MESSAGE_PER_SYMBOL_POTENTIAL_RISK + " (" + DoubleToString(risk, 2) + ") >= " + TRANSLATION_MESSAGE_MAXIMUM_PER_SYMBOL_RISK + " (" + DoubleToString(sets.MaxRiskPerSymbol, 2) + "). " + TRANSLATION_MESSAGE_NEW_POSITION_SIZE + " = " + DoubleToString(PositionSize, LotStep_digits)); + } + else + { + Alert(alert_text + " " + TRANSLATION_MESSAGE_CANNOT_TAKE_SMALLER_TRADE); + return; + } + } + } + } + else + { + Alert(TRANSLATION_MESSAGE_NOT_TAKING_A_TRADE + " - " + TRANSLATION_MESSAGE_INFINITE_TOTAL_POTENTIAL_RISK + "."); return; } } @@ -248,67 +348,43 @@ void Trade() if (sets.AskForConfirmation) { // Evoke confirmation modal window. - string caption = "Position Sizer on " + Symbol() + " @ " + StringSubstr(EnumToString((ENUM_TIMEFRAMES)Period()), 7) + ": Execute the trade?"; + string caption = TRANSLATION_MESSAGE_POSITION_SIZER_ON + Symbol() + " @ " + StringSubstr(EnumToString((ENUM_TIMEFRAMES)Period()), 7) + ": " + TRANSLATION_MESSAGE_EXECUTE_TRADE; string message; - string order_type_text = ""; + string order_type_text = OrderTypeToString(ot); string currency = AccountInfoString(ACCOUNT_CURRENCY); - switch(ot) - { - case OP_BUY: - order_type_text = "Buy"; - break; - case OP_BUYSTOP: - order_type_text = "Buy Stop"; - break; - case OP_BUYLIMIT: - order_type_text = "Buy Limit"; - break; - case OP_SELL: - order_type_text = "Sell"; - break; - case OP_SELLSTOP: - order_type_text = "Sell Stop"; - break; - case OP_SELLLIMIT: - order_type_text = "Sell Limit"; - break; - default: - break; - } - - message = "Order: " + order_type_text + "\n"; - message += "Size: " + DoubleToString(PositionSize, LotStep_digits); - if (sets.TakeProfitsNumber > 1) message += " (multiple)"; + message = TRANSLATION_MESSAGE_ORDER + ": " + order_type_text + "\n"; + message += TRANSLATION_MESSAGE_SIZE + ": " + DoubleToString(PositionSize, LotStep_digits); + if (sets.TakeProfitsNumber > 1) message += " (" + TRANSLATION_MESSAGE_MULTIPLE + ")"; message += "\n"; message += EnumToString(sets.AccountButton); message += ": " + FormatDouble(DoubleToString(AccSize, 2)) + " " + account_currency + "\n"; - message += "Risk: " + FormatDouble(DoubleToString(OutputRiskMoney)) + " " + account_currency + "\n"; - if (PositionMargin != 0) message += "Margin: " + FormatDouble(DoubleToString(PositionMargin, 2)) + " " + account_currency + "\n"; - message += "Entry: " + DoubleToString(sets.EntryLevel, _Digits) + "\n"; - if (!sets.DoNotApplyStopLoss) message += "Stop-loss: " + DoubleToString(sets.StopLossLevel, _Digits) + "\n"; + message += TRANSLATION_LABEL_RISK + ": " + FormatDouble(DoubleToString(OutputRiskMoney)) + " " + account_currency + "\n"; + if (PositionMargin != 0) message += TRANSLATION_TAB_BUTTON_MARGIN + ": " + FormatDouble(DoubleToString(PositionMargin, 2)) + " " + account_currency + "\n"; + message += TRANSLATION_LABEL_ENTRY + ": " + DoubleToString(sets.EntryLevel, _Digits) + "\n"; + if (!sets.DoNotApplyStopLoss) message += TRANSLATION_LABEL_STOPLOSS + ": " + DoubleToString(sets.StopLossLevel, _Digits) + "\n"; if ((sets.TakeProfitLevel > 0) && (!sets.DoNotApplyTakeProfit)) { - message += "Take-profit: " + DoubleToString(sets.TakeProfitLevel, _Digits); - if (sets.TakeProfitsNumber > 1) message += " (multiple)"; + message += TRANSLATION_LABEL_TAKEPROFIT + ": " + DoubleToString(sets.TakeProfitLevel, _Digits); + if (sets.TakeProfitsNumber > 1) message += " (" + TRANSLATION_MESSAGE_MULTIPLE + ")"; message += "\n"; } - if (expiry > 0) message += "Expiry: " + TimeToString(expiry, TIME_DATE|TIME_MINUTES|TIME_SECONDS); + if (expiry > 0) message += TRANSLATION_LABEL_EXPIRY + ": " + TimeToString(expiry, TIME_DATE|TIME_MINUTES|TIME_SECONDS); int ret = MessageBox(message, caption, MB_OKCANCEL | MB_ICONWARNING); if (ret == IDCANCEL) { - Print("Trade canceled."); + Print(TRANSLATION_MESSAGE_TRADE_CANCELED); return; } } if (sets.DoNotApplyStopLoss) { - Print("'Do not apply stop-loss' checkbox is ticked."); + Print(TRANSLATION_MESSAGE_DONOTAPPLLYSL_SET); } if (sets.DoNotApplyTakeProfit) { - Print("'Do not apply take-profit' checkbox is ticked."); + Print(TRANSLATION_MESSAGE_DONOTAPPLLYTP_SET); } // Use ArrayPositionSize that has already been calculated in CalculateRiskAndPositionSize(). @@ -317,13 +393,13 @@ void Trade() { if (ArrayPositionSize[j] < MinLot) { - Print("Position size ", ArrayPositionSize[j], " < broker's minimum position size. Not executing the trade."); + Print(TRANSLATION_LABEL_POSITION_SIZE + " ", ArrayPositionSize[j], " < " + TRANSLATION_MESSAGE_BROKER_MINIMUM); ArrayPositionSize[j] = 0; continue; } else if ((ArrayPositionSize[j] > MaxLot) && (!SurpassBrokerMaxPositionSize)) { - Print("Position size ", ArrayPositionSize[j], " > broker's maximum position size. Reducing it."); + Print(TRANSLATION_LABEL_POSITION_SIZE + " ", ArrayPositionSize[j], " > " + TRANSLATION_MESSAGE_BROKER_MAXIMUM); ArrayPositionSize[j] = MaxLot; } } @@ -385,14 +461,15 @@ void Trade() if (ticket == -1) { int error = GetLastError(); - Print("Execution failed. Error: ", IntegerToString(error), " - ", ErrorDescription(error), "."); + Print(TRANSLATION_MESSAGE_EXECUTION_FAILED + " " + TRANSLATION_MESSAGE_ERROR + ": ", IntegerToString(error), " - ", ErrorDescription(error), "."); isOrderPlacementFailing = true; } else { - if (sets.TakeProfitsNumber == 1) Print("Order executed. Ticket: ", ticket, "."); - else Print("Order #", j, " executed. Ticket: ", ticket, "."); + if (sets.TakeProfitsNumber == 1) Print(TRANSLATION_MESSAGE_ORDER_EXECUTED + " " + TRANSLATION_MESSAGE_TICKET + ": ", ticket, "."); + else Print(TRANSLATION_MESSAGE_ORDER + " #", j, " " + TRANSLATION_MESSAGE_EXECUTED + ". " + TRANSLATION_MESSAGE_TICKET + ": ", ticket, "."); AtLeastOneOrderExecuted = true; + if (IsVisualMode()) ExtDialog.CreateOutsideCloseButton(ticket); } if (!sets.DoNotApplyTakeProfit) tp = TP[j]; // Market execution mode - applying SL/TP. @@ -440,7 +517,7 @@ bool ApplySLTPToOrder(int ticket, double sl, double tp, ENUM_ORDER_TYPE ot) { if (!OrderSelect(ticket, SELECT_BY_TICKET)) { - Print("Failed to find the order to apply SL/TP."); + Print(TRANSLATION_MESSAGE_FAILED_TO_FIND_ORDER); return false; } for (int i = 0; i < 10; i++) @@ -453,7 +530,7 @@ bool ApplySLTPToOrder(int ticket, double sl, double tp, ENUM_ORDER_TYPE ot) } else { - Print("Error modifying the order: ", GetLastError()); + Print(TRANSLATION_MESSAGE_ERROR_MODIFYING_ORDER + ": ", GetLastError()); } } return false; @@ -497,7 +574,7 @@ void DoTrailingStop() for (int i = 0; i < OrdersTotal(); i++) { - if (!OrderSelect(i, SELECT_BY_POS)) Print("OrderSelect failed " + ErrorDescription(GetLastError()) + "."); + if (!OrderSelect(i, SELECT_BY_POS)) Print(TRANSLATION_MESSAGE_ORDERSELECT_FAILED + ": " + ErrorDescription(GetLastError()) + "."); else if (SymbolInfoInteger(OrderSymbol(), SYMBOL_TRADE_MODE) == SYMBOL_TRADE_MODE_DISABLED) continue; else { @@ -508,9 +585,9 @@ void DoTrailingStop() if (SL > OrderStopLoss()) { if (!OrderModify(OrderTicket(), OrderOpenPrice(), SL, OrderTakeProfit(), OrderExpiration())) - Print("OrderModify Buy TSL failed " + ErrorDescription(GetLastError()) + "."); + Print(TRANSLATION_MESSAGE_FAILED_TO_SET_TRAILING_STOP_FOR_BUY + ": " + ErrorDescription(GetLastError()) + "."); else - Print("Trailing stop was applied to position - " + Symbol() + " BUY-order #" + IntegerToString(OrderTicket()) + " Lotsize = " + DoubleToString(OrderLots(), LotStep_digits) + ", OpenPrice = " + DoubleToString(OrderOpenPrice(), _Digits) + ", Stop-Loss was moved from " + DoubleToString(OrderStopLoss(), _Digits) + " to " + DoubleToString(SL, _Digits) + "."); + Print(TRANSLATION_MESSAGE_TSL_APPLIED + " - " + Symbol() + " " + TRANSLATION_MESSAGE_BUY + " #" + IntegerToString(OrderTicket()) + " " + TRANSLATION_LABEL_POSITION_SIZE + " = " + DoubleToString(OrderLots(), LotStep_digits) + ", " + TRANSLATION_LABEL_ENTRY + " = " + DoubleToString(OrderOpenPrice(), _Digits) + ", " + TRANSLATION_MESSAGE_SL_WAS_MOVED_FROM + " " + DoubleToString(OrderStopLoss(), _Digits) + " " + TRANSLATION_MESSAGE_SL_WAS_MOVED_TO + " " + DoubleToString(SL, _Digits) + "."); } } else if (OrderType() == OP_SELL) @@ -519,9 +596,9 @@ void DoTrailingStop() if ((SL < OrderStopLoss()) || (OrderStopLoss() == 0)) { if (!OrderModify(OrderTicket(), OrderOpenPrice(), SL, OrderTakeProfit(), OrderExpiration())) - Print("OrderModify Sell TSL failed " + ErrorDescription(GetLastError()) + "."); + Print(TRANSLATION_MESSAGE_FAILED_TO_SET_TRAILING_STOP_FOR_SELL + ": " + ErrorDescription(GetLastError()) + "."); else - Print("Trailing stop was applied to position - " + Symbol() + " SELL-order #" + IntegerToString(OrderTicket()) + " Lotsize = " + DoubleToString(OrderLots(), LotStep_digits) + ", OpenPrice = " + DoubleToString(OrderOpenPrice(), _Digits) + ", Stop-Loss was moved from " + DoubleToString(OrderStopLoss(), _Digits) + " to " + DoubleToString(SL, _Digits) + "."); + Print(TRANSLATION_MESSAGE_TSL_APPLIED + " - " + Symbol() + " " + TRANSLATION_MESSAGE_SELL + " #" + IntegerToString(OrderTicket()) + " " + TRANSLATION_LABEL_POSITION_SIZE + " = " + DoubleToString(OrderLots(), LotStep_digits) + ", " + TRANSLATION_LABEL_ENTRY + " = " + DoubleToString(OrderOpenPrice(), _Digits) + ", " + TRANSLATION_MESSAGE_SL_WAS_MOVED_FROM + " " + DoubleToString(OrderStopLoss(), _Digits) + " " + TRANSLATION_MESSAGE_SL_WAS_MOVED_TO + " " + DoubleToString(SL, _Digits) + "."); } } } @@ -566,7 +643,7 @@ void DoBreakEven() for (int i = 0; i < OrdersTotal(); i++) { - if (!OrderSelect(i, SELECT_BY_POS)) Print("OrderSelect failed " + ErrorDescription(GetLastError()) + "."); + if (!OrderSelect(i, SELECT_BY_POS)) Print(TRANSLATION_MESSAGE_ORDERSELECT_FAILED + ": " + ErrorDescription(GetLastError()) + "."); else if (SymbolInfoInteger(OrderSymbol(), SYMBOL_TRADE_MODE) == SYMBOL_TRADE_MODE_DISABLED) continue; else { @@ -596,9 +673,9 @@ void DoBreakEven() double prev_sl = OrderStopLoss(); // Remember old SL for reporting. // Write Open price to the SL field. if (!OrderModify(OrderTicket(), OrderOpenPrice(), BE_price, OrderTakeProfit(), OrderExpiration())) - Print("OrderModify Buy BE failed " + ErrorDescription(GetLastError()) + "."); + Print(TRANSLATION_MESSAGE_ERROR_MODIFYING_ORDER + ": " + ErrorDescription(GetLastError()) + "."); else - Print("Breakeven was applied to position - " + Symbol() + " BUY-order #" + IntegerToString(OrderTicket()) + " Lotsize = " + DoubleToString(OrderLots(), LotStep_digits) + ", OpenPrice = " + DoubleToString(OrderOpenPrice(), _Digits) + ", Stop-Loss was moved from " + DoubleToString(prev_sl, _Digits) + "."); + Print(TRANSLATION_MESSAGE_BE_APPLIED + " - " + Symbol() + " " + TRANSLATION_MESSAGE_BUY + " #" + IntegerToString(OrderTicket()) + " " + TRANSLATION_LABEL_POSITION_SIZE + " = " + DoubleToString(OrderLots(), LotStep_digits) + ", " + TRANSLATION_LABEL_ENTRY + " = " + DoubleToString(OrderOpenPrice(), _Digits) + ", " + TRANSLATION_MESSAGE_SL_WAS_MOVED_FROM + " " + DoubleToString(OrderStopLoss(), _Digits) + " " + TRANSLATION_MESSAGE_SL_WAS_MOVED_TO + " " + DoubleToString(BE_price, _Digits) + "."); } } else if (OrderType() == OP_SELL) @@ -611,9 +688,9 @@ void DoBreakEven() double prev_sl = OrderStopLoss(); // Remember old SL for reporting. // Write Open price to the SL field. if (!OrderModify(OrderTicket(), OrderOpenPrice(), BE_price, OrderTakeProfit(), OrderExpiration())) - Print("OrderModify Sell BE failed " + ErrorDescription(GetLastError()) + "."); + Print(TRANSLATION_MESSAGE_ERROR_MODIFYING_ORDER + ": " + ErrorDescription(GetLastError()) + "."); else - Print("Breakeven was applied to position - " + Symbol() + " SELL-order #" + IntegerToString(OrderTicket()) + " Lotsize = " + DoubleToString(OrderLots(), LotStep_digits) + ", OpenPrice = " + DoubleToString(OrderOpenPrice(), _Digits) + ", Stop-Loss was moved from " + DoubleToString(prev_sl, _Digits) + "."); + Print(TRANSLATION_MESSAGE_BE_APPLIED + " - " + Symbol() + " " + TRANSLATION_MESSAGE_SELL + " #" + IntegerToString(OrderTicket()) + " " + TRANSLATION_LABEL_POSITION_SIZE + " = " + DoubleToString(OrderLots(), LotStep_digits) + ", " + TRANSLATION_LABEL_ENTRY + " = " + DoubleToString(OrderOpenPrice(), _Digits) + ", " + TRANSLATION_MESSAGE_SL_WAS_MOVED_FROM + " " + DoubleToString(OrderStopLoss(), _Digits) + " " + TRANSLATION_MESSAGE_SL_WAS_MOVED_TO + " " + DoubleToString(BE_price, _Digits) + "."); } } } @@ -647,11 +724,33 @@ void DrawBELine(int ticket, double be_threshold, double be_price) ObjectSetInteger(ChartID(), obj_name, OBJPROP_CORNER, CORNER_LEFT_UPPER); ObjectSetInteger(ChartID(), obj_name, OBJPROP_BACK, DrawTextAsBackground); ObjectSetString(ChartID(), obj_name, OBJPROP_TOOLTIP, ""); - string text = "BE for "; - if (OrderType() == OP_BUY) text += "Buy"; - else if (OrderType() == OP_SELL) text += "Sell"; + string text = TRANSLATION_MESSAGE_BE_FOR; + if (OrderType() == OP_BUY) text += TRANSLATION_MESSAGE_BUY; + else if (OrderType() == OP_SELL) text += TRANSLATION_MESSAGE_SELL; text += " #" + IntegerToString(ticket); DrawLineLabel(obj_name, text, be_threshold, be_line_color, false, -6); } } + +// Returns a normal name for a given order type. +string OrderTypeToString(int ot) +{ + switch(ot) + { + case OP_BUY: + return TRANSLATION_MESSAGE_BUY; + case OP_BUYSTOP: + return TRANSLATION_MESSAGE_BUY_STOP; + case OP_BUYLIMIT: + return TRANSLATION_MESSAGE_BUY_LIMIT; + case OP_SELL: + return TRANSLATION_MESSAGE_SELL; + case OP_SELLSTOP: + return TRANSLATION_MESSAGE_SELL_STOP; + case OP_SELLLIMIT: + return TRANSLATION_MESSAGE_SELL_LIMIT; + default: + return TRANSLATION_LABEL_UNKNOWN; + } +} //+------------------------------------------------------------------+ \ No newline at end of file diff --git a/MQL4/Experts/Position Sizer/Position Sizer.mq4 b/MQL4/Experts/Position Sizer/Position Sizer.mq4 index 84edcb7..e65d65c 100644 --- a/MQL4/Experts/Position Sizer/Position Sizer.mq4 +++ b/MQL4/Experts/Position Sizer/Position Sizer.mq4 @@ -6,10 +6,19 @@ #property copyright "EarnForex.com" #property link "https://www.earnforex.com/metatrader-expert-advisors/Position-Sizer/" #property icon "EF-Icon-64x64px.ico" -#property version "3.09" -string Version = "3.09"; +#property version "3.10" +string Version = "3.10"; #property strict +#include "Translations\English.mqh" +//#include "Translations\Arabic.mqh" +//#include "Translations\Chinese.mqh" +//#include "Translations\ChineseTraditional.mqh" // Contributed by fxchess. +//#include "Translations\Portuguese.mqh" // Contributed by Matheus Sevaroli. +//#include "Translations\Russian.mqh" +//#include "Translations\Spanish.mqh" +//#include "Translations\Ukrainian.mqh" + #property description "Calculates risk-based position size for your account." #property description "Allows trade execution based the calculation results.\r\n" #property description "WARNING: No warranty. This EA is offered \"as is\". Use at your own risk.\r\n" @@ -17,6 +26,7 @@ string Version = "3.09"; #include "Position Sizer.mqh"; #include "Position Sizer Trading.mqh"; +#include "TesterSupport.mqh" input group "Compactness" input string ____Compactness = ""; @@ -72,7 +82,7 @@ input ENUM_TIMEFRAMES DefaultATRTimeframe = PERIOD_CURRENT; // ATRTimeframe: Def input bool DefaultSpreadAdjustmentSL = false; // SpreadAdjustmentSL: Adjust SL by Spread value in ATR mode. input bool DefaultSpreadAdjustmentTP = false; // SpreadAdjustmentTP: Adjust TP by Spread value in ATR mode. input double DefaultCommission = 0; // Commission: Default one-way commission per 1 lot. -input COMMISSION_TYPE DefaultCommissionType = COMMISSION_CURRENCY; // CommossionType: Default commission type. +input COMMISSION_TYPE DefaultCommissionType = COMMISSION_CURRENCY; // CommissionType: Default commission type. input ACCOUNT_BUTTON DefaultAccountButton = Balance; // AccountButton: Balance/Equity/Balance-CPR input double DefaultRisk = 1; // Risk: Initial risk tolerance in percentage points input double DefaultMoneyRisk = 0; // MoneyRisk: If > 0, money risk tolerance in currency. @@ -80,16 +90,17 @@ input double DefaultPositionSize = 0; // PositionSize: If > 0, position size in input bool DefaultCountPendingOrders = false; // CountPendingOrders: Count pending orders for portfolio risk. input bool DefaultIgnoreOrdersWithoutSL = false; // IgnoreOrdersWithoutSL: Ignore orders w/o SL in portfolio risk. input bool DefaultIgnoreOrdersWithoutTP = false; // IgnoreOrdersWithoutTP: Ignore orders w/o TP in portfolio risk. -input bool DefaultIgnoreOtherSymbols = false; // IgnoreOtherSymbols: Ignore other symbols' orders in portfolio risk. +input IGNORE_SYMBOLS DefaultIgnoreSymbols = IGNORE_SYMBOLS_NONE; // IgnoreSymbols: Ignore trades in some symbols for portfolio risk? input double DefaultCustomLeverage = 0; // CustomLeverage: Default custom leverage for Margin tab. input int DefaultMagicNumber = 2022052714; // MagicNumber: Default magic number for Trading tab. input string DefaultCommentary = ""; // Commentary: Default order comment for Trading tab. -input bool DefaultCommentAutoSuffix = false; // AutoSuffix: Automatic suffix for order commentary in Trading tab. +input bool DefaultCommentAutoSuffix = false; // AutoSuffix: Automatic suffix for order comment in Trading tab. input bool DefaultDisableTradingWhenLinesAreHidden = false; // DisableTradingWhenLinesAreHidden: for Trading tab. input int DefaultMaxSlippage = 0; // MaxSlippage: Maximum slippage for Trading tab. input int DefaultMaxSpread = 0; // MaxSpread: Maximum spread for Trading tab. input int DefaultMaxEntrySLDistance = 0; // MaxEntrySLDistance: Maximum entry/SL distance for Trading tab. input int DefaultMinEntrySLDistance = 0; // MinEntrySLDistance: Minimum entry/SL distance for Trading tab. +input double DefaultMaxRiskPercentage = 0; // MaxRiskPercentage: Maximum risk % for Trading tab. input double DefaultMaxPositionSizeTotal = 0; // Maximum position size total for Trading tab. input double DefaultMaxPositionSizePerSymbol = 0; // Maximum position size per symbol for Trading tab. input bool DefaultSubtractOPV = false; // SubtractOPV: Subtract open positions volume (Trading tab). @@ -139,11 +150,13 @@ input string ObjectPrefix = "PS_"; // ObjectPrefix: To prevent confusion with ot input SYMBOL_CHART_CHANGE_REACTION SymbolChange = SYMBOL_CHART_CHANGE_EACH_OWN; // SymbolChange: What to do with the panel on chart symbol change? input bool DisableTradingSounds = false; // DisableTradingSounds: If true, sound will be off for trading actions. input bool IgnoreMarketExecutionMode = true; // IgnoreMarketExecutionMode: If true, ignore Market execution. -input bool MarketModeApplySLTPAfterAllTradesExecuted = false; // Market Mode - Apply SL/TP After All Trades Executed +input bool MarketModeApplySLTPAfterAllTradesExecuted = false; // Market Mode: Apply SL/TP after all trades executed. input bool DarkMode = false; // DarkMode: Enable dark mode for a less bright panel. -input string SettingsFile = ""; // SettingsFile: Load custom panel settings from \Files\ folder. +input string SettingsFile = ""; // SettingsFile: Custom settings file from \Files\PS_Settings\ input bool PrefillAdditionalTPsBasedOnMain = true; // Prefill additional TPs based on Main? input bool AskBeforeClosing = false; // Ask for confirmation before closing the panel? +input bool CapMaxPositionSizeBasedOnMargin = false; // Cap position size based on available margin? +input bool LessRestrictiveMaxLimits = false; // Allow smaller trades when trading limits are exceeded? CPositionSizeCalculator* ExtDialog; @@ -212,7 +225,7 @@ int OnInit() ExtDialog.UpdateFileName(); // Update the filename. // Reset everything. - OutputPointValue = ""; OutputSwapsType = "Unknown"; SwapsTripleDay = "?"; + OutputPointValue = ""; OutputSwapsType = TRANSLATION_LABEL_UNKNOWN; SwapsTripleDay = "?"; OutputSwapsDailyLongLot = "?"; OutputSwapsDailyShortLot = "?"; OutputSwapsDailyLongPS = "?"; OutputSwapsDailyShortPS = "?"; OutputSwapsYearlyLongLot = "?"; OutputSwapsYearlyShortLot = "?"; OutputSwapsYearlyLongPS = "?"; OutputSwapsYearlyShortPS = "?"; OutputSwapsCurrencyDailyLot = ""; OutputSwapsCurrencyDailyPS = ""; OutputSwapsCurrencyYearlyLot = ""; OutputSwapsCurrencyYearlyPS = ""; @@ -269,7 +282,7 @@ int OnInit() sets.CountPendingOrders = DefaultCountPendingOrders; // If true, portfolio risk calculation will also involve pending orders. sets.IgnoreOrdersWithoutSL = DefaultIgnoreOrdersWithoutSL; // If true, portfolio risk calculation will skip orders without stop-loss. sets.IgnoreOrdersWithoutTP = DefaultIgnoreOrdersWithoutTP; // If true, portfolio risk calculation will skip orders without take-profit. - sets.IgnoreOtherSymbols = DefaultIgnoreOtherSymbols; // If true, portfolio risk calculation will skip orders in other symbols. + sets.IgnoreSymbols = DefaultIgnoreSymbols; // Skip trades in other/current/no symbols for portfolio risk calculation. sets.HideAccSize = HideAccSize; // If true, account size line will not be shown. sets.ShowLines = DefaultShowLines; sets.SelectedTab = MainTab; @@ -292,6 +305,7 @@ int OnInit() sets.MinEntrySLDistance = DefaultMinEntrySLDistance; sets.MaxPositionSizeTotal = DefaultMaxPositionSizeTotal; sets.MaxPositionSizePerSymbol = DefaultMaxPositionSizePerSymbol; + sets.MaxRiskPercentage = DefaultMaxRiskPercentage; if ((sets.MaxPositionSizeTotal < sets.MaxPositionSizePerSymbol) && (sets.MaxPositionSizeTotal != 0)) sets.MaxPositionSizeTotal = sets.MaxPositionSizePerSymbol; sets.StopLoss = 0; sets.TakeProfit = 0; @@ -458,7 +472,10 @@ int OnInit() ExtDialog.ChartEvent(CHARTEVENT_CHART_CHANGE, lparam, dparam, sparam); } - if (!EventSetTimer(1)) Print("Error setting timer: ", GetLastError()); + if (!IsVisualMode()) // The timer doesn't work in MT4 Strategy Tester. + { + if (!EventSetTimer(1)) Print(TRANSLATION_MESSAGE_ERROR_SETTING_TIMER + ": ", GetLastError()); + } if (DarkMode) { @@ -531,7 +548,7 @@ void OnDeinit(const int reason) if ((reason == REASON_REMOVE) || (reason == REASON_PROGRAM)) { if (SettingsFile == "") ExtDialog.DeleteSettingsFile(); - if (!FileDelete(ExtDialog.IniFileName() + ExtDialog.IniFileExt())) Print("Failed to delete the PS panel's .ini file: ", GetLastError()); + if (!FileDelete(ExtDialog.IniFileName() + ExtDialog.IniFileExt())) Print(TRANSLATION_MESSAGE_FAILED_DELETE_INI + ": ", GetLastError()); } } @@ -566,6 +583,12 @@ void OnDeinit(const int reason) void OnTick() { + if (IsVisualMode()) // Visual backtesting. + { + ListenToChartEvents(ExtDialog.Name()); // Check and generate chart events in Strategy Tester. + ExtDialog.UpdateStrategyTesterTrades(); + } + ExtDialog.RefreshValues(); if (sets.TrailingStopPoints > 0) DoTrailingStop(); @@ -619,13 +642,31 @@ void OnChartEvent(const int id, } } - // This cannot be done using the panel's event handler because the outside trade button isn't added to its list of controls. - if ((id == CHARTEVENT_OBJECT_CLICK) && (sparam == ExtDialog.Name() + "m_OutsideTradeButton")) + // Some buttons cannot be processed using the panel's event handler because they aren't added to the panel's list of controls. + if (id == CHARTEVENT_OBJECT_CLICK) { - ExtDialog.m_OutsideTradeButton.Pressed(false); - Trade(); + // Outside trade button: + if (sparam == ExtDialog.Name() + "m_OutsideTradeButton") + { + ExtDialog.m_OutsideTradeButton.Pressed(false); + Trade(); + } + else if (IsVisualMode()) + { + // Button to switch the corner of the outside close buttons. + if (sparam == ExtDialog.Name() + "m_BtnOutsideCloseButtonsSwitchButton") + { + ExtDialog.ProcessOutsideCloseButtonsSwitchClick(); + } + // Outside close button: + else if (StringSubstr(sparam, 0, StringLen(ExtDialog.Name() + "m_BtnOutsideClose")) == ExtDialog.Name() + "m_BtnOutsideClose") + { + int i = (int)StringToInteger(StringSubstr(sparam, StringLen(ExtDialog.Name() + "m_BtnOutsideClose"))); + ExtDialog.ProcessOutsideCloseButtonClick(i); + } + } } - + if (id == CHARTEVENT_CLICK) // Avoid "sticking" of xxxLineIsBeingMoved variables. { StopLossLineIsBeingMoved = false; @@ -826,7 +867,7 @@ void OnChartEvent(const int id, else { sets.TPDistanceInPoints = true; // If was in level, set to points. - sets.TakeProfit = (int)MathRound(MathAbs(sets.TakeProfitLevel - sets.EntryLevel) / _Point); + if (sets.TakeProfitLevel != 0) sets.TakeProfit = (int)MathRound(MathAbs(sets.TakeProfitLevel - sets.EntryLevel) / _Point); // Additional take-profits. if (sets.TakeProfitsNumber > 1) { @@ -834,7 +875,7 @@ void OnChartEvent(const int id, { if (sets.TP[i] != 0) // With zero points TP, keep the TP lines at zero level - as with the main TP level. { - ExtDialog.AdditionalTPEdits[i - 1].Text(DoubleToString(MathAbs(MathRound((sets.TP[i] - sets.EntryLevel) / _Point)), 0)); + if (sets.TP[i] != 0) ExtDialog.AdditionalTPEdits[i - 1].Text(DoubleToString(MathAbs(MathRound((sets.TP[i] - sets.EntryLevel) / _Point)), 0)); } } } @@ -847,8 +888,8 @@ void OnChartEvent(const int id, if (id != CHARTEVENT_CHART_CHANGE) ExtDialog.OnEvent(id, lparam, dparam, sparam); // Recalculate on chart changes, clicks, and certain object dragging. - if ((id == CHARTEVENT_CLICK) || (id == CHARTEVENT_CHART_CHANGE) || - ((id == CHARTEVENT_OBJECT_DRAG) && ((sparam == ObjectPrefix + "EntryLine") || (sparam == ObjectPrefix + "StopLossLine") || (StringFind(sparam, ObjectPrefix + "TakeProfitLine") != -1)))) + if ((id == CHARTEVENT_CLICK) || (id == CHARTEVENT_CHART_CHANGE) || ((id == CHARTEVENT_OBJECT_DRAG) && + ((sparam == ObjectPrefix + "EntryLine") || (sparam == ObjectPrefix + "StopLossLine") || (StringFind(sparam, ObjectPrefix + "TakeProfitLine") != -1)))) { // Moving lines when fixed SL/TP distance is enabled. Should set a new fixed SL/TP distance. if ((id == CHARTEVENT_OBJECT_DRAG) && ((sets.SLDistanceInPoints) || (sets.TPDistanceInPoints) || (ShowATROptions))) diff --git a/MQL4/Experts/Position Sizer/Position Sizer.mqh b/MQL4/Experts/Position Sizer/Position Sizer.mqh index 4bc8ecc..329f6ae 100644 --- a/MQL4/Experts/Position Sizer/Position Sizer.mqh +++ b/MQL4/Experts/Position Sizer/Position Sizer.mqh @@ -4,6 +4,7 @@ //| https://www.earnforex.com/ | //+------------------------------------------------------------------+ #include "Defines.mqh" +#include // Default values for settings: double EntryLevel = 0; @@ -15,10 +16,10 @@ string PanelCaptionBase = ""; class CPositionSizeCalculator : public CAppDialog { private: - CButton m_BtnTabMain, m_BtnTabRisk, m_BtnTabMargin, m_BtnTabSwaps, m_BtnTabTrading, m_BtnOrderType, m_BtnAccount, m_BtnLines, m_BtnStopLoss, m_BtnTakeProfit, m_BtnEntry, m_BtnATRTimeframe, m_BtnCommissionType, m_BtnMaxPS, m_BtnTrade, m_BtnTPsInward, m_BtnTPsOutward, m_BtnTradingTPShare, m_BtnQuickRisk1, m_BtnQuickRisk2, m_BtnEntryIncrease, m_BtnEntryDecrease, m_BtnStopLossIncrease, m_BtnStopLossDecrease, m_BtnTakeProfitIncrease, m_BtnTakeProfitDecrease, m_BtnTakeProfitsNumberAdd, m_BtnTakeProfitsNumberRemove, m_BtnMainTrade; - CCheckBox m_ChkSpreadAdjustmentSL, m_ChkSpreadAdjustmentTP, m_ChkCountPendings, m_ChkIgnoreOrdersWithoutSL, m_ChkIgnoreOrdersWithoutTP, m_ChkIgnoreOtherSymbols, m_ChkDisableTradingWhenLinesAreHidden, m_ChkSubtractPositions, m_ChkSubtractPendingOrders, m_ChkDoNotApplyStopLoss, m_ChkDoNotApplyTakeProfit, m_ChkAskForConfirmation, m_ChkCommentAutoSuffix; - CEdit m_EdtEntryLevel, m_EdtSL, m_EdtTP, m_EdtAccount, m_EdtCommissionSize, m_EdtRiskPIn, m_EdtRiskPRes, m_EdtRiskMIn, m_EdtRiskMRes, m_EdtReward1, m_EdtReward2, m_EdtRR1, m_EdtRR2, m_EdtPosSize, m_EdtPointValue, m_EdtATRPeriod, m_EdtATRMultiplierSL, m_EdtATRMultiplierTP, m_EdtCurRiskM, m_EdtCurRiskP, m_EdtPotRiskM, m_EdtPotRiskP, m_EdtCurProfitM, m_EdtCurProfitP, m_EdtPotProfitM, m_EdtPotProfitP, m_EdtCurL, m_EdtPotL, m_EdtCurrentRRR, m_EdtPotentialRRR, m_EdtPosMargin, m_EdtUsedMargin, m_EdtFreeMargin, m_EdtCustomLeverage, m_EdtMaxPositionSizeByMargin, m_EdtSwapsType, m_EdtSwapsTripleDay, m_EdtSwapsNominalLong, m_EdtSwapsNominalShort, m_EdtSwapsDailyLongLot, m_EdtSwapsDailyShortLot, m_EdtSwapsDailyLongPS, m_EdtSwapsDailyShortPS, m_EdtSwapsYearlyLongLot, m_EdtSwapsYearlyShortLot, m_EdtSwapsYearlyLongPS, m_EdtSwapsYearlyShortPS, m_EdtMagicNumber, m_EdtExpiry, m_EdtCommentary, m_EdtMaxSlippage, m_EdtMaxSpread, m_EdtMaxEntrySLDistance, m_EdtMinEntrySLDistance, m_EdtMaxPositionSize, m_EdtTrailingStopPoints, m_EdtBreakEvenPoints, m_EdtMaxNumberOfTradesTotal, m_EdtMaxNumberOfTradesPerSymbol, m_EdtMaxPositionSizeTotal, m_EdtMaxPositionSizePerSymbol, m_EdtMaxRiskTotal, m_EdtMaxRiskPerSymbol; - CLabel m_LblEntryLevel, m_LblEntryWarning, m_LblSL, m_LblSLWarning, m_LblTPWarning, m_LblOrderType, m_LblCommissionSize, m_LblAdditionalFundsAsterisk, m_LblInput, m_LblResult, m_LblRisk, m_LblRiskM, m_LblReward, m_LblRR, m_LblPosSize, m_LblPointValue, m_LblATRPeriod, m_LblATRMultiplierSL, m_LblATRMultiplierTP, m_LblATRValue, m_LblATRTimeframe, m_LblCurrentRiskMoney, m_LblCurrentRiskPerc, m_LblCurrentProfitMoney, m_LblCurrentProfitPerc, m_LblPotentialRiskMoney, m_LblPotentialRiskPerc, m_LblPotentialProfitMoney, m_LblPotentialProfitPerc, m_LblCurrentLots, m_LblCurrentRRR, m_LblPotentialLots, m_LblPotentialRRR, m_LblCurrentPortfolio, m_LblPotentialPortfolio, m_LblPosMargin, m_LblUsedMargin, m_LblFreeMargin, m_LblCustomLeverage, m_LblAccLeverage, m_LblSymbolLeverage, m_LblMaxPositionSizeByMargin, m_LblSwapsType, m_LblSwapsTripleDay, m_LblSwapsLong, m_LblSwapsShort, m_LblSwapsNominal, m_LblSwapsDaily, m_LblSwapsYearly, m_LblSwapsPerLotDaily, m_LblSwapsPerPSDaily, m_LblSwapsPerLotYearly, m_LblSwapsPerPSYearly, m_LblMagicNumber, m_LblExpiry, m_LblMinutes, m_LblCommentary, m_LblTradingPoints, m_LblMaxSlippage, m_LblMaxSpread, m_LblMaxEntrySLDistance, m_LblMinEntrySLDistance, m_LblTradingLots, m_LblURL, m_LblTradingTP, m_LblTrailingStop, m_LblBreakEven, m_LblMaxNumberOfTrades, m_LblMaxNumberOfTradesTotal, m_LblMaxNumberOfTradesPerSymbol, m_LblMaxPositionSize, m_LblMaxPositionSizeTotal, m_LblMaxPositionSizePerSymbol, m_LblMaxRisk, m_LblMaxRiskTotal, m_LblMaxRiskPerSymbol; + CButton m_BtnTabMain, m_BtnTabRisk, m_BtnTabMargin, m_BtnTabSwaps, m_BtnTabTrading, m_BtnOrderType, m_BtnAccount, m_BtnLines, m_BtnStopLoss, m_BtnTakeProfit, m_BtnEntry, m_BtnATRTimeframe, m_BtnCommissionType, m_BtnMaxPS, m_BtnTrade, m_BtnTPsInward, m_BtnTPsOutward, m_BtnTradingTPShare, m_BtnQuickRisk1, m_BtnQuickRisk2, m_BtnEntryIncrease, m_BtnEntryDecrease, m_BtnStopLossIncrease, m_BtnStopLossDecrease, m_BtnTakeProfitIncrease, m_BtnTakeProfitDecrease, m_BtnTakeProfitsNumberAdd, m_BtnTakeProfitsNumberRemove, m_BtnMainTrade, m_BtnIgnoreSymbols; + CCheckBox m_ChkSpreadAdjustmentSL, m_ChkSpreadAdjustmentTP, m_ChkCountPendings, m_ChkIgnoreOrdersWithoutSL, m_ChkIgnoreOrdersWithoutTP, m_ChkDisableTradingWhenLinesAreHidden, m_ChkSubtractPositions, m_ChkSubtractPendingOrders, m_ChkDoNotApplyStopLoss, m_ChkDoNotApplyTakeProfit, m_ChkAskForConfirmation, m_ChkCommentAutoSuffix; + CEdit m_EdtEntryLevel, m_EdtSL, m_EdtTP, m_EdtAccount, m_EdtCommissionSize, m_EdtRiskPIn, m_EdtRiskPRes, m_EdtRiskMIn, m_EdtRiskMRes, m_EdtReward1, m_EdtReward2, m_EdtRR1, m_EdtRR2, m_EdtPosSize, m_EdtPointValue, m_EdtATRPeriod, m_EdtATRMultiplierSL, m_EdtATRMultiplierTP, m_EdtCurRiskM, m_EdtCurRiskP, m_EdtPotRiskM, m_EdtPotRiskP, m_EdtCurProfitM, m_EdtCurProfitP, m_EdtPotProfitM, m_EdtPotProfitP, m_EdtCurL, m_EdtPotL, m_EdtCurrentRRR, m_EdtPotentialRRR, m_EdtPosMargin, m_EdtUsedMargin, m_EdtFreeMargin, m_EdtCustomLeverage, m_EdtMaxPositionSizeByMargin, m_EdtSwapsType, m_EdtSwapsTripleDay, m_EdtSwapsNominalLong, m_EdtSwapsNominalShort, m_EdtSwapsDailyLongLot, m_EdtSwapsDailyShortLot, m_EdtSwapsDailyLongPS, m_EdtSwapsDailyShortPS, m_EdtSwapsYearlyLongLot, m_EdtSwapsYearlyShortLot, m_EdtSwapsYearlyLongPS, m_EdtSwapsYearlyShortPS, m_EdtMagicNumber, m_EdtExpiry, m_EdtCommentary, m_EdtMaxSlippage, m_EdtMaxSpread, m_EdtMaxEntrySLDistance, m_EdtMinEntrySLDistance, m_EdtTrailingStopPoints, m_EdtBreakEvenPoints, m_EdtMaxNumberOfTradesTotal, m_EdtMaxNumberOfTradesPerSymbol, m_EdtMaxPositionSizeTotal, m_EdtMaxPositionSizePerSymbol, m_EdtMaxRiskTotal, m_EdtMaxRiskPerSymbol, m_EdtMaxRiskPercentage; + CLabel m_LblEntryLevel, m_LblEntryWarning, m_LblSL, m_LblSLWarning, m_LblTPWarning, m_LblOrderType, m_LblCommissionSize, m_LblAdditionalFundsAsterisk, m_LblInput, m_LblResult, m_LblRisk, m_LblRiskM, m_LblReward, m_LblRR, m_LblPosSize, m_LblPointValue, m_LblATRPeriod, m_LblATRMultiplierSL, m_LblATRMultiplierTP, m_LblATRValue, m_LblATRTimeframe, m_LblCurrentRiskMoney, m_LblCurrentRiskPerc, m_LblCurrentProfitMoney, m_LblCurrentProfitPerc, m_LblPotentialRiskMoney, m_LblPotentialRiskPerc, m_LblPotentialProfitMoney, m_LblPotentialProfitPerc, m_LblCurrentLots, m_LblCurrentRRR, m_LblPotentialLots, m_LblPotentialRRR, m_LblCurrentPortfolio, m_LblPotentialPortfolio, m_LblPosMargin, m_LblUsedMargin, m_LblFreeMargin, m_LblCustomLeverage, m_LblAccLeverage, m_LblSymbolLeverage, m_LblMaxPositionSizeByMargin, m_LblSwapsType, m_LblSwapsTripleDay, m_LblSwapsLong, m_LblSwapsShort, m_LblSwapsNominal, m_LblSwapsDaily, m_LblSwapsYearly, m_LblSwapsPerLotDaily, m_LblSwapsPerPSDaily, m_LblSwapsPerLotYearly, m_LblSwapsPerPSYearly, m_LblMagicNumber, m_LblExpiry, m_LblMinutes, m_LblCommentary, m_LblTradingPoints, m_LblMaxSlippage, m_LblMaxSpread, m_LblMaxEntrySLDistance, m_LblMinEntrySLDistance, m_LblTradingLots, m_LblURL, m_LblTradingTP, m_LblTrailingStop, m_LblBreakEven, m_LblMaxNumberOfTrades, m_LblMaxNumberOfTradesTotal, m_LblMaxNumberOfTradesPerSymbol, m_LblMaxPositionSize, m_LblMaxPositionSizeTotal, m_LblMaxPositionSizePerSymbol, m_LblMaxRisk, m_LblMaxRiskTotal, m_LblMaxRiskPerSymbol, m_LblMaxRiskPercentage, m_LblIgnoreSymbols; string m_FileName; double m_DPIScale; bool NoPanelMaximization; // A crutch variable to prevent panel maximization when Maximize() is called at the indicator's initialization. @@ -30,12 +31,15 @@ private: CLabel AdditionalTPLabels[], AdditionalTPWarnings[]; CButton AdditionalTPButtonsIncrease[], AdditionalTPButtonsDecrease[]; // Store ordered and named panel objects arranged by tabs. - CPanelList *MainTabList, *RiskTabList, *MarginTabList, *SwapsTabList, *TradingTabList; + CPanelList *MainTabList, *RiskTabList, *MarginTabList, *SwapsTabList, *TradingTabList, *PersistentList; // PersisntentList is used for Strategy Tester event tracking only. // Some of the panel measurement parameters are used by more than one method: int first_column_start, normal_label_width, normal_edit_width, second_column_start, element_height, third_column_start, narrow_label_width, v_spacing, multi_tp_column_start, multi_tp_label_width, multi_tp_button_start, leverage_edit_width, third_trading_column_start, second_trading_column_start; - + CChartObjectButton OutsideCloseButtons[]; // Used to store order close buttons for visual backtesting. CChartObjectButton because, unlike CButton, it supports OBJPROP_CORNER changes. + CChartObjectButton OutsideCloseButtonsSwitchButton; // Switches chart corner for close buttons output. + ENUM_BASE_CORNER OutsideCloseButtonsCorner; + public: CPositionSizeCalculator(void); ~CPositionSizeCalculator(void); @@ -69,7 +73,7 @@ public: virtual void CheckAndRestoreLines(); virtual void Minimize(); virtual bool IsMinimized() {return m_minimized;} - virtual void IniFileLoad() {CAppDialog::IniFileLoad();ExtDialog.InitObjects();} // Need to init objects after ini file load. + virtual void IniFileLoad() {if (FileIsExist(ExtDialog.IniFileName() + ExtDialog.IniFileExt())) CAppDialog::IniFileLoad(); InitObjects();} // Need to init objects after ini file load. virtual void EmulateMinMaxClick(); void OnClickBtnTakeProfitsNumberAdd(); void OnClickBtnTakeProfitsNumberRemove(); @@ -86,9 +90,19 @@ public: void SetFileName(string file_name) {m_FileName = file_name;} void InitControlsValues(); void SetTPButtonBackGroundColor(color); - CEdit AdditionalTPEdits[]; - CButton m_OutsideTradeButton; + CEdit AdditionalTPEdits[]; + CButton m_OutsideTradeButton; void MoveOutsideTradeButton(); + long FindControlId(string); // For Strategy Tester support. + long FindControlIdInList(string, CPanelList*); + void CreateOutsideCloseButton(int); + void ProcessOutsideCloseButtonClick(int); + void RemoveOutsideCloseButton(int); + bool CloseOrder(int); + void UpdateStrategyTesterTrades(); + void CreateOutsideCloseButtonsSwitch(); + void ProcessOutsideCloseButtonsSwitchClick(); + long MinMaxButtonId; // Stores dynamically generated id of the minmax button control. // Remember the panel's location to have the same location for minimized and maximized states. int remember_top, remember_left; @@ -145,7 +159,7 @@ private: void OnChangeChkCountPendings(); void OnChangeChkIgnoreOrdersWithoutSL(); void OnChangeChkIgnoreOrdersWithoutTP(); - void OnChangeChkIgnoreOtherSymbols(); + void OnClickBtnIgnoreSymbols(); void OnEndEditEdtCustomLeverage(); void OnEndEditEdtMagicNumber(); void OnEndEditEdtCommentary(); @@ -154,6 +168,7 @@ private: void OnEndEditEdtMaxSpread(); void OnEndEditEdtMaxEntrySLDistance(); void OnEndEditEdtMinEntrySLDistance(); + void OnEndEditEdtMaxRiskPercentage(); void OnEndEditEdtMaxPositionSizeTotal(); void OnEndEditEdtMaxPositionSizePerSymbol(); void OnEndEditEdtTrailingStopPoints(); @@ -213,23 +228,30 @@ ON_EVENT(ON_CHANGE, m_ChkSpreadAdjustmentTP, OnChangeChkSpreadAdjustmentTP) ON_EVENT(ON_CHANGE, m_ChkCountPendings, OnChangeChkCountPendings) ON_EVENT(ON_CHANGE, m_ChkIgnoreOrdersWithoutSL, OnChangeChkIgnoreOrdersWithoutSL) ON_EVENT(ON_CHANGE, m_ChkIgnoreOrdersWithoutTP, OnChangeChkIgnoreOrdersWithoutTP) -ON_EVENT(ON_CHANGE, m_ChkIgnoreOtherSymbols, OnChangeChkIgnoreOtherSymbols) +ON_EVENT(ON_CLICK, m_BtnIgnoreSymbols, OnClickBtnIgnoreSymbols) ON_EVENT(ON_END_EDIT, m_EdtCustomLeverage, OnEndEditEdtCustomLeverage) ON_EVENT(ON_END_EDIT, m_EdtMagicNumber, OnEndEditEdtMagicNumber) ON_EVENT(ON_END_EDIT, m_EdtCommentary, OnEndEditEdtCommentary) ON_EVENT(ON_CHANGE, m_ChkDisableTradingWhenLinesAreHidden, OnChangeChkDisableTradingWhenLinesAreHidden) +ON_EVENT(ON_END_EDIT, m_EdtTrailingStopPoints, OnEndEditEdtTrailingStopPoints) +ON_EVENT(ON_END_EDIT, m_EdtBreakEvenPoints, OnEndEditEdtBreakEvenPoints) +if (ShowFusesOnTrading) +{ ON_EVENT(ON_END_EDIT, m_EdtMaxSlippage, OnEndEditEdtMaxSlippage) ON_EVENT(ON_END_EDIT, m_EdtMaxSpread, OnEndEditEdtMaxSpread) ON_EVENT(ON_END_EDIT, m_EdtMaxEntrySLDistance, OnEndEditEdtMaxEntrySLDistance) ON_EVENT(ON_END_EDIT, m_EdtMinEntrySLDistance, OnEndEditEdtMinEntrySLDistance) +ON_EVENT(ON_END_EDIT, m_EdtMaxRiskPercentage, OnEndEditEdtMaxRiskPercentage) +} +if (ShowMaxParametersOnTrading) +{ ON_EVENT(ON_END_EDIT, m_EdtMaxPositionSizeTotal, OnEndEditEdtMaxPositionSizeTotal) ON_EVENT(ON_END_EDIT, m_EdtMaxPositionSizePerSymbol, OnEndEditEdtMaxPositionSizePerSymbol) -ON_EVENT(ON_END_EDIT, m_EdtTrailingStopPoints, OnEndEditEdtTrailingStopPoints) -ON_EVENT(ON_END_EDIT, m_EdtBreakEvenPoints, OnEndEditEdtBreakEvenPoints) ON_EVENT(ON_END_EDIT, m_EdtMaxNumberOfTradesTotal, OnEndEditEdtMaxNumberOfTradesTotal) ON_EVENT(ON_END_EDIT, m_EdtMaxNumberOfTradesPerSymbol, OnEndEditEdtMaxNumberOfTradesPerSymbol) ON_EVENT(ON_END_EDIT, m_EdtMaxRiskTotal, OnEndEditEdtMaxRiskTotal) ON_EVENT(ON_END_EDIT, m_EdtMaxRiskPerSymbol, OnEndEditEdtMaxRiskPerSymbol) +} ON_EVENT(ON_END_EDIT, m_EdtExpiry, OnEndEditEdtExpiry) ON_EVENT(ON_CHANGE, m_ChkSubtractPositions, OnChangeChkSubtractPositions) ON_EVENT(ON_CHANGE, m_ChkSubtractPendingOrders, OnChangeChkSubtractPendingOrders) @@ -271,6 +293,7 @@ CPositionSizeCalculator::~CPositionSizeCalculator(void) delete MarginTabList; delete SwapsTabList; delete TradingTabList; + delete PersistentList; } // Updates filename used for settings storage. @@ -289,6 +312,8 @@ void CPositionSizeCalculator::InitVariables() remember_left = -1; remember_top = -1; MaxTakeProfitsNumber = 1; + OutsideCloseButtonsCorner = CORNER_RIGHT_LOWER; + MinMaxButtonId = -1; } //+--------+ @@ -307,7 +332,6 @@ bool CPositionSizeCalculator::ButtonCreate(CList *list, CButton &Btn, int X1, in obj.Obj = GetPointer(Btn); list.Add(obj); } - return true; } @@ -414,6 +438,7 @@ bool CPositionSizeCalculator::CreateObjects() int atr_period_label_width = (int)MathRound(72 * m_DPIScale); int atr_period_edit_width = (int)MathRound(36 * m_DPIScale); int quick_risk_button_width = (int)MathRound(32 * m_DPIScale); + int ignore_symbols_button_width = (int)MathRound(95 * m_DPIScale); first_column_start = (int)MathRound(10 * m_DPIScale); second_column_start = first_column_start + (int)MathRound(123 * m_DPIScale); @@ -439,15 +464,16 @@ bool CPositionSizeCalculator::CreateObjects() // Tabs - if (!ButtonCreate(NULL, m_BtnTabMain, tab_button_start, y, tab_button_start + tab_button_width, y + element_height, "m_BtnTabMain", "Main")) return false; + PersistentList = new CPanelList; + if (!ButtonCreate(PersistentList, m_BtnTabMain, tab_button_start, y, tab_button_start + tab_button_width, y + element_height, "m_BtnTabMain", TRANSLATION_TAB_BUTTON_MAIN)) return false; MainTabList = new CPanelList; - if (!ButtonCreate(NULL, m_BtnTabRisk, tab_button_start + tab_button_width + tab_button_spacing, y, tab_button_start + tab_button_width * 2 + tab_button_spacing, y + element_height, "m_BtnTabRisk", "Risk")) return false; + if (!ButtonCreate(PersistentList, m_BtnTabRisk, tab_button_start + tab_button_width + tab_button_spacing, y, tab_button_start + tab_button_width * 2 + tab_button_spacing, y + element_height, "m_BtnTabRisk", TRANSLATION_TAB_BUTTON_RISK)) return false; RiskTabList = new CPanelList; - if (!ButtonCreate(NULL, m_BtnTabMargin, tab_button_start + tab_button_width * 2 + tab_button_spacing * 2, y, tab_button_start + tab_button_width * 3 + tab_button_spacing * 2, y + element_height, "m_BtnTabMargin", "Margin")) return false; + if (!ButtonCreate(PersistentList, m_BtnTabMargin, tab_button_start + tab_button_width * 2 + tab_button_spacing * 2, y, tab_button_start + tab_button_width * 3 + tab_button_spacing * 2, y + element_height, "m_BtnTabMargin", TRANSLATION_TAB_BUTTON_MARGIN)) return false; MarginTabList = new CPanelList; - if (!ButtonCreate(NULL, m_BtnTabSwaps, tab_button_start + tab_button_width * 3 + tab_button_spacing * 3, y, tab_button_start + tab_button_width * 4 + tab_button_spacing * 3, y + element_height, "m_BtnTabSwaps", "Swaps")) return false; + if (!ButtonCreate(PersistentList, m_BtnTabSwaps, tab_button_start + tab_button_width * 3 + tab_button_spacing * 3, y, tab_button_start + tab_button_width * 4 + tab_button_spacing * 3, y + element_height, "m_BtnTabSwaps", TRANSLATION_TAB_BUTTON_SWAPS)) return false; SwapsTabList = new CPanelList; - if (!ButtonCreate(NULL, m_BtnTabTrading, tab_button_start + tab_button_width * 4 + tab_button_spacing * 4, y, tab_button_start + tab_button_width * 5 + tab_button_spacing * 4, y + element_height, "m_BtnTabTrading", "Trading")) return false; + if (!ButtonCreate(PersistentList, m_BtnTabTrading, tab_button_start + tab_button_width * 4 + tab_button_spacing * 4, y, tab_button_start + tab_button_width * 5 + tab_button_spacing * 4, y + element_height, "m_BtnTabTrading", TRANSLATION_TAB_BUTTON_TRADING)) return false; TradingTabList = new CPanelList; // Main @@ -456,23 +482,23 @@ bool CPositionSizeCalculator::CreateObjects() if ((AdditionalTradeButtons == ADDITIONAL_TRADE_BUTTONS_MAIN) || (AdditionalTradeButtons == ADDITIONAL_TRADE_BUTTONS_BOTH)) { - if (!ButtonCreate(MainTabList, m_BtnMainTrade, first_column_start, y, first_column_start + narrowest_label_width, y + element_height, "m_BtnMainTrade", "Trade")) return false; + if (!ButtonCreate(MainTabList, m_BtnMainTrade, first_column_start, y, first_column_start + narrowest_label_width, y + element_height, "m_BtnMainTrade", TRANSLATION_BUTTON_TRADE)) return false; } else { - if (!LabelCreate(MainTabList, m_LblEntryLevel, first_column_start, y, first_column_start + narrowest_label_width, y + element_height, "m_LblEntryLevel", "Entry:")) return false; + if (!LabelCreate(MainTabList, m_LblEntryLevel, first_column_start, y, first_column_start + narrowest_label_width, y + element_height, "m_LblEntryLevel", TRANSLATION_LABEL_ENTRY + ":")) return false; } // Button to quickly switch between Long/Short trade planning. - if (!ButtonCreate(MainTabList, m_BtnEntry, first_column_start + narrowest_label_width + v_spacing, y, second_column_start - v_spacing, y + element_height, "m_BtnEntry", EnumToString(sets.TradeDirection), "Switch between Long and Short")) return false; + if (!ButtonCreate(MainTabList, m_BtnEntry, first_column_start + narrowest_label_width + v_spacing, y, second_column_start - v_spacing, y + element_height, "m_BtnEntry", EnumToString(sets.TradeDirection), TRANSLATION_TOOLTIP_BUTTON_LONG_SHORT)) return false; if (!EditCreate(MainTabList, m_EdtEntryLevel, second_column_start, y, second_column_start + normal_edit_width, y + element_height, "m_EdtEntryLevel", "")) return false; - if (!ButtonCreate(MainTabList, m_BtnEntryIncrease, second_column_start + normal_edit_width + 1, y, second_column_start + normal_edit_width + v_spacing * 4, y + element_height / 2, "m_BtnEntryIncrease", "+", "Increase Entry by 1 point")) return false; - if (!ButtonCreate(MainTabList, m_BtnEntryDecrease, second_column_start + normal_edit_width + 1, y + element_height / 2, second_column_start + normal_edit_width + v_spacing * 4, y + element_height, "m_BtnEntryDecrease", "-", "Decrease Entry by 1 point")) return false; + if (!ButtonCreate(MainTabList, m_BtnEntryIncrease, second_column_start + normal_edit_width + 1, y, second_column_start + normal_edit_width + v_spacing * 4, y + element_height / 2, "m_BtnEntryIncrease", "+", TRANSLATION_TOOLTIP_ENTRY_INCREASE)) return false; + if (!ButtonCreate(MainTabList, m_BtnEntryDecrease, second_column_start + normal_edit_width + 1, y + element_height / 2, second_column_start + normal_edit_width + v_spacing * 4, y + element_height, "m_BtnEntryDecrease", "-", TRANSLATION_TOOLTIP_ENTRY_DECREASE)) return false; if (!LabelCreate(MainTabList, m_LblEntryWarning, third_column_start, y, third_column_start + narrow_label_width, y + element_height, "m_LblEntryWarning", "")) return false; y += element_height + v_spacing; - string stoploss_label_text = "Stop-loss: "; - if (sets.SLDistanceInPoints) stoploss_label_text = "SL, points: "; + string stoploss_label_text = TRANSLATION_LABEL_STOPLOSS + ":"; + if (sets.SLDistanceInPoints) stoploss_label_text = TRANSLATION_BUTTON_SL + ":"; if (DefaultSL > 0) // Use button to quickly set SL. { @@ -481,19 +507,19 @@ bool CPositionSizeCalculator::CreateObjects() else if (!LabelCreate(MainTabList, m_LblSL, first_column_start, y, first_column_start + normal_label_width, y + element_height, "m_LblSL", stoploss_label_text)) return false; if (!EditCreate(MainTabList, m_EdtSL, second_column_start, y, second_column_start + normal_edit_width, y + element_height, "m_EdtSL", "")) return false; - if (!ButtonCreate(MainTabList, m_BtnStopLossIncrease, second_column_start + normal_edit_width + 1, y, second_column_start + normal_edit_width + v_spacing * 4, y + element_height / 2, "m_BtnStopLossIncrease", "+", "Increase Stop-loss by 1 point")) return false; - if (!ButtonCreate(MainTabList, m_BtnStopLossDecrease, second_column_start + normal_edit_width + 1, y + element_height / 2, second_column_start + normal_edit_width + v_spacing * 4, y + element_height, "m_BtnStopLossDecrease", "-", "Decrease Stop-loss by 1 point")) return false; + if (!ButtonCreate(MainTabList, m_BtnStopLossIncrease, second_column_start + normal_edit_width + 1, y, second_column_start + normal_edit_width + v_spacing * 4, y + element_height / 2, "m_BtnStopLossIncrease", "+", TRANSLATION_TOOLTIP_STOPLOSS_INCREASE)) return false; + if (!ButtonCreate(MainTabList, m_BtnStopLossDecrease, second_column_start + normal_edit_width + 1, y + element_height / 2, second_column_start + normal_edit_width + v_spacing * 4, y + element_height, "m_BtnStopLossDecrease", "-", TRANSLATION_TOOLTIP_STOPLOSS_DECREASE)) return false; if (!LabelCreate(MainTabList, m_LblSLWarning, third_column_start, y, third_column_start + narrow_label_width, y + element_height, "m_LblSLWarning", "")) return false; y += element_height + v_spacing; - string takeprofit_label_text = "Take-profit: "; - if (sets.TPDistanceInPoints) takeprofit_label_text = "TP, points: "; - if (!ButtonCreate(MainTabList, m_BtnTakeProfitsNumberAdd, first_column_start, y, first_column_start + v_spacing * 4 - 1, y + element_height, "m_BtnTakeProfitsNumberAdd", "+", "Add a take-profit level")) return false; - if (!ButtonCreate(MainTabList, m_BtnTakeProfit, first_column_start + v_spacing * 4, y, first_column_start + v_spacing * 3 + normal_label_width, y + element_height, "m_BtnTakeProfit", takeprofit_label_text, "Set TP based on SL or enable locked TP mode")) return false; + string takeprofit_label_text = TRANSLATION_LABEL_TAKEPROFIT + ":"; + if (sets.TPDistanceInPoints) takeprofit_label_text = TRANSLATION_BUTTON_TP + ":"; + if (!ButtonCreate(MainTabList, m_BtnTakeProfitsNumberAdd, first_column_start, y, first_column_start + v_spacing * 4 - 1, y + element_height, "m_BtnTakeProfitsNumberAdd", "+", TRANSLATION_TOOLTIP_TAKEPROFIT_ADD)) return false; + if (!ButtonCreate(MainTabList, m_BtnTakeProfit, first_column_start + v_spacing * 4, y, first_column_start + v_spacing * 3 + normal_label_width, y + element_height, "m_BtnTakeProfit", takeprofit_label_text, TRANSLATION_TOOLTIP_BUTTON_TP)) return false; if (!EditCreate(MainTabList, m_EdtTP, second_column_start, y, second_column_start + normal_edit_width, y + element_height, "m_EdtTP", "")) return false; - if (!ButtonCreate(MainTabList, m_BtnTakeProfitIncrease, second_column_start + normal_edit_width + 1, y, second_column_start + normal_edit_width + v_spacing * 4, y + element_height / 2, "m_BtnTakeProfitIncrease", "+", "Increase Take-profit by 1 point")) return false; - if (!ButtonCreate(MainTabList, m_BtnTakeProfitDecrease, second_column_start + normal_edit_width + 1, y + element_height / 2, second_column_start + normal_edit_width + v_spacing * 4, y + element_height, "m_BtnTakeProfitDecrease", "-", "Decrease Take-profit by 1 point")) return false; + if (!ButtonCreate(MainTabList, m_BtnTakeProfitIncrease, second_column_start + normal_edit_width + 1, y, second_column_start + normal_edit_width + v_spacing * 4, y + element_height / 2, "m_BtnTakeProfitIncrease", "+", TRANSLATION_TOOLTIP_TAKEPROFIT_INCREASE)) return false; + if (!ButtonCreate(MainTabList, m_BtnTakeProfitDecrease, second_column_start + normal_edit_width + 1, y + element_height / 2, second_column_start + normal_edit_width + v_spacing * 4, y + element_height, "m_BtnTakeProfitDecrease", "-", TRANSLATION_TOOLTIP_TAKEPROFIT_DECREASE)) return false; if (!LabelCreate(MainTabList, m_LblTPWarning, third_column_start, y, third_column_start + narrow_label_width, y + element_height, "m_LblTPWarning", "")) return false; // Multiple TP levels for the Main tab. @@ -508,12 +534,12 @@ bool CPositionSizeCalculator::CreateObjects() ArrayResize(AdditionalWarningTP, sets.TakeProfitsNumber - 1); // String array. ArrayResize(AdditionalOutputRR, sets.TakeProfitsNumber - 1); // String array. ArrayResize(AdditionalOutputReward, sets.TakeProfitsNumber - 1); // Double array. - string additional_tp_label_beginning = "Take-profit "; + string additional_tp_label_beginning = TRANSLATION_LABEL_TAKEPROFIT + " "; string additional_tp_label_end = ":"; if (sets.TPDistanceInPoints) { - additional_tp_label_beginning = "TP "; - additional_tp_label_end = ", points:"; + additional_tp_label_beginning = TRANSLATION_LABEL_TAKEPROFIT_MULTIPLE_DISTANCE + " "; + additional_tp_label_end = ", " + TRANSLATION_LABEL_TAKEPROFIT_MULTIPLE_POINTS + ":"; } for (int i = 0; i < sets.TakeProfitsNumber - 1; i++) { @@ -521,12 +547,12 @@ bool CPositionSizeCalculator::CreateObjects() if (i == sets.TakeProfitsNumber - 2) // The last iteration. { // Because only one Remove button is needed. - if (!ButtonCreate(MainTabList, m_BtnTakeProfitsNumberRemove, first_column_start, y, first_column_start + v_spacing * 4 - 1, y + element_height, "m_BtnTakeProfitsNumberRemove", "x", "Remove Take-profit")) return false; + if (!ButtonCreate(MainTabList, m_BtnTakeProfitsNumberRemove, first_column_start, y, first_column_start + v_spacing * 4 - 1, y + element_height, "m_BtnTakeProfitsNumberRemove", "x", TRANSLATION_TOOLTIP_TAKEPROFIT_REMOVE)) return false; } if (!LabelCreate(MainTabList, AdditionalTPLabels[i], first_column_start + v_spacing * 4, y, first_column_start + normal_label_width, y + element_height, "m_LblAdditionalTPLabels" + IntegerToString(i + 2), additional_tp_label_beginning + IntegerToString(i + 2) + additional_tp_label_end)) return false; if (!EditCreate(MainTabList, AdditionalTPEdits[i], second_column_start, y, second_column_start + normal_edit_width, y + element_height, "m_EdtAdditionalTPEdits" + IntegerToString(i + 2), "")) return false; - if (!ButtonCreate(MainTabList, AdditionalTPButtonsIncrease[i], second_column_start + normal_edit_width + 1, y, second_column_start + normal_edit_width + v_spacing * 4, y + element_height / 2, "m_BtnAdditionalTPButtonsIncrease" + IntegerToString(i + 2), "+", "Increase Take-profit #" + IntegerToString(i + 2) + " by 1 point")) return false; - if (!ButtonCreate(MainTabList, AdditionalTPButtonsDecrease[i], second_column_start + normal_edit_width + 1, y + element_height / 2, second_column_start + normal_edit_width + v_spacing * 4, y + element_height, "m_BtnAdditionalTPButtonsDecrease" + IntegerToString(i + 2), "-", "Decrease Take-profit #" + IntegerToString(i + 2) + " by 1 point")) return false; + if (!ButtonCreate(MainTabList, AdditionalTPButtonsIncrease[i], second_column_start + normal_edit_width + 1, y, second_column_start + normal_edit_width + v_spacing * 4, y + element_height / 2, "m_BtnAdditionalTPButtonsIncrease" + IntegerToString(i + 2), "+", TRANSLATION_TOOLTIP_TAKEPROFIT_INCREASE_MULTIPLE + " #" + IntegerToString(i + 2) + " " + TRANSLATION_TOOLTIP_TAKEPROFIT_BY_ONE_POINT)) return false; + if (!ButtonCreate(MainTabList, AdditionalTPButtonsDecrease[i], second_column_start + normal_edit_width + 1, y + element_height / 2, second_column_start + normal_edit_width + v_spacing * 4, y + element_height, "m_BtnAdditionalTPButtonsDecrease" + IntegerToString(i + 2), "-", TRANSLATION_TOOLTIP_TAKEPROFIT_INCREASE_MULTIPLE + " #" + IntegerToString(i + 2) + " " + TRANSLATION_TOOLTIP_TAKEPROFIT_BY_ONE_POINT)) return false; if (!LabelCreate(MainTabList, AdditionalTPWarnings[i], third_column_start, y, third_column_start + narrow_label_width, y + element_height, "m_LblAdditionalTPWarnings" + IntegerToString(i + 2), " ")) return false; } } @@ -535,67 +561,67 @@ bool CPositionSizeCalculator::CreateObjects() { y += element_height + v_spacing; - if (!LabelCreate(MainTabList, m_LblATRPeriod, first_column_start, y, first_column_start + atr_period_label_width, y + element_height, "m_LblATRPeriod", "ATR period:")) return false; + if (!LabelCreate(MainTabList, m_LblATRPeriod, first_column_start, y, first_column_start + atr_period_label_width, y + element_height, "m_LblATRPeriod", TRANSLATION_LABEL_ATR_PERIOD)) return false; if (!EditCreate(MainTabList, m_EdtATRPeriod, first_column_start + atr_period_label_width, y, first_column_start + atr_period_label_width + atr_period_edit_width, y + element_height, "m_EdtATRPeriod", "")) return false; - if (!LabelCreate(MainTabList, m_LblATRMultiplierSL, second_column_start, y, second_column_start + normal_edit_width, y + element_height, "m_LblATRMultiplierSL", "SL multiplier:")) return false; + if (!LabelCreate(MainTabList, m_LblATRMultiplierSL, second_column_start, y, second_column_start + normal_edit_width, y + element_height, "m_LblATRMultiplierSL", TRANSLATION_LABEL_ATR_SL_MULTIPLIER + ":")) return false; if (!EditCreate(MainTabList, m_EdtATRMultiplierSL, third_column_start, y, third_column_start + normal_edit_width / 2, y + element_height, "m_EdtATRMultiplierSL", "")) return false; - if (!CheckBoxCreate(MainTabList, m_ChkSpreadAdjustmentSL, third_column_start + normal_edit_width / 2 + v_spacing, y, third_column_start + normal_edit_width + v_spacing, y + element_height, "m_ChkSpreadAdjustmentSL", "SA", "Apply spread adjustment to stop-loss")) return false; + if (!CheckBoxCreate(MainTabList, m_ChkSpreadAdjustmentSL, third_column_start + normal_edit_width / 2 + v_spacing, y, third_column_start + normal_edit_width + v_spacing, y + element_height, "m_ChkSpreadAdjustmentSL", TRANSLATION_CHECKBOX_ATR_SA, TRANSLATION_TOOLTIP_ATR_SA_SL)) return false; y += element_height + v_spacing; - if (!LabelCreate(MainTabList, m_LblATRValue, first_column_start, y, first_column_start + normal_label_width, y + element_height, "m_LblATRValue", "ATR = ")) return false; + if (!LabelCreate(MainTabList, m_LblATRValue, first_column_start, y, first_column_start + normal_label_width, y + element_height, "m_LblATRValue", TRANSLATION_LABEL_ATR_VALUE + " = ")) return false; - if (!LabelCreate(MainTabList, m_LblATRMultiplierTP, second_column_start, y, second_column_start + normal_edit_width, y + element_height, "m_LblATRMultiplierTP", "TP multiplier:")) return false; + if (!LabelCreate(MainTabList, m_LblATRMultiplierTP, second_column_start, y, second_column_start + normal_edit_width, y + element_height, "m_LblATRMultiplierTP", TRANSLATION_LABEL_ATR_TP_MULTIPLIER + ":")) return false; if (!EditCreate(MainTabList, m_EdtATRMultiplierTP, third_column_start, y, third_column_start + normal_edit_width / 2, y + element_height, "m_EdtATRMultiplierTP", "")) return false; - if (!CheckBoxCreate(MainTabList, m_ChkSpreadAdjustmentTP, third_column_start + normal_edit_width / 2 + v_spacing, y, third_column_start + normal_edit_width + v_spacing, y + element_height, "m_ChkSpreadAdjustmentTP", "SA", "Apply spread adjustment to take-profit")) return false; + if (!CheckBoxCreate(MainTabList, m_ChkSpreadAdjustmentTP, third_column_start + normal_edit_width / 2 + v_spacing, y, third_column_start + normal_edit_width + v_spacing, y + element_height, "m_ChkSpreadAdjustmentTP", TRANSLATION_CHECKBOX_ATR_SA, TRANSLATION_TOOLTIP_ATR_SA_TP)) return false; y += element_height + v_spacing; - if (!LabelCreate(MainTabList, m_LblATRTimeframe, first_column_start, y, first_column_start + normal_label_width, y + element_height, "m_LblATRTimeframe", "ATR timeframe:")) return false; + if (!LabelCreate(MainTabList, m_LblATRTimeframe, first_column_start, y, first_column_start + normal_label_width, y + element_height, "m_LblATRTimeframe", TRANSLATION_LABEL_ATR_TIMEFRAME + ":")) return false; if (!ButtonCreate(MainTabList, m_BtnATRTimeframe, second_column_start, y, second_column_start + normal_edit_width, y + element_height, "m_BtnATRTimeframe", EnumToString((ENUM_TIMEFRAMES)_Period))) return false; } y += element_height + v_spacing; - if (!LabelCreate(MainTabList, m_LblOrderType, first_column_start, y, first_column_start + normal_label_width, y + element_height, "m_LblOrderType", "Order type:")) return false; - if (!ButtonCreate(MainTabList, m_BtnOrderType, second_column_start, y, second_column_start + normal_edit_width, y + element_height, "m_BtnOrderType", "Instant", "Switch between Instant and Pending")) return false; + if (!LabelCreate(MainTabList, m_LblOrderType, first_column_start, y, first_column_start + normal_label_width, y + element_height, "m_LblOrderType", TRANSLATION_LABEL_ORDER_TYPE + ":")) return false; + if (!ButtonCreate(MainTabList, m_BtnOrderType, second_column_start, y, second_column_start + normal_edit_width, y + element_height, "m_BtnOrderType", TRANSLATION_BUTTON_ORDER_TYPE_INSTANT, TRANSLATION_TOOLTIP_ORDER_TYPE)) return false; - if (!ButtonCreate(MainTabList, m_BtnLines, third_column_start, y, third_column_start + normal_edit_width, y + element_height, "m_BtnLines", "Hide lines")) return false; + if (!ButtonCreate(MainTabList, m_BtnLines, third_column_start, y, third_column_start + normal_edit_width, y + element_height, "m_BtnLines", TRANSLATION_BUTTON_HIDE_LINES)) return false; y += element_height + v_spacing; - if (!LabelCreate(MainTabList, m_LblCommissionSize, first_column_start, y, second_column_start + risk_perc_edit_width, y + element_height, "m_LblCommissionSize", "Commission (one-way) per lot:", "In account currency or %, per 1 standard lot")) return false; - if (!ButtonCreate(MainTabList, m_BtnCommissionType, second_column_start + risk_perc_edit_width, y, third_column_start - v_spacing, y + element_height, "m_BtnCommissionType", "???", "Click to switch")) return false; + if (!LabelCreate(MainTabList, m_LblCommissionSize, first_column_start, y, second_column_start + risk_perc_edit_width, y + element_height, "m_LblCommissionSize", TRANSLATION_LABEL_COMMISSION + ":", TRANSLATION_TOOLTIP_COMMISSION)) return false; + if (!ButtonCreate(MainTabList, m_BtnCommissionType, second_column_start + risk_perc_edit_width, y, third_column_start - v_spacing, y + element_height, "m_BtnCommissionType", "???", TRANSLATION_TOOLTIP_COMMISSION_TYPE)) return false; if (!EditCreate(MainTabList, m_EdtCommissionSize, third_column_start, y, third_column_start + normal_edit_width, y + element_height, "m_EdtCommissionSize", "")) return false; y += element_height + v_spacing; if (!HideAccSize) { - if (!ButtonCreate(MainTabList, m_BtnAccount, first_column_start, y, first_column_start + normal_label_width, y + element_height, "m_BtnAccount", "Account balance", "Switch between balance, equity, and balance minus current portfolio risk")) return false; + if (!ButtonCreate(MainTabList, m_BtnAccount, first_column_start, y, first_column_start + normal_label_width, y + element_height, "m_BtnAccount", TRANSLATION_BUTTON_ACCOUNT_BALANCE, TRANSLATION_TOOLTIP_ACCOUNT_SIZE)) return false; if (!EditCreate(MainTabList, m_EdtAccount, second_column_start, y, third_column_start + normal_edit_width, y + element_height, "m_EdtAccount", "")) return false; string tooltip = ""; - if (CustomBalance > 0) tooltip = "Custom balance set"; - else if (AdditionalFunds > 0) tooltip = "+" + DoubleToString(AdditionalFunds, 2) + " additional funds"; - else if (AdditionalFunds < 0) tooltip = DoubleToString(-AdditionalFunds, 2) + " funds subtracted"; + if (CustomBalance > 0) tooltip = TRANSLATION_TOOLTIP_ACCOUNT_SIZE_ASTERISK_CUSTOM; + else if (AdditionalFunds > 0) tooltip = "+" + DoubleToString(AdditionalFunds, 2) + " " + TRANSLATION_TOOLTIP_ACCOUNT_SIZE_ASTERISK_ADD; + else if (AdditionalFunds < 0) tooltip = DoubleToString(-AdditionalFunds, 2) + " " + TRANSLATION_TOOLTIP_ACCOUNT_SIZE_ASTERISK_SUB; if (!LabelCreate(MainTabList, m_LblAdditionalFundsAsterisk, third_column_start + normal_edit_width + v_spacing, y, third_column_start + normal_edit_width + v_spacing * 2, y + element_height, "m_LblAdditionalFundsAsterisk", "*", tooltip)) return false; y += element_height + v_spacing; } - if (!LabelCreate(MainTabList, m_LblInput, second_column_start, y, second_column_start + normal_edit_width, y + element_height, "m_LblInput", "Input", "Fields in this column are calculated based on inputs")) return false; - if (!LabelCreate(MainTabList, m_LblResult, third_column_start, y, third_column_start + normal_edit_width, y + element_height, "m_LblResult", "Result", "Fields in this column take into account broker's limitations")) return false; + if (!LabelCreate(MainTabList, m_LblInput, second_column_start, y, second_column_start + normal_edit_width, y + element_height, "m_LblInput", TRANSLATION_LABEL_INPUT, TRANSLATION_TOOLTIP_INPUTS)) return false; + if (!LabelCreate(MainTabList, m_LblResult, third_column_start, y, third_column_start + normal_edit_width, y + element_height, "m_LblResult", TRANSLATION_LABEL_RESULT, TRANSLATION_TOOLTIP_RESULT)) return false; y += element_height + v_spacing; - if (!LabelCreate(MainTabList, m_LblRisk, first_column_start, y, first_column_start + tab_button_width - v_spacing, y + element_height, "m_LblRisk", "Risk, %:")) return false; + if (!LabelCreate(MainTabList, m_LblRisk, first_column_start, y, first_column_start + tab_button_width - v_spacing, y + element_height, "m_LblRisk", TRANSLATION_LABEL_RISK + ", %:")) return false; if (QuickRisk1 > 0) if (!ButtonCreate(MainTabList, m_BtnQuickRisk1, first_column_start + tab_button_width, y, first_column_start + tab_button_width + quick_risk_button_width, y + element_height, "m_BtnQuickRisk1", "", "%")) return false; @@ -608,7 +634,7 @@ bool CPositionSizeCalculator::CreateObjects() y += element_height + v_spacing; - if (!LabelCreate(MainTabList, m_LblRiskM, first_column_start, y, first_column_start + normal_label_width, y + element_height, "m_LblRiskM", "Risk, money:")) return false; + if (!LabelCreate(MainTabList, m_LblRiskM, first_column_start, y, first_column_start + normal_label_width, y + element_height, "m_LblRiskM", TRANSLATION_LABEL_RISK + ", " + TRANSLATION_LABEL_MONEY + ":")) return false; if (!EditCreate(MainTabList, m_EdtRiskMIn, second_column_start, y, second_column_start + normal_edit_width, y + element_height, "m_EdtRiskMIn", "")) return false; if (!EditCreate(MainTabList, m_EdtRiskMRes, third_column_start, y, third_column_start + normal_edit_width, y + element_height, "m_EdtRiskMRes", "")) return false; m_EdtRiskMRes.ReadOnly(true); @@ -616,7 +642,7 @@ bool CPositionSizeCalculator::CreateObjects() y += element_height + v_spacing; - if (!LabelCreate(MainTabList, m_LblReward, first_column_start, y, first_column_start + normal_label_width, y + element_height, "m_LblReward", "Reward, money:")) return false; + if (!LabelCreate(MainTabList, m_LblReward, first_column_start, y, first_column_start + normal_label_width, y + element_height, "m_LblReward", TRANSLATION_LABEL_REWARD + ", " + TRANSLATION_LABEL_MONEY + ":")) return false; if (!EditCreate(MainTabList, m_EdtReward1, second_column_start, y, second_column_start + normal_edit_width, y + element_height, "m_EdtReward1", "")) return false; m_EdtReward1.ReadOnly(true); m_EdtReward1.ColorBackground(CONTROLS_EDIT_COLOR_DISABLE); @@ -626,7 +652,7 @@ bool CPositionSizeCalculator::CreateObjects() y += element_height + v_spacing; - if (!LabelCreate(MainTabList, m_LblRR, first_column_start, y, first_column_start + normal_label_width, y + element_height, "m_LblRR", "Reward/risk:")) return false; + if (!LabelCreate(MainTabList, m_LblRR, first_column_start, y, first_column_start + normal_label_width, y + element_height, "m_LblRR", TRANSLATION_LABEL_REWARD_RISK + ":")) return false; if (!EditCreate(MainTabList, m_EdtRR1, second_column_start, y, second_column_start + normal_edit_width, y + element_height, "m_EdtRR1", "")) return false; if (!EditCreate(MainTabList, m_EdtRR2, third_column_start, y, third_column_start + normal_edit_width, y + element_height, "m_EdtRR2", "")) return false; m_EdtRR1.ReadOnly(true); @@ -636,15 +662,15 @@ bool CPositionSizeCalculator::CreateObjects() y += element_height + v_spacing; - if (!LabelCreate(MainTabList, m_LblPosSize, first_column_start, y, first_column_start + normal_label_width, y + element_height, "m_LblPosSize", "Position size:")) return false; - if (ShowMaxPSButton) if (!ButtonCreate(MainTabList, m_BtnMaxPS, second_column_start, y, second_column_start + normal_edit_width, y + element_height, "m_BtnMaxPS", "Max PS")) return false; - if (!EditCreate(MainTabList, m_EdtPosSize, third_column_start, y, third_column_start + normal_edit_width, y + element_height, "m_EdtPosSize", "", "In lots")) return false; + if (!LabelCreate(MainTabList, m_LblPosSize, first_column_start, y, first_column_start + normal_label_width, y + element_height, "m_LblPosSize", TRANSLATION_LABEL_POSITION_SIZE + ":")) return false; + if (ShowMaxPSButton) if (!ButtonCreate(MainTabList, m_BtnMaxPS, second_column_start, y, second_column_start + normal_edit_width, y + element_height, "m_BtnMaxPS", TRANSLATION_BUTTON_MAX_PS)) return false; + if (!EditCreate(MainTabList, m_EdtPosSize, third_column_start, y, third_column_start + normal_edit_width, y + element_height, "m_EdtPosSize", "", TRANSLATION_TOOLTIP_MAX_PS_BY_MARGIN)) return false; if (ShowPointValue) { y += element_height + v_spacing; - if (!LabelCreate(MainTabList, m_LblPointValue, first_column_start, y, first_column_start + normal_label_width, y + element_height, "m_LblPointValue", "Point value:", "")) return false; + if (!LabelCreate(MainTabList, m_LblPointValue, first_column_start, y, first_column_start + normal_label_width, y + element_height, "m_LblPointValue", TRANSLATION_LABEL_POINT_VALUE + ":", "")) return false; if (!EditCreate(MainTabList, m_EdtPointValue, third_column_start, y, third_column_start + normal_edit_width, y + element_height, "m_EdtPointValue", "")) return false; m_EdtPointValue.ReadOnly(true); m_EdtPointValue.ColorBackground(CONTROLS_EDIT_COLOR_DISABLE); @@ -662,29 +688,30 @@ bool CPositionSizeCalculator::CreateObjects() // Reset y = row_start + element_height + 3 * v_spacing; - if (!CheckBoxCreate(RiskTabList, m_ChkCountPendings, first_column_start, y, panel_end, y + element_height, "m_ChkCountPendings", "Count pending orders")) return false; + if (!CheckBoxCreate(RiskTabList, m_ChkCountPendings, first_column_start, y, panel_end, y + element_height, "m_ChkCountPendings", TRANSLATION_CHECKBOX_COUNT_PENDING_ORDERS)) return false; y += element_height + v_spacing; - if (!CheckBoxCreate(RiskTabList, m_ChkIgnoreOrdersWithoutSL, first_column_start, y, panel_end, y + element_height, "m_ChkIgnoreOrdersWithoutSL", "Ignore orders without stop-loss")) return false; + if (!CheckBoxCreate(RiskTabList, m_ChkIgnoreOrdersWithoutSL, first_column_start, y, panel_end, y + element_height, "m_ChkIgnoreOrdersWithoutSL", TRANSLATION_CHECKBOX_IGNORE_ORDERS_WO_SL)) return false; y += element_height + v_spacing; - if (!CheckBoxCreate(RiskTabList, m_ChkIgnoreOrdersWithoutTP, first_column_start, y, panel_end, y + element_height, "m_ChkIgnoreOrdersWithoutTP", "Ignore orders without take-profit")) return false; + if (!CheckBoxCreate(RiskTabList, m_ChkIgnoreOrdersWithoutTP, first_column_start, y, panel_end, y + element_height, "m_ChkIgnoreOrdersWithoutTP", TRANSLATION_CHECKBOX_IGNORE_ORDERS_WO_TP)) return false; y += element_height + v_spacing; - if (!CheckBoxCreate(RiskTabList, m_ChkIgnoreOtherSymbols, first_column_start, y, panel_end, y + element_height, "m_ChkIgnoreOtherSymbols", "Ignore orders in other symbols")) return false; + if (!LabelCreate(RiskTabList, m_LblIgnoreSymbols, first_column_start, y, first_column_start + ignore_symbols_button_width, y + element_height, "m_LblIgnoreSymbols", TRANSLATION_LABEL_IGNORE_TRADES_IN)) return false; + if (!ButtonCreate(RiskTabList, m_BtnIgnoreSymbols, first_column_start + ignore_symbols_button_width + v_spacing, y, second_column_start + narrow_edit_width, y + element_height, "m_BtnIgnoreSymbols", TRANSLATION_BUTTON_SYMBOLS_NO, TRANSLATION_BUTTON_SYMBOLS_TOOLTIP)) return false; y += element_height + v_spacing; - if (!LabelCreate(RiskTabList, m_LblCurrentRiskMoney, second_risk_column_start, y, second_risk_column_start + narrow_label_width, y + element_height, "m_LblCurrentRiskMoney", "Risk $")) return false; - if (!LabelCreate(RiskTabList, m_LblCurrentRiskPerc, third_risk_column_start, y, third_risk_column_start + narrowest_label_width, y + element_height, "m_LblCurrentRiskPerc", "Risk %")) return false; - if (!LabelCreate(RiskTabList, m_LblCurrentLots, fourth_risk_column_start, y, fourth_risk_column_start + narrowest_label_width, y + element_height, "m_LblCurrentLots", "Lots")) return false; + if (!LabelCreate(RiskTabList, m_LblCurrentRiskMoney, second_risk_column_start, y, second_risk_column_start + narrow_label_width, y + element_height, "m_LblCurrentRiskMoney", TRANSLATION_LABEL_RISK + " $")) return false; + if (!LabelCreate(RiskTabList, m_LblCurrentRiskPerc, third_risk_column_start, y, third_risk_column_start + narrowest_label_width, y + element_height, "m_LblCurrentRiskPerc", TRANSLATION_LABEL_RISK + " %")) return false; + if (!LabelCreate(RiskTabList, m_LblCurrentLots, fourth_risk_column_start, y, fourth_risk_column_start + narrowest_label_width, y + element_height, "m_LblCurrentLots", TRANSLATION_LABEL_LOTS)) return false; y += element_height + v_spacing; - if (!LabelCreate(RiskTabList, m_LblCurrentPortfolio, first_column_start, y, second_risk_column_start, y + element_height, "m_LblCurrentPortfolio", "Current portfolio:", "Trades that are currently open")) return false; + if (!LabelCreate(RiskTabList, m_LblCurrentPortfolio, first_column_start, y, second_risk_column_start, y + element_height, "m_LblCurrentPortfolio", TRANSLATION_LABEL_CURRENT_PORTFOLIO + ":", TRANSLATION_TOOLTIP_CURRENT_PORTFOLIO)) return false; if (!EditCreate(RiskTabList, m_EdtCurRiskM, second_risk_column_start, y, second_risk_column_start + normal_edit_width, y + element_height, "m_EdtCurRiskM", "")) return false; m_EdtCurRiskM.ReadOnly(true); m_EdtCurRiskM.ColorBackground(CONTROLS_EDIT_COLOR_DISABLE); @@ -697,9 +724,9 @@ bool CPositionSizeCalculator::CreateObjects() y += element_height + v_spacing; - if (!LabelCreate(RiskTabList, m_LblCurrentProfitMoney, second_risk_column_start, y, second_risk_column_start + narrow_label_width, y + element_height, "m_LblCurrentProfitMoney", "Reward $")) return false; - if (!LabelCreate(RiskTabList, m_LblCurrentProfitPerc, third_risk_column_start, y, third_risk_column_start + narrowest_label_width, y + element_height, "m_LblCurrentProfitPerc", "Reward %")) return false; - if (!LabelCreate(RiskTabList, m_LblCurrentRRR, fourth_risk_column_start, y, fourth_risk_column_start + narrowest_label_width, y + element_height, "m_LblCurrentRRR", "RRR", "Risk-to-reward ratio of the current portfolio")) return false; + if (!LabelCreate(RiskTabList, m_LblCurrentProfitMoney, second_risk_column_start, y, second_risk_column_start + narrow_label_width, y + element_height, "m_LblCurrentProfitMoney", TRANSLATION_LABEL_REWARD + " $")) return false; + if (!LabelCreate(RiskTabList, m_LblCurrentProfitPerc, third_risk_column_start, y, third_risk_column_start + narrowest_label_width, y + element_height, "m_LblCurrentProfitPerc", TRANSLATION_LABEL_REWARD + " %")) return false; + if (!LabelCreate(RiskTabList, m_LblCurrentRRR, fourth_risk_column_start, y, fourth_risk_column_start + narrowest_label_width, y + element_height, "m_LblCurrentRRR", "RRR", TRANSLATION_LABEL_CRRR_TOOLTIP)) return false; y += element_height + v_spacing; @@ -715,13 +742,13 @@ bool CPositionSizeCalculator::CreateObjects() y += element_height + v_spacing; - if (!LabelCreate(RiskTabList, m_LblPotentialRiskMoney, second_risk_column_start, y, second_risk_column_start + narrow_label_width, y + element_height, "m_LblPotentialRiskMoney", "Risk $")) return false; - if (!LabelCreate(RiskTabList, m_LblPotentialRiskPerc, third_risk_column_start, y, third_risk_column_start + narrowest_label_width, y + element_height, "m_LblPotentialRiskPerc", "Risk %")) return false; - if (!LabelCreate(RiskTabList, m_LblPotentialLots, fourth_risk_column_start, y, fourth_risk_column_start + narrowest_label_width, y + element_height, "m_LblPotentialLots", "Lots")) return false; + if (!LabelCreate(RiskTabList, m_LblPotentialRiskMoney, second_risk_column_start, y, second_risk_column_start + narrow_label_width, y + element_height, "m_LblPotentialRiskMoney", TRANSLATION_LABEL_RISK + " $")) return false; + if (!LabelCreate(RiskTabList, m_LblPotentialRiskPerc, third_risk_column_start, y, third_risk_column_start + narrowest_label_width, y + element_height, "m_LblPotentialRiskPerc", TRANSLATION_LABEL_RISK + " %")) return false; + if (!LabelCreate(RiskTabList, m_LblPotentialLots, fourth_risk_column_start, y, fourth_risk_column_start + narrowest_label_width, y + element_height, "m_LblPotentialLots", TRANSLATION_LABEL_LOTS)) return false; y += element_height + v_spacing; - if (!LabelCreate(RiskTabList, m_LblPotentialPortfolio, first_column_start, y, second_risk_column_start, y + element_height, "m_LblPotentialPortfolio", "Potential portfolio:", "Including the position being calculated")) return false; + if (!LabelCreate(RiskTabList, m_LblPotentialPortfolio, first_column_start, y, second_risk_column_start, y + element_height, "m_LblPotentialPortfolio", TRANSLATION_LABEL_POTENTIAL_PORTFOLIO + ":", TRANSLATION_TOOLTIP_POTENTIAL_PORTFOLIO)) return false; if (!EditCreate(RiskTabList, m_EdtPotRiskM, second_risk_column_start, y, second_risk_column_start + normal_edit_width, y + element_height, "m_EdtPotRiskM", "")) return false; m_EdtPotRiskM.ReadOnly(true); m_EdtPotRiskM.ColorBackground(CONTROLS_EDIT_COLOR_DISABLE); @@ -734,9 +761,9 @@ bool CPositionSizeCalculator::CreateObjects() y += element_height + v_spacing; - if (!LabelCreate(RiskTabList, m_LblPotentialProfitMoney, second_risk_column_start, y, second_risk_column_start + narrow_edit_width, y + element_height, "m_LblPotentialProfitMoney", "Reward $")) return false; - if (!LabelCreate(RiskTabList, m_LblPotentialProfitPerc, third_risk_column_start, y, third_risk_column_start + narrowest_label_width, y + element_height, "m_LblPotentialProfitPerc", "Reward %")) return false; - if (!LabelCreate(RiskTabList, m_LblPotentialRRR, fourth_risk_column_start, y, fourth_risk_column_start + narrowest_label_width, y + element_height, "m_LblPotentialRRR", "RRR", "Risk-to-reward ratio of the potential portfolio")) return false; + if (!LabelCreate(RiskTabList, m_LblPotentialProfitMoney, second_risk_column_start, y, second_risk_column_start + narrow_edit_width, y + element_height, "m_LblPotentialProfitMoney", TRANSLATION_LABEL_REWARD + " $")) return false; + if (!LabelCreate(RiskTabList, m_LblPotentialProfitPerc, third_risk_column_start, y, third_risk_column_start + narrowest_label_width, y + element_height, "m_LblPotentialProfitPerc", TRANSLATION_LABEL_REWARD + " %")) return false; + if (!LabelCreate(RiskTabList, m_LblPotentialRRR, fourth_risk_column_start, y, fourth_risk_column_start + narrowest_label_width, y + element_height, "m_LblPotentialRRR", "RRR", TRANSLATION_LABEL_PRRR_TOOLTIP)) return false; y += element_height + v_spacing; @@ -755,39 +782,39 @@ bool CPositionSizeCalculator::CreateObjects() // Reset y = row_start + element_height + 3 * v_spacing; - if (!LabelCreate(MarginTabList, m_LblPosMargin, first_column_start, y, first_column_start + normal_label_width, y + element_height, "m_LblPosMargin", "Position margin:")) return false; + if (!LabelCreate(MarginTabList, m_LblPosMargin, first_column_start, y, first_column_start + normal_label_width, y + element_height, "m_LblPosMargin", TRANSLATION_LABEL_POSITION_MARGIN + ":")) return false; if (!EditCreate(MarginTabList, m_EdtPosMargin, second_margin_column_start, y, second_margin_column_start + wide_edit_width, y + element_height, "m_EdtPosMargin", "")) return false; m_EdtPosMargin.ReadOnly(true); m_EdtPosMargin.ColorBackground(CONTROLS_EDIT_COLOR_DISABLE); y += element_height + v_spacing; - if (!LabelCreate(MarginTabList, m_LblUsedMargin, first_column_start, y, first_column_start + normal_label_width, y + element_height, "m_LblUsedMargin", "Future used margin:")) return false; + if (!LabelCreate(MarginTabList, m_LblUsedMargin, first_column_start, y, first_column_start + normal_label_width, y + element_height, "m_LblUsedMargin", TRANSLATION_LABEL_FUTURE_USED_MARGIN + ":")) return false; if (!EditCreate(MarginTabList, m_EdtUsedMargin, second_margin_column_start, y, second_margin_column_start + wide_edit_width, y + element_height, "m_EdtUsedMargin", " ")) return false; m_EdtUsedMargin.ReadOnly(true); m_EdtUsedMargin.ColorBackground(CONTROLS_EDIT_COLOR_DISABLE); y += element_height + v_spacing; - if (!LabelCreate(MarginTabList, m_LblFreeMargin, first_column_start, y, first_column_start + normal_label_width, y + element_height, "m_LblFreeMargin", "Future free margin:")) return false; + if (!LabelCreate(MarginTabList, m_LblFreeMargin, first_column_start, y, first_column_start + normal_label_width, y + element_height, "m_LblFreeMargin", TRANSLATION_LABEL_FUTURE_FREE_MARGIN + ":")) return false; if (!EditCreate(MarginTabList, m_EdtFreeMargin, second_margin_column_start, y, second_margin_column_start + wide_edit_width, y + element_height, "m_EdtFreeMargin", "")) return false; m_EdtFreeMargin.ReadOnly(true); m_EdtFreeMargin.ColorBackground(CONTROLS_EDIT_COLOR_DISABLE); y += element_height + v_spacing; - if (!LabelCreate(MarginTabList, m_LblCustomLeverage, first_column_start, y, first_column_start + normal_label_width, y + element_height, "m_LblCustomLeverage", "Custom leverage = 1:")) return false; + if (!LabelCreate(MarginTabList, m_LblCustomLeverage, first_column_start, y, first_column_start + normal_label_width, y + element_height, "m_LblCustomLeverage", TRANSLATION_LABEL_CUSTOM_LEVERAGE + " = 1:")) return false; if (!EditCreate(MarginTabList, m_EdtCustomLeverage, second_margin_column_start - (int)MathRound(10 * m_DPIScale), y, second_margin_column_start + leverage_edit_width, y + element_height, "m_EdtCustomLeverage", "")) return false; if (!LabelCreate(MarginTabList, m_LblAccLeverage, second_margin_column_start + leverage_edit_width + (int)MathRound(5 * m_DPIScale), y, second_margin_column_start + leverage_edit_width + (int)MathRound(5 * m_DPIScale) + wide_edit_width, y + element_height, "m_LblAccLeverage", "")) return false; y += element_height + v_spacing; - if (!LabelCreate(MarginTabList, m_LblSymbolLeverage, second_margin_column_start + leverage_edit_width + (int)MathRound(5 * m_DPIScale), y, second_margin_column_start + leverage_edit_width + (int)MathRound(5 * m_DPIScale) + wide_edit_width, y + element_height, "m_LblSymbolLeverage", "(Symbol = 1:?)")) return false; + if (!LabelCreate(MarginTabList, m_LblSymbolLeverage, second_margin_column_start + leverage_edit_width + (int)MathRound(5 * m_DPIScale), y, second_margin_column_start + leverage_edit_width + (int)MathRound(5 * m_DPIScale) + wide_edit_width, y + element_height, "m_LblSymbolLeverage", "(" + TRANSLATION_LABEL_SYMBOL + " = 1:?)")) return false; y += element_height + v_spacing; - if (!LabelCreate(MarginTabList, m_LblMaxPositionSizeByMargin, first_column_start, y, first_column_start + wide_label_width, y + element_height, "m_LblMaxPositionSizeByMargin", "Maximum position size by margin:")) return false; - if (!EditCreate(MarginTabList, m_EdtMaxPositionSizeByMargin, max_psc_column_start, y, max_psc_column_start + max_psc_edit_width, y + element_height, "m_EdtMaxPositionSizeByMargin", "", "In lots")) return false; + if (!LabelCreate(MarginTabList, m_LblMaxPositionSizeByMargin, first_column_start, y, first_column_start + wide_label_width, y + element_height, "m_LblMaxPositionSizeByMargin", TRANSLATION_LABEL_MAX_PS_BY_MARGIN + ":")) return false; + if (!EditCreate(MarginTabList, m_EdtMaxPositionSizeByMargin, max_psc_column_start, y, max_psc_column_start + max_psc_edit_width, y + element_height, "m_EdtMaxPositionSizeByMargin", "", TRANSLATION_TOOLTIP_MAX_PS_BY_MARGIN)) return false; m_EdtMaxPositionSizeByMargin.ReadOnly(true); m_EdtMaxPositionSizeByMargin.ColorBackground(CONTROLS_EDIT_COLOR_DISABLE); @@ -796,26 +823,26 @@ bool CPositionSizeCalculator::CreateObjects() // Reset y = row_start + element_height + 3 * v_spacing; - if (!LabelCreate(SwapsTabList, m_LblSwapsType, first_column_start, y, first_column_start + narrow_edit_width, y + element_height, "m_LblSwapsType", "Type:")) return false; - if (!EditCreate(SwapsTabList, m_EdtSwapsType, first_column_start + narrow_edit_width, y, second_swaps_column_start + swap_type_edit_width, y + element_height, "m_EdtSwapsType", "Unknown")) return false; + if (!LabelCreate(SwapsTabList, m_LblSwapsType, first_column_start, y, first_column_start + narrow_edit_width, y + element_height, "m_LblSwapsType", TRANSLATION_LABEL_TYPE + ":")) return false; + if (!EditCreate(SwapsTabList, m_EdtSwapsType, first_column_start + narrow_edit_width, y, second_swaps_column_start + swap_type_edit_width, y + element_height, "m_EdtSwapsType", TRANSLATION_LABEL_UNKNOWN)) return false; m_EdtSwapsType.ReadOnly(true); m_EdtSwapsType.ColorBackground(CONTROLS_EDIT_COLOR_DISABLE); y += element_height + v_spacing; - if (!LabelCreate(SwapsTabList, m_LblSwapsTripleDay, first_column_start, y, first_column_start + narrow_edit_width, y + element_height, "m_LblSwapsTripleDay", "Triple swap:")) return false; + if (!LabelCreate(SwapsTabList, m_LblSwapsTripleDay, first_column_start, y, first_column_start + narrow_edit_width, y + element_height, "m_LblSwapsTripleDay", TRANSLATION_LABEL_TRIPLE_SWAP + ":")) return false; if (!EditCreate(SwapsTabList, m_EdtSwapsTripleDay, first_column_start + narrow_edit_width, y, second_swaps_column_start + swap_type_edit_width, y + element_height, "m_EdtSwapsTripleDay", "?")) return false; m_EdtSwapsTripleDay.ReadOnly(true); m_EdtSwapsTripleDay.ColorBackground(CONTROLS_EDIT_COLOR_DISABLE); y += element_height + v_spacing; - if (!LabelCreate(SwapsTabList, m_LblSwapsLong, second_swaps_column_start, y, second_swaps_column_start + narrow_edit_width, y + element_height, "m_LblSwapsLong", "Long")) return false; - if (!LabelCreate(SwapsTabList, m_LblSwapsShort, third_swaps_column_start, y, third_swaps_column_start + narrow_edit_width, y + element_height, "m_LblSwapsShort", "Short")) return false; + if (!LabelCreate(SwapsTabList, m_LblSwapsLong, second_swaps_column_start, y, second_swaps_column_start + narrow_edit_width, y + element_height, "m_LblSwapsLong", TRANSLATION_BUTTON_LONG)) return false; + if (!LabelCreate(SwapsTabList, m_LblSwapsShort, third_swaps_column_start, y, third_swaps_column_start + narrow_edit_width, y + element_height, "m_LblSwapsShort", TRANSLATION_BUTTON_SHORT)) return false; y += element_height + v_spacing; - if (!LabelCreate(SwapsTabList, m_LblSwapsNominal, first_column_start, y, first_column_start + narrowest_label_width, y + element_height, "m_LblSwapsNominal", "Nominal:")) return false; + if (!LabelCreate(SwapsTabList, m_LblSwapsNominal, first_column_start, y, first_column_start + narrowest_label_width, y + element_height, "m_LblSwapsNominal", TRANSLATION_LABEL_NOMINAL + ":")) return false; if (!EditCreate(SwapsTabList, m_EdtSwapsNominalLong, second_swaps_column_start, y, second_swaps_column_start + swap_size_edit_width, y + element_height, "m_EdtSwapsNominalLong", "?")) return false; if (!EditCreate(SwapsTabList, m_EdtSwapsNominalShort, third_swaps_column_start, y, third_swaps_column_start + swap_size_edit_width, y + element_height, "m_EdtSwapsNominalShort", "?")) return false; m_EdtSwapsNominalLong.ReadOnly(true); @@ -825,10 +852,10 @@ bool CPositionSizeCalculator::CreateObjects() y += element_height + v_spacing; - if (!LabelCreate(SwapsTabList, m_LblSwapsDaily, first_column_start, y, first_column_start + narrowest_label_width, y + element_height, "m_LblSwapsDaily", "Daily:")) return false; + if (!LabelCreate(SwapsTabList, m_LblSwapsDaily, first_column_start, y, first_column_start + narrowest_label_width, y + element_height, "m_LblSwapsDaily", TRANSLATION_LABEL_DAILY+ ":")) return false; if (!EditCreate(SwapsTabList, m_EdtSwapsDailyLongLot, second_swaps_column_start, y, second_swaps_column_start + swap_size_edit_width, y + element_height, "m_EdtSwapsDailyLongLot", "?")) return false; if (!EditCreate(SwapsTabList, m_EdtSwapsDailyShortLot, third_swaps_column_start, y, third_swaps_column_start + swap_size_edit_width, y + element_height, "m_EdtSwapsDailyShortLot", "?")) return false; - if (!LabelCreate(SwapsTabList, m_LblSwapsPerLotDaily, fourth_swaps_column_start, y, fourth_swaps_column_start + swap_last_label_width, y + element_height, "m_LblSwapsPerLotDaily", "USD per lot")) return false; + if (!LabelCreate(SwapsTabList, m_LblSwapsPerLotDaily, fourth_swaps_column_start, y, fourth_swaps_column_start + swap_last_label_width, y + element_height, "m_LblSwapsPerLotDaily", "USD " + TRANSLATION_LABEL_PER_LOT)) return false; m_EdtSwapsDailyLongLot.ReadOnly(true); m_EdtSwapsDailyLongLot.ColorBackground(CONTROLS_EDIT_COLOR_DISABLE); m_EdtSwapsDailyShortLot.ReadOnly(true); @@ -838,7 +865,7 @@ bool CPositionSizeCalculator::CreateObjects() if (!EditCreate(SwapsTabList, m_EdtSwapsDailyLongPS, second_swaps_column_start, y, second_swaps_column_start + swap_size_edit_width, y + element_height, "m_EdtSwapsDailyLongPS", "?")) return false; if (!EditCreate(SwapsTabList, m_EdtSwapsDailyShortPS, third_swaps_column_start, y, third_swaps_column_start + swap_size_edit_width, y + element_height, "m_EdtSwapsDailyShortPS", "?")) return false; - if (!LabelCreate(SwapsTabList, m_LblSwapsPerPSDaily, fourth_swaps_column_start, y, fourth_swaps_column_start + swap_last_label_width, y + element_height, "m_LblSwapsPerPSDaily", "USD per PS ()")) return false; + if (!LabelCreate(SwapsTabList, m_LblSwapsPerPSDaily, fourth_swaps_column_start, y, fourth_swaps_column_start + swap_last_label_width, y + element_height, "m_LblSwapsPerPSDaily", "USD " + TRANSLATION_LABEL_PER_PS + " ()")) return false; m_EdtSwapsDailyLongPS.ReadOnly(true); m_EdtSwapsDailyLongPS.ColorBackground(CONTROLS_EDIT_COLOR_DISABLE); m_EdtSwapsDailyShortPS.ReadOnly(true); @@ -846,10 +873,10 @@ bool CPositionSizeCalculator::CreateObjects() y += element_height + v_spacing; - if (!LabelCreate(SwapsTabList, m_LblSwapsYearly, first_column_start, y, first_column_start + narrowest_label_width, y + element_height, "m_LblSwapsYearly", "Yearly:")) return false; + if (!LabelCreate(SwapsTabList, m_LblSwapsYearly, first_column_start, y, first_column_start + narrowest_label_width, y + element_height, "m_LblSwapsYearly", TRANSLATION_LABEL_YEARLY + ":")) return false; if (!EditCreate(SwapsTabList, m_EdtSwapsYearlyLongLot, second_swaps_column_start, y, second_swaps_column_start + swap_size_edit_width, y + element_height, "m_EdtSwapsYearlyLongLot", "?")) return false; if (!EditCreate(SwapsTabList, m_EdtSwapsYearlyShortLot, third_swaps_column_start, y, third_swaps_column_start + swap_size_edit_width, y + element_height, "m_EdtSwapsYearlyShortLot", "?")) return false; - if (!LabelCreate(SwapsTabList, m_LblSwapsPerLotYearly, fourth_swaps_column_start, y, fourth_swaps_column_start + swap_last_label_width, y + element_height, "m_LblSwapsPerLotYearly", "USD per lot")) return false; + if (!LabelCreate(SwapsTabList, m_LblSwapsPerLotYearly, fourth_swaps_column_start, y, fourth_swaps_column_start + swap_last_label_width, y + element_height, "m_LblSwapsPerLotYearly", "USD " + TRANSLATION_LABEL_PER_LOT)) return false; m_EdtSwapsYearlyLongLot.ReadOnly(true); m_EdtSwapsYearlyLongLot.ColorBackground(CONTROLS_EDIT_COLOR_DISABLE); m_EdtSwapsYearlyShortLot.ReadOnly(true); @@ -859,7 +886,7 @@ bool CPositionSizeCalculator::CreateObjects() if (!EditCreate(SwapsTabList, m_EdtSwapsYearlyLongPS, second_swaps_column_start, y, second_swaps_column_start + swap_size_edit_width, y + element_height, "m_EdtSwapsYearlyLongPS", "?")) return false; if (!EditCreate(SwapsTabList, m_EdtSwapsYearlyShortPS, third_swaps_column_start, y, third_swaps_column_start + swap_size_edit_width, y + element_height, "m_EdtSwapsYearlyShortPS", "?")) return false; - if (!LabelCreate(SwapsTabList, m_LblSwapsPerPSYearly, fourth_swaps_column_start, y, fourth_swaps_column_start + swap_last_label_width, y + element_height, "m_LblSwapsPerPSYearly", "USD per PS ()")) return false; + if (!LabelCreate(SwapsTabList, m_LblSwapsPerPSYearly, fourth_swaps_column_start, y, fourth_swaps_column_start + swap_last_label_width, y + element_height, "m_LblSwapsPerPSYearly", "USD " + TRANSLATION_LABEL_PER_PS + " ()")) return false; m_EdtSwapsYearlyLongPS.ReadOnly(true); m_EdtSwapsYearlyLongPS.ColorBackground(CONTROLS_EDIT_COLOR_DISABLE); m_EdtSwapsYearlyShortPS.ReadOnly(true); @@ -870,66 +897,66 @@ bool CPositionSizeCalculator::CreateObjects() // Reset y = row_start + element_height + 3 * v_spacing; - if (!ButtonCreate(TradingTabList, m_BtnTrade, first_column_start, y, first_column_start + tab_button_width, y + element_height, "m_BtnTrade", "Trade")) return false; - if (!LabelCreate(TradingTabList, m_LblTrailingStop, first_column_start + tab_button_width + v_spacing * 2, y, first_column_start + v_spacing + tab_button_width + normal_edit_width, y + element_height, "m_LblTrailingStop", "Trailing stop:")) return false; + if (!ButtonCreate(TradingTabList, m_BtnTrade, first_column_start, y, first_column_start + tab_button_width, y + element_height, "m_BtnTrade", TRANSLATION_BUTTON_TRADE)) return false; + if (!LabelCreate(TradingTabList, m_LblTrailingStop, first_column_start + tab_button_width + v_spacing * 2, y, first_column_start + v_spacing + tab_button_width + normal_edit_width, y + element_height, "m_LblTrailingStop", TRANSLATION_LABEL_TRAILING_STOP + ":")) return false; if (!EditCreate(TradingTabList, m_EdtTrailingStopPoints, first_column_start + v_spacing * 2 + tab_button_width + normal_edit_width, y, first_column_start + v_spacing * 2 + tab_button_width * 2 + normal_edit_width, y + element_height, "m_EdtTrailingStopPoints", "0")) return false; - if (!LabelCreate(TradingTabList, m_LblBreakEven, first_column_start + v_spacing * 5 + tab_button_width * 2 + normal_edit_width, y, first_column_start + v_spacing * 3 + tab_button_width * 2 + normal_edit_width + narrow_edit_width, y + element_height, "m_LblBreakEven", "Breakeven:")) return false; + if (!LabelCreate(TradingTabList, m_LblBreakEven, first_column_start + v_spacing * 5 + tab_button_width * 2 + normal_edit_width, y, first_column_start + v_spacing * 3 + tab_button_width * 2 + normal_edit_width + narrow_edit_width, y + element_height, "m_LblBreakEven", TRANSLATION_LABEL_BREAKEVEN + ":")) return false; if (!EditCreate(TradingTabList, m_EdtBreakEvenPoints, first_column_start + v_spacing * 4 + tab_button_width * 2 + normal_edit_width + narrow_edit_width, y, first_column_start + v_spacing * 4 + tab_button_width * 3 + normal_edit_width + narrow_edit_width, y + element_height, "m_EdtBreakEvenPoints", "0")) return false; y += element_height + v_spacing; - if (!LabelCreate(TradingTabList, m_LblMagicNumber, first_column_start, y, first_column_start + normal_label_width, y + element_height, "m_LblMagicNumber", "Magic number:")) return false; + if (!LabelCreate(TradingTabList, m_LblMagicNumber, first_column_start, y, first_column_start + normal_label_width, y + element_height, "m_LblMagicNumber", TRANSLATION_LABEL_MAGIC_NUMBER + ":")) return false; if (!EditCreate(TradingTabList, m_EdtMagicNumber, first_column_start + normal_label_width, y, first_column_start + normal_label_width + normal_edit_width, y + element_height, "m_EdtMagicNumber", "")) return false; - if (!LabelCreate(TradingTabList, m_LblExpiry, first_column_start + normal_label_width + normal_edit_width + v_spacing, y, first_column_start + normal_label_width + normal_edit_width + narrowest_label_width, y + element_height, "m_LblExpiry", "Expiry:", "Expiration time in minutes for the next created pending order. Minimum = 10.")) return false; - if (!EditCreate(TradingTabList, m_EdtExpiry, first_column_start + normal_label_width + normal_edit_width + narrowest_label_width, y, first_column_start + normal_label_width + normal_edit_width + narrowest_label_width + tab_button_width, y + element_height, "m_EdtExpiry", "", "Expiration time in minutes for the next created pending order. Minimum = 10.")) return false; - if (!LabelCreate(TradingTabList, m_LblMinutes, first_column_start + normal_label_width + normal_edit_width + narrowest_label_width + tab_button_width + v_spacing, y, panel_end, y + element_height, "m_LblMinutes", "min.", "Minutes")) return false; + if (!LabelCreate(TradingTabList, m_LblExpiry, first_column_start + normal_label_width + normal_edit_width + v_spacing, y, first_column_start + normal_label_width + normal_edit_width + narrowest_label_width, y + element_height, "m_LblExpiry", TRANSLATION_LABEL_EXPIRY + ":", TRANSLATION_TOOLTIP_EXPIRY)) return false; + if (!EditCreate(TradingTabList, m_EdtExpiry, first_column_start + normal_label_width + normal_edit_width + narrowest_label_width, y, first_column_start + normal_label_width + normal_edit_width + narrowest_label_width + tab_button_width, y + element_height, "m_EdtExpiry", "", TRANSLATION_TOOLTIP_EXPIRY)) return false; + if (!LabelCreate(TradingTabList, m_LblMinutes, first_column_start + normal_label_width + normal_edit_width + narrowest_label_width + tab_button_width + v_spacing, y, panel_end, y + element_height, "m_LblMinutes", TRANSLATION_LABEL_MINUTES, TRANSLATION_TOOLTIP_MINUTES)) return false; y += element_height + v_spacing; - if (!LabelCreate(TradingTabList, m_LblCommentary, first_column_start, y, first_column_start + normal_label_width, y + element_height, "m_LblCommentary", "Order commentary:")) return false; + if (!LabelCreate(TradingTabList, m_LblCommentary, first_column_start, y, first_column_start + normal_label_width, y + element_height, "m_LblCommentary", TRANSLATION_LABEL_ORDER_COMMENTARY + ":")) return false; if (!EditCreate(TradingTabList, m_EdtCommentary, second_trading_column_start, y, second_trading_column_start + normal_edit_width, y + element_height, "m_EdtCommentary", "")) return false; - if (!CheckBoxCreate(TradingTabList, m_ChkCommentAutoSuffix, third_trading_column_start, y, third_trading_column_start + max_psc_edit_width, y + element_height, "m_ChkCommentAutoSuffix", "Auto-suffix")) return false; + if (!CheckBoxCreate(TradingTabList, m_ChkCommentAutoSuffix, third_trading_column_start, y, third_trading_column_start + max_psc_edit_width, y + element_height, "m_ChkCommentAutoSuffix", TRANSLATION_LABEL_ORDER_AUTOSUFFIX, TRANSLATION_TOOLTIP_ORDER_AUTOSUFFIX)) return false; y += element_height + v_spacing; if (ShowMaxParametersOnTrading) { - if (!LabelCreate(TradingTabList, m_LblMaxNumberOfTrades, first_column_start, y, first_column_start + normal_label_width, y + element_height, "m_LblMaxNumberOfTrades", "Max # of trades")) return false; - if (!LabelCreate(TradingTabList, m_LblMaxNumberOfTradesTotal, first_column_start + narrow_label_width + element_height, y, multi_tp_column_start + tab_button_width, y + element_height, "m_LblMaxNumberOfTradesTotal", "Total:")) return false; + if (!LabelCreate(TradingTabList, m_LblMaxNumberOfTrades, first_column_start, y, first_column_start + normal_label_width, y + element_height, "m_LblMaxNumberOfTrades", TRANSLATION_LABEL_MAX_NUMBER_OF_TRADES)) return false; + if (!LabelCreate(TradingTabList, m_LblMaxNumberOfTradesTotal, first_column_start + narrow_label_width + element_height, y, multi_tp_column_start + tab_button_width, y + element_height, "m_LblMaxNumberOfTradesTotal", TRANSLATION_LABEL_TOTAL + ":")) return false; if (!EditCreate(TradingTabList, m_EdtMaxNumberOfTradesTotal, first_column_start + v_spacing * 2 + tab_button_width + normal_edit_width, y, first_column_start + v_spacing * 2 + tab_button_width * 2 + normal_edit_width, y + element_height, "m_EdtMaxNumberOfTradesTotal", "")) return false; - if (!LabelCreate(TradingTabList, m_LblMaxNumberOfTradesPerSymbol, multi_tp_button_start + leverage_edit_width + v_spacing * 2, y, multi_tp_button_start + leverage_edit_width + v_spacing * 6 + tab_button_width, y + element_height, "m_LblMaxNumberOfTradesPerSymbol", "Per symbol:")) return false; + if (!LabelCreate(TradingTabList, m_LblMaxNumberOfTradesPerSymbol, multi_tp_button_start + leverage_edit_width + v_spacing * 2, y, multi_tp_button_start + leverage_edit_width + v_spacing * 6 + tab_button_width, y + element_height, "m_LblMaxNumberOfTradesPerSymbol", TRANSLATION_LABEL_PER_SYMBOL + ":")) return false; if (!EditCreate(TradingTabList, m_EdtMaxNumberOfTradesPerSymbol, multi_tp_button_start + leverage_edit_width + v_spacing * 7 + tab_button_width, y, multi_tp_button_start + leverage_edit_width + v_spacing * 7 + tab_button_width * 2, y + element_height, "m_EdtMaxNumberOfTradesPerSymbol", "")) return false; y += element_height + v_spacing; - if (!LabelCreate(TradingTabList, m_LblMaxPositionSize, first_column_start, y, first_column_start + normal_label_width, y + element_height, "m_LblMaxPositionSize", "Max volume")) return false; - if (!LabelCreate(TradingTabList, m_LblMaxPositionSizeTotal, first_column_start + narrow_label_width + element_height, y, multi_tp_column_start + tab_button_width, y + element_height, "m_LblMaxPositionSizeTotal", "Total:")) return false; + if (!LabelCreate(TradingTabList, m_LblMaxPositionSize, first_column_start, y, first_column_start + normal_label_width, y + element_height, "m_LblMaxPositionSize", TRANSLATION_LABEL_MAX_VOLUME)) return false; + if (!LabelCreate(TradingTabList, m_LblMaxPositionSizeTotal, first_column_start + narrow_label_width + element_height, y, multi_tp_column_start + tab_button_width, y + element_height, "m_LblMaxPositionSizeTotal", TRANSLATION_LABEL_TOTAL + ":")) return false; if (!EditCreate(TradingTabList, m_EdtMaxPositionSizeTotal, first_column_start + v_spacing * 2 + tab_button_width + normal_edit_width, y, first_column_start + v_spacing * 2 + tab_button_width * 2 + normal_edit_width, y + element_height, "m_EdtMaxPositionSizeTotal", "")) return false; - if (!LabelCreate(TradingTabList, m_LblMaxPositionSizePerSymbol, multi_tp_button_start + leverage_edit_width + v_spacing * 2, y, multi_tp_button_start + leverage_edit_width + v_spacing * 6 + tab_button_width, y + element_height, "m_LblMaxPositionSizePerSymbol", "Per symbol:")) return false; + if (!LabelCreate(TradingTabList, m_LblMaxPositionSizePerSymbol, multi_tp_button_start + leverage_edit_width + v_spacing * 2, y, multi_tp_button_start + leverage_edit_width + v_spacing * 6 + tab_button_width, y + element_height, "m_LblMaxPositionSizePerSymbol", TRANSLATION_LABEL_PER_SYMBOL + ":")) return false; if (!EditCreate(TradingTabList, m_EdtMaxPositionSizePerSymbol, multi_tp_button_start + leverage_edit_width + v_spacing * 7 + tab_button_width, y, multi_tp_button_start + leverage_edit_width + v_spacing * 7 + tab_button_width * 2, y + element_height, "m_EdtMaxPositionSizePerSymbol", "")) return false; y += element_height + v_spacing; - if (!LabelCreate(TradingTabList, m_LblMaxRisk, first_column_start, y, first_column_start + normal_label_width, y + element_height, "m_LblMaxRisk", "Max risk, %")) return false; - if (!LabelCreate(TradingTabList, m_LblMaxRiskTotal, first_column_start + narrow_label_width + element_height, y, multi_tp_column_start + tab_button_width, y + element_height, "m_LblMaxRiskTotal", "Total:")) return false; + if (!LabelCreate(TradingTabList, m_LblMaxRisk, first_column_start, y, first_column_start + normal_label_width, y + element_height, "m_LblMaxRisk", TRANSLATION_LABEL_MAX_RISK + ", %")) return false; + if (!LabelCreate(TradingTabList, m_LblMaxRiskTotal, first_column_start + narrow_label_width + element_height, y, multi_tp_column_start + tab_button_width, y + element_height, "m_LblMaxRiskTotal", TRANSLATION_LABEL_TOTAL + ":")) return false; if (!EditCreate(TradingTabList, m_EdtMaxRiskTotal, first_column_start + v_spacing * 2 + tab_button_width + normal_edit_width, y, first_column_start + v_spacing * 2 + tab_button_width * 2 + normal_edit_width, y + element_height, "m_EdtMaxRiskTotal", "")) return false; - if (!LabelCreate(TradingTabList, m_LblMaxRiskPerSymbol, multi_tp_button_start + leverage_edit_width + v_spacing * 2, y, multi_tp_button_start + leverage_edit_width + v_spacing * 6 + tab_button_width, y + element_height, "m_LblMaxRiskPerSymbol", "Per symbol:")) return false; + if (!LabelCreate(TradingTabList, m_LblMaxRiskPerSymbol, multi_tp_button_start + leverage_edit_width + v_spacing * 2, y, multi_tp_button_start + leverage_edit_width + v_spacing * 6 + tab_button_width, y + element_height, "m_LblMaxRiskPerSymbol", TRANSLATION_LABEL_PER_SYMBOL + ":")) return false; if (!EditCreate(TradingTabList, m_EdtMaxRiskPerSymbol, multi_tp_button_start + leverage_edit_width + v_spacing * 7 + tab_button_width, y, multi_tp_button_start + leverage_edit_width + v_spacing * 7 + tab_button_width * 2, y + element_height, "m_EdtMaxRiskPerSymbol", "")) return false; y += element_height + v_spacing; } - if (!CheckBoxCreate(TradingTabList, m_ChkDisableTradingWhenLinesAreHidden, first_column_start, y, panel_end, y + element_height, "m_ChkDisableTradingWhenLinesAreHidden", "Disable trading when lines are hidden")) return false; + if (!CheckBoxCreate(TradingTabList, m_ChkDisableTradingWhenLinesAreHidden, first_column_start, y, panel_end, y + element_height, "m_ChkDisableTradingWhenLinesAreHidden", TRANSLATION_CHECKBOX_DISABLE_TRADING_LINES_HIDDEN)) return false; y += element_height + v_spacing; // Need multiple TP targets. if (sets.TakeProfitsNumber > 1) { - if (!LabelCreate(TradingTabList, m_LblTradingTP, multi_tp_column_start, y, multi_tp_column_start + multi_tp_label_width, y + element_height, "m_LblTradingTP", "TP")) return false; - if (!ButtonCreate(TradingTabList, m_BtnTPsInward, multi_tp_button_start, y, multi_tp_button_start + leverage_edit_width, y + element_height, "m_BtnTPsInward", "<<", "Fill additional TPs equidistantly between Entry and Main TP.")) return false; - if (!ButtonCreate(TradingTabList, m_BtnTPsOutward, multi_tp_button_start + leverage_edit_width + v_spacing, y, multi_tp_button_start + 2 * leverage_edit_width + v_spacing, y + element_height, "m_BtnTPsOutward", ">>", "Place additional TPs beyond the Main TP using the same distance.")) return false; - if (!ButtonCreate(TradingTabList, m_BtnTradingTPShare, third_trading_column_start, y, third_trading_column_start + normal_edit_width, y + element_height, "m_BtnTradingTPShare", "Share, %", "Automatically fill the volume shares")) return false; + if (!LabelCreate(TradingTabList, m_LblTradingTP, multi_tp_column_start, y, multi_tp_column_start + multi_tp_label_width, y + element_height, "m_LblTradingTP", TRANSLATION_LABEL_TAKEPROFIT_MULTIPLE_DISTANCE)) return false; + if (!ButtonCreate(TradingTabList, m_BtnTPsInward, multi_tp_button_start, y, multi_tp_button_start + leverage_edit_width, y + element_height, "m_BtnTPsInward", "<<", TRANSLATION_TOOLTIP_FILL_INWARD)) return false; + if (!ButtonCreate(TradingTabList, m_BtnTPsOutward, multi_tp_button_start + leverage_edit_width + v_spacing, y, multi_tp_button_start + 2 * leverage_edit_width + v_spacing, y + element_height, "m_BtnTPsOutward", ">>", TRANSLATION_TOOLTIP_FILL_OUTWARD)) return false; + if (!ButtonCreate(TradingTabList, m_BtnTradingTPShare, third_trading_column_start, y, third_trading_column_start + normal_edit_width, y + element_height, "m_BtnTradingTPShare", TRANSLATION_LABEL_SHARE + ", %", TRANSLATION_TOOLTIP_SHARE)) return false; y += element_height + v_spacing; @@ -938,7 +965,7 @@ bool CPositionSizeCalculator::CreateObjects() ArrayResize(TradingTPShareEdits, sets.TakeProfitsNumber); for (int i = 0; i < sets.TakeProfitsNumber; i++) { - if (!LabelCreate(TradingTabList, TradingTPLabels[i], first_column_start, y, first_column_start + normal_label_width, y + element_height, "m_LblTradingTPLabel" + IntegerToString(i + 1), "Take-profit " + IntegerToString(i + 1))) return false; + if (!LabelCreate(TradingTabList, TradingTPLabels[i], first_column_start, y, first_column_start + normal_label_width, y + element_height, "m_LblTradingTPLabel" + IntegerToString(i + 1), TRANSLATION_LABEL_TAKEPROFIT + " " + IntegerToString(i + 1))) return false; if (!EditCreate(TradingTabList, TradingTPEdits[i], multi_tp_column_start, y, second_trading_column_start + normal_edit_width, y + element_height, "m_EdtTradingTPEdit" + IntegerToString(i + 1), "")) return false; if (!EditCreate(TradingTabList, TradingTPShareEdits[i], third_trading_column_start, y, third_trading_column_start + leverage_edit_width, y + element_height, "m_EdtTradingTPShareEdit" + IntegerToString(i + 1), "")) return false; y += element_height + v_spacing; @@ -947,58 +974,63 @@ bool CPositionSizeCalculator::CreateObjects() if (ShowFusesOnTrading) { - if (!LabelCreate(TradingTabList, m_LblTradingPoints, second_trading_column_start, y, second_trading_column_start + normal_edit_width, y + element_height, "m_LblTradingPoints", "Points", "")) return false; + if (!LabelCreate(TradingTabList, m_LblTradingPoints, second_trading_column_start, y, second_trading_column_start + normal_edit_width, y + element_height, "m_LblTradingPoints", TRANSLATION_LABEL_POINTS, "")) return false; y += element_height + v_spacing; - if (!LabelCreate(TradingTabList, m_LblMaxSlippage, first_column_start, y, first_column_start + normal_label_width, y + element_height, "m_LblMaxSlippage", "Max slippage:")) return false; + if (!LabelCreate(TradingTabList, m_LblMaxSlippage, first_column_start, y, first_column_start + normal_label_width, y + element_height, "m_LblMaxSlippage", TRANSLATION_LABEL_MAX_SLIPPAGE + ":")) return false; if (!EditCreate(TradingTabList, m_EdtMaxSlippage, second_trading_column_start, y, second_trading_column_start + normal_edit_width, y + element_height, "m_EdtMaxSlippage", "")) return false; y += element_height + v_spacing; - if (!LabelCreate(TradingTabList, m_LblMaxSpread, first_column_start, y, first_column_start + normal_label_width, y + element_height, "m_LblMaxSpread", "Max spread:")) return false; + if (!LabelCreate(TradingTabList, m_LblMaxSpread, first_column_start, y, first_column_start + normal_label_width, y + element_height, "m_LblMaxSpread", TRANSLATION_LABEL_MAX_SPREAD + ":")) return false; if (!EditCreate(TradingTabList, m_EdtMaxSpread, second_trading_column_start, y, second_trading_column_start + normal_edit_width, y + element_height, "m_EdtMaxSpread", "")) return false; y += element_height + v_spacing; - if (!LabelCreate(TradingTabList, m_LblMaxEntrySLDistance, first_column_start, y, first_column_start + normal_label_width, y + element_height, "m_LblMaxEntrySLDistance", "Max Entry/SL distance:")) return false; + if (!LabelCreate(TradingTabList, m_LblMaxEntrySLDistance, first_column_start, y, first_column_start + normal_label_width, y + element_height, "m_LblMaxEntrySLDistance", TRANSLATION_LABEL_MAX_ENTRY_SL_DISTANCE + ":")) return false; if (!EditCreate(TradingTabList, m_EdtMaxEntrySLDistance, second_trading_column_start, y, second_trading_column_start + normal_edit_width, y + element_height, "m_EdtMaxEntrySLDistance", "")) return false; y += element_height + v_spacing; - if (!LabelCreate(TradingTabList, m_LblMinEntrySLDistance, first_column_start, y, first_column_start + normal_label_width, y + element_height, "m_LblMinEntrySLDistance", "Min Entry/SL distance:")) return false; + if (!LabelCreate(TradingTabList, m_LblMinEntrySLDistance, first_column_start, y, first_column_start + normal_label_width, y + element_height, "m_LblMinEntrySLDistance", TRANSLATION_LABEL_MIN_ENTRY_SL_DISTANCE + ":")) return false; if (!EditCreate(TradingTabList, m_EdtMinEntrySLDistance, second_trading_column_start, y, second_trading_column_start + normal_edit_width, y + element_height, "m_EdtMinEntrySLDistance", "")) return false; y += element_height + v_spacing; + + if (!LabelCreate(TradingTabList, m_LblMaxRiskPercentage, first_column_start, y, first_column_start + normal_label_width, y + element_height, "m_LblMaxRiskPercentage", TRANSLATION_LABEL_MAX_RISK_PERCENTAGE + ":")) return false; + if (!EditCreate(TradingTabList, m_EdtMaxRiskPercentage, second_trading_column_start, y, second_trading_column_start + normal_edit_width, y + element_height, "m_EdtMaxRiskPercentage", "")) return false; + + y += element_height + v_spacing; } if (ShowCheckboxesOnTrading) { - if (!CheckBoxCreate(TradingTabList, m_ChkSubtractPositions, first_column_start, y, panel_end, y + element_height, "m_ChkSubtractPositions", "Subtract open positions volume", "The EA will subtract currently open trades' volume from the calculated position size before opening a trade.")) return false; + if (!CheckBoxCreate(TradingTabList, m_ChkSubtractPositions, first_column_start, y, panel_end, y + element_height, "m_ChkSubtractPositions", TRANSLATION_CHECKBOX_SUBTRACT_OPEN_POSITIONS_VOLUME, TRANSLATION_TOOLTIP_SUBTRACT_OPEN_POSITIONS_VOLUME)) return false; y += element_height + v_spacing; - if (!CheckBoxCreate(TradingTabList, m_ChkSubtractPendingOrders, first_column_start, y, panel_end, y + element_height, "m_ChkSubtractPendingOrders", "Subtract pending orders volume", "The EA will subtract pending orders' volume from the calculated position size before opening a trade.")) return false; + if (!CheckBoxCreate(TradingTabList, m_ChkSubtractPendingOrders, first_column_start, y, panel_end, y + element_height, "m_ChkSubtractPendingOrders", TRANSLATION_CHECKBOX_SUBTRACT_PENDING_ORDERS_VOLUME, TRANSLATION_TOOLTIP_SUBTRACT_PENDING_ORDERS_VOLUME)) return false; y += element_height + v_spacing; - if (!CheckBoxCreate(TradingTabList, m_ChkDoNotApplyStopLoss, first_column_start, y, panel_end, y + element_height, "m_ChkDoNotApplyStopLoss", "Do not apply stop-loss", "The EA won't apply stop-loss to the trade it opens.")) return false; + if (!CheckBoxCreate(TradingTabList, m_ChkDoNotApplyStopLoss, first_column_start, y, panel_end, y + element_height, "m_ChkDoNotApplyStopLoss", TRANSLATION_CHECKBOX_DO_NOT_APPLY_STOPLOSS, TRANSLATION_TOOLTIP_DO_NOT_APPLY_STOPLOSS)) return false; y += element_height + v_spacing; - if (!CheckBoxCreate(TradingTabList, m_ChkDoNotApplyTakeProfit, first_column_start, y, panel_end, y + element_height, "m_ChkDoNotApplyTakeProfit", "Do not apply take-profit", "The EA won't apply take-profit to the trade it opens.")) return false; + if (!CheckBoxCreate(TradingTabList, m_ChkDoNotApplyTakeProfit, first_column_start, y, panel_end, y + element_height, "m_ChkDoNotApplyTakeProfit", TRANSLATION_CHECKBOX_DO_NOT_APPLY_TAKEPROFIT, TRANSLATION_TOOLTIP_DO_NOT_APPLY_TAKEPROFIT)) return false; y += element_height + v_spacing; } - if (!CheckBoxCreate(TradingTabList, m_ChkAskForConfirmation, first_column_start, y, panel_end, y + element_height, "m_ChkAskForConfirmation", "Ask for confirmation", "The EA will ask for confirmation before opening a trade.")) return false; + if (!CheckBoxCreate(TradingTabList, m_ChkAskForConfirmation, first_column_start, y, panel_end, y + element_height, "m_ChkAskForConfirmation", TRANSLATION_CHECKBOX_ASK_FOR_CONFIRMATION, TRANSLATION_TOOLTIP_ASK_FOR_CONFIRMATION)) return false; // Outside button for quick trading: if ((AdditionalTradeButtons == ADDITIONAL_TRADE_BUTTONS_LINE) || (AdditionalTradeButtons == ADDITIONAL_TRADE_BUTTONS_BOTH)) { int width = normal_label_width; if (ShowAdditionalEntryLabel) width = int(width * 1.2); - if (!CreateOutsideButton(m_OutsideTradeButton, 0, 0, width, element_height, "m_OutsideTradeButton", "", "Click to open an order/position.")) Print("Failed to create an outside button."); + if (!CreateOutsideButton(m_OutsideTradeButton, 0, 0, width, element_height, "m_OutsideTradeButton", "", TRANSLATION_TOOLTIP_OUTSIDE_TRADE_BUTTON)) Print(TRANSLATION_MESSAGE_FAILED_TO_CREATE_OUTSIDE_BUTTON); m_OutsideTradeButton.Hide(); // Will be unhidden after it's moved to above the Entry line. } @@ -1079,6 +1111,7 @@ bool CPositionSizeCalculator::InitObjects() if (!m_EdtMaxSpread.TextAlign(align)) return false; if (!m_EdtMaxEntrySLDistance.TextAlign(align)) return false; if (!m_EdtMinEntrySLDistance.TextAlign(align)) return false; + if (!m_EdtMaxRiskPercentage.TextAlign(align)) return false; } if (!m_EdtTrailingStopPoints.TextAlign(align)) return false; if (!m_EdtBreakEvenPoints.TextAlign(align)) return false; @@ -1115,6 +1148,12 @@ bool CPositionSizeCalculator::InitObjects() SeekAndDestroyDuplicatePanels(); + // For use in visual backtesting only. + if (MinMaxButtonId < 0) // No value yet. + { + MinMaxButtonId = Control(ControlsTotal() - 1).Id(); // Last control. + } + return true; } @@ -1124,18 +1163,18 @@ void CPositionSizeCalculator::InitControlsValues() { if (!sets.TPDistanceInPoints) { - m_BtnTakeProfit.Text("Take-profit x " + DoubleToString(TP_Multiplier, CountDecimalPlaces(TP_Multiplier)) + ":"); + m_BtnTakeProfit.Text(TRANSLATION_LABEL_TAKEPROFIT_MULTIPLE_DISTANCE + " x " + DoubleToString(TP_Multiplier, CountDecimalPlaces(TP_Multiplier)) + ":"); } - else m_BtnTakeProfit.Text("TP x " + DoubleToString(TP_Multiplier, CountDecimalPlaces(TP_Multiplier)) + ":"); + else m_BtnTakeProfit.Text(TRANSLATION_LABEL_TAKEPROFIT_MULTIPLE_DISTANCE + " x " + DoubleToString(TP_Multiplier, CountDecimalPlaces(TP_Multiplier)) + ":"); } if (sets.EntryType) { - m_BtnOrderType.Text("Pending"); + m_BtnOrderType.Text(TRANSLATION_BUTTON_ORDER_TYPE_PENDING); } else { - m_BtnOrderType.Text("Instant"); + m_BtnOrderType.Text(TRANSLATION_BUTTON_ORDER_TYPE_INSTANT); m_EdtEntryLevel.ReadOnly(true); m_EdtEntryLevel.ColorBackground(CONTROLS_EDIT_COLOR_DISABLE); } @@ -1148,7 +1187,7 @@ void CPositionSizeCalculator::InitControlsValues() { default: case Balance: - m_BtnAccount.Text("Account balance"); + m_BtnAccount.Text(TRANSLATION_BUTTON_ACCOUNT_BALANCE); // Custom balance. if (CustomBalance > 0) acc_val = CustomBalance; else acc_val = AccountInfoDouble(ACCOUNT_BALANCE); @@ -1157,14 +1196,14 @@ void CPositionSizeCalculator::InitControlsValues() m_EdtAccount.ColorBackground(CONTROLS_EDIT_COLOR_ENABLE); break; case Equity: - m_BtnAccount.Text("Account equity"); + m_BtnAccount.Text(TRANSLATION_BUTTON_ACCOUNT_EQUITY); acc_val = AccountInfoDouble(ACCOUNT_EQUITY); // Account balance uneditable. m_EdtAccount.ReadOnly(true); m_EdtAccount.ColorBackground(CONTROLS_EDIT_COLOR_DISABLE); break; case Balance_minus_Risk: - m_BtnAccount.Text("Balance - CPR"); + m_BtnAccount.Text(TRANSLATION_BUTTON_BALANCE_MINUS_CPR); // Custom balance. if (CustomBalance > 0) acc_val = CustomBalance; else acc_val = AccountInfoDouble(ACCOUNT_BALANCE); @@ -1218,13 +1257,25 @@ void CPositionSizeCalculator::InitControlsValues() m_EdtATRMultiplierTP.Text(DoubleToString(sets.ATRMultiplierTP, 2)); m_ChkSpreadAdjustmentTP.Checked(sets.SpreadAdjustmentTP); if (sets.ATRTimeframe != PERIOD_CURRENT) m_BtnATRTimeframe.Text(EnumToString(sets.ATRTimeframe)); - else m_BtnATRTimeframe.Text("CURRENT"); + else m_BtnATRTimeframe.Text(TRANSLATION_BUTTON_ATR_PERIOD_CURRENT); } m_ChkCountPendings.Checked(sets.CountPendingOrders); m_ChkIgnoreOrdersWithoutSL.Checked(sets.IgnoreOrdersWithoutSL); m_ChkIgnoreOrdersWithoutTP.Checked(sets.IgnoreOrdersWithoutTP); - m_ChkIgnoreOtherSymbols.Checked(sets.IgnoreOtherSymbols); + switch(sets.IgnoreSymbols) + { + default: + case IGNORE_SYMBOLS_NONE: + m_BtnIgnoreSymbols.Text(TRANSLATION_BUTTON_SYMBOLS_NO); + break; + case IGNORE_SYMBOLS_OTHER: + m_BtnIgnoreSymbols.Text(TRANSLATION_BUTTON_SYMBOLS_OTHER); + break; + case IGNORE_SYMBOLS_CURRENT: + m_BtnIgnoreSymbols.Text(TRANSLATION_BUTTON_SYMBOLS_CURRENT); + break; + } // Show/hide RiskReward if (sets.TakeProfitLevel == 0) @@ -1263,6 +1314,7 @@ void CPositionSizeCalculator::InitControlsValues() m_EdtMaxSpread.Text(IntegerToString(sets.MaxSpread)); m_EdtMaxEntrySLDistance.Text(IntegerToString(sets.MaxEntrySLDistance)); m_EdtMinEntrySLDistance.Text(IntegerToString(sets.MinEntrySLDistance)); + m_EdtMaxRiskPercentage.Text(DoubleToString(sets.MaxRiskPercentage, 2)); } if (ShowCheckboxesOnTrading) { @@ -1335,14 +1387,14 @@ bool CPositionSizeCalculator::DisplayValues() //=== Spread if (ShowSpread == Points) { - if (!Caption(PanelCaption + " | Spread: " + IntegerToString(SymbolInfoInteger(Symbol(), SYMBOL_SPREAD)))) return false; + if (!Caption(PanelCaption + " | " + TRANSLATION_LABEL_SPREAD + ": " + IntegerToString(SymbolInfoInteger(Symbol(), SYMBOL_SPREAD)))) return false; } else if (ShowSpread == Ratio) // Spread / SL ratio in percentage. { double SL; if (sets.SLDistanceInPoints) SL = sets.StopLoss * _Point; else SL = MathAbs(sets.StopLossLevel - sets.EntryLevel); - if (SL != 0) if (!Caption(PanelCaption + " | Spread: " + DoubleToString((SymbolInfoInteger(Symbol(), SYMBOL_SPREAD) * _Point / SL) * 100, 2) + "%")) return false; + if (SL != 0) if (!Caption(PanelCaption + " | " + TRANSLATION_LABEL_SPREAD + ": " + DoubleToString((SymbolInfoInteger(Symbol(), SYMBOL_SPREAD) * _Point / SL) * 100, 2) + "%")) return false; } else if (!Caption(PanelCaption)) return false; @@ -1389,13 +1441,13 @@ bool CPositionSizeCalculator::DisplayValues() /* Order type */ if (sets.EntryType == Instant) { - m_BtnOrderType.Text("Instant"); + m_BtnOrderType.Text(TRANSLATION_BUTTON_ORDER_TYPE_INSTANT); m_EdtEntryLevel.ReadOnly(true); m_EdtEntryLevel.ColorBackground(CONTROLS_EDIT_COLOR_DISABLE); } else if (sets.EntryType == Pending) { - m_BtnOrderType.Text("Pending"); + m_BtnOrderType.Text(TRANSLATION_BUTTON_ORDER_TYPE_PENDING); m_EdtEntryLevel.ReadOnly(false); m_EdtEntryLevel.ColorBackground(CONTROLS_EDIT_COLOR_ENABLE); } @@ -1413,7 +1465,7 @@ bool CPositionSizeCalculator::DisplayValues() if (sets.CustomBalance > 0) { if (!m_minimized) m_LblAdditionalFundsAsterisk.Show(); - ObjectSetString(ChartID(), m_name + "m_LblAdditionalFundsAsterisk", OBJPROP_TOOLTIP, "Custom balance set"); + ObjectSetString(ChartID(), m_name + "m_LblAdditionalFundsAsterisk", OBJPROP_TOOLTIP, TRANSLATION_TOOLTIP_ACCOUNT_SIZE_ASTERISK_CUSTOM); } else { @@ -1430,8 +1482,8 @@ bool CPositionSizeCalculator::DisplayValues() { if (!m_minimized) m_LblAdditionalFundsAsterisk.Show(); string tooltip = ""; - if (AdditionalFunds > 0) tooltip = "+" + DoubleToString(AdditionalFunds, 2) + " additional funds"; - else if (AdditionalFunds < 0) tooltip = DoubleToString(-AdditionalFunds, 2) + " funds subtracted"; + if (AdditionalFunds > 0) tooltip = "+" + DoubleToString(AdditionalFunds, 2) + " " + TRANSLATION_TOOLTIP_ACCOUNT_SIZE_ASTERISK_ADD; + else if (AdditionalFunds < 0) tooltip = DoubleToString(-AdditionalFunds, 2) + " " + TRANSLATION_TOOLTIP_ACCOUNT_SIZE_ASTERISK_SUB; ObjectSetString(ChartID(), m_name + "m_LblAdditionalFundsAsterisk", OBJPROP_TOOLTIP, tooltip); } @@ -1440,21 +1492,21 @@ bool CPositionSizeCalculator::DisplayValues() /* Lines */ if (sets.ShowLines) { - if (!m_BtnLines.Text("Hide lines")) return false; + if (!m_BtnLines.Text(TRANSLATION_BUTTON_HIDE_LINES)) return false; } else { - if (!m_BtnLines.Text("Show lines")) return false; + if (!m_BtnLines.Text(TRANSLATION_BUTTON_SHOW_LINES)) return false; } //=== ATR SL and TP if (ShowATROptions) { double atr = iATR(_Symbol, sets.ATRTimeframe, sets.ATRPeriod, ATRCandle); - m_LblATRValue.Text("ATR = " + DoubleToString(atr, _Digits)); + m_LblATRValue.Text(TRANSLATION_LABEL_ATR_VALUE + " = " + DoubleToString(atr, _Digits)); } //=== Commission, risk, position size /* Commission size*/ m_EdtCommissionSize.Text(DoubleToString(sets.CommissionPerLot, CommissionDecimals)); - /* Risk currency */ if (acc_currency != "") if (!m_LblRiskM.Text("Risk, " + acc_currency + ":")) return false; + /* Risk currency */ if (acc_currency != "") if (!m_LblRiskM.Text(TRANSLATION_LABEL_RISK + ", " + acc_currency + ":")) return false; /* Risk In */ if (!m_EdtRiskPIn.Text(FormatDouble(DoubleToString(DisplayRisk, 2)))) return false; /* Risk Money In */ if (!m_EdtRiskMIn.Text(FormatDouble(DoubleToString(RiskMoney, 2)))) return false; /* Risk Money Out */ if (!m_EdtRiskMRes.Text(FormatDouble(DoubleToString(OutputRiskMoney)))) return false; @@ -1468,11 +1520,11 @@ bool CPositionSizeCalculator::DisplayValues() } else if (!m_EdtRiskPRes.Text("0")) return false; - /* Reward currency*/ if (acc_currency != "") if (!m_LblReward.Text("Reward, " + acc_currency + ":")) return false; + /* Reward currency*/ if (acc_currency != "") if (!m_LblReward.Text(TRANSLATION_LABEL_REWARD + ", " + acc_currency + ":")) return false; /* Reward 1 */ if (!m_EdtReward1.Text(FormatDouble(InputReward))) return false; /* Reward 2 */ if (!m_EdtReward2.Text(FormatDouble(DoubleToString(OutputReward, 2)))) return false; /* Risk/Reward 1 */ if (!m_EdtRR1.Text(InputRR)) return false; - if (InputRR == "Invalid TP") m_EdtRR1.Color(clrRed); + if (InputRR == TRANSLATION_LABEL_WARNING_INVALID_TP) m_EdtRR1.Color(clrRed); else m_EdtRR1.Color(m_EdtTP.Color()); if (StringToDouble(m_EdtTP.Text()) != 0) { @@ -1480,31 +1532,31 @@ bool CPositionSizeCalculator::DisplayValues() else if (m_EdtRR2.IsVisible()) m_EdtRR1.Show(); } /* Risk/Reward 2 */ if (!m_EdtRR2.Text(OutputRR)) return false; - if (OutputRR == "Invalid TP") m_EdtRR2.Color(clrRed); + if (OutputRR == TRANSLATION_LABEL_WARNING_INVALID_TP) m_EdtRR2.Color(clrRed); else m_EdtRR2.Color(m_EdtTP.Color()); /* Position size */ if (!m_EdtPosSize.Text(FormatDouble(DoubleToString(OutputPositionSize, LotStep_digits), LotStep_digits))) return false; if (OutputPositionSize > OutputMaxPositionSize) { m_EdtPosSize.Color(clrRed); // Calculated position size is greater than maximum position size by margin. - ObjectSetString(ChartID(), m_name + "m_EdtPosSize", OBJPROP_TOOLTIP, "Greater than maximum position size by margin!"); + ObjectSetString(ChartID(), m_name + "m_EdtPosSize", OBJPROP_TOOLTIP, TRANSLATION_TOOLTIP_WARNING_PS); } else { m_EdtPosSize.Color(m_EdtTP.Color()); - ObjectSetString(ChartID(), m_name + "m_EdtPosSize", OBJPROP_TOOLTIP, "In lots"); + ObjectSetString(ChartID(), m_name + "m_EdtPosSize", OBJPROP_TOOLTIP, TRANSLATION_TOOLTIP_MAX_PS_BY_MARGIN); } /* Point value */ if (ShowPointValue) { - if (acc_currency != "") if (!m_LblPointValue.Text("Point value, " + acc_currency + ":")) return false; + if (acc_currency != "") if (!m_LblPointValue.Text(TRANSLATION_LABEL_POINT_VALUE + ", " + acc_currency + ":")) return false; if (!m_EdtPointValue.Text(OutputPointValue)) return false; } //=== Portfolio Risk /* Money label */ if (acc_currency != "") { - if (!m_LblCurrentRiskMoney.Text("Risk " + acc_currency)) return false; - if (!m_LblCurrentProfitMoney.Text("Reward " + acc_currency)) return false; - if (!m_LblPotentialRiskMoney.Text("Risk " + acc_currency)) return false; - if (!m_LblPotentialProfitMoney.Text("Reward " + acc_currency)) return false; + if (!m_LblCurrentRiskMoney.Text(TRANSLATION_LABEL_RISK + " " + acc_currency)) return false; + if (!m_LblCurrentProfitMoney.Text(TRANSLATION_LABEL_REWARD + " " + acc_currency)) return false; + if (!m_LblPotentialRiskMoney.Text(TRANSLATION_LABEL_RISK + " " + acc_currency)) return false; + if (!m_LblPotentialProfitMoney.Text(TRANSLATION_LABEL_REWARD + " " + acc_currency)) return false; } /* Current Portfolio Risk $ */ if (!m_EdtCurRiskM.Text(PLM)) return false; /* Current Portfolio Risk % */ if (!m_EdtCurRiskP.Text(CPR)) return false; @@ -1525,8 +1577,8 @@ bool CPositionSizeCalculator::DisplayValues() /* Future Free Margin */ if (!m_EdtFreeMargin.Text(FormatDouble(DoubleToString(FutureMargin, 2)))) return false; /* Custom Leverage */ if (!m_EdtCustomLeverage.Text(DoubleToString(sets.CustomLeverage, CustomLeverageDecimals))) return false; string acc_lev = IntegerToString(AccountInfoInteger(ACCOUNT_LEVERAGE)); - /* Account Leverage */ if (acc_lev != "") if (!m_LblAccLeverage.Text("(Default = 1:" + acc_lev + ")")) return false; - /* Symbol Leverage */ if (SymbolLeverage) if (!m_LblSymbolLeverage.Text("(Symbol = 1:" + DoubleToString(SymbolLeverage, SymbolLeverageDecimals) + ")")) return false; + /* Account Leverage */ if (acc_lev != "") if (!m_LblAccLeverage.Text("(" + TRANSLATION_LABEL_DEFAULT + " = 1:" + acc_lev + ")")) return false; + /* Symbol Leverage */ if (SymbolLeverage) if (!m_LblSymbolLeverage.Text("(" + TRANSLATION_LABEL_SYMBOL + " = 1:" + DoubleToString(SymbolLeverage, SymbolLeverageDecimals) + ")")) return false; /* Max Position size */ if (!m_EdtMaxPositionSizeByMargin.Text(FormatDouble(DoubleToString(OutputMaxPositionSize, LotStep_digits), LotStep_digits))) return false; if (!StopOut) // Black @@ -1580,8 +1632,8 @@ bool CPositionSizeCalculator::DisplayValues() void CPositionSizeCalculator::Minimize() { - if (sets.TradeDirection == Short) PanelCaption = "Short | " + PanelCaptionBase; - else PanelCaption = "Long | " + PanelCaptionBase; + if (sets.TradeDirection == Short) PanelCaption = TRANSLATION_BUTTON_SHORT + " | " + PanelCaptionBase; + else PanelCaption = TRANSLATION_BUTTON_LONG + " | " + PanelCaptionBase; DisplayValues(); CAppDialog::Minimize(); sets.IsPanelMinimized = true; @@ -1596,8 +1648,8 @@ void CPositionSizeCalculator::Maximize() { if (!NoPanelMaximization) { - if (sets.TradeDirection == Short) PanelCaption = PanelCaptionBase + " Short"; - else PanelCaption = PanelCaptionBase + " Long"; + if (sets.TradeDirection == Short) PanelCaption = PanelCaptionBase + " " + TRANSLATION_BUTTON_SHORT; + else PanelCaption = PanelCaptionBase + " " + TRANSLATION_BUTTON_LONG; DisplayValues(); sets.IsPanelMinimized = false; CAppDialog::Maximize(); @@ -1634,6 +1686,12 @@ bool CPositionSizeCalculator::CreateOutsideButton(CButton &Btn, int X1, int Y1, if (!Btn.Text(Text)) return false; ObjectSetString(ChartID(), m_name + Name, OBJPROP_TOOLTIP, Tooltip); + // Used in the Strategy Tester visual mode to find this button's ID. + CStringForList *obj = new CStringForList; + obj.Name = Name; + obj.Obj = GetPointer(Btn); + PersistentList.Add(obj); + return true; } @@ -1650,33 +1708,33 @@ void CPositionSizeCalculator::MoveOutsideTradeButton() if (sets.TradeDirection == Short) { // Stop - if (sets.EntryLevel < Bid) order_type = "Sell Stop"; + if (sets.EntryLevel < Bid) order_type = TRANSLATION_MESSAGE_SELL_STOP; // Limit - else order_type = "Sell Limit"; + else order_type = TRANSLATION_MESSAGE_SELL_LIMIT; } // Buy else { // Stop - if (sets.EntryLevel > Ask) order_type = "Buy Stop"; + if (sets.EntryLevel > Ask) order_type = TRANSLATION_MESSAGE_BUY_STOP; // Limit - else order_type = "Buy Limit"; + else order_type = TRANSLATION_MESSAGE_BUY_LIMIT; } } // Instant else { // Sell - if (sets.TradeDirection == Short) order_type = "Sell Instant"; + if (sets.TradeDirection == Short) order_type = TRANSLATION_MESSAGE_SELL + " " + TRANSLATION_BUTTON_ORDER_TYPE_INSTANT; // Buy - else order_type = "Buy Instant"; + else order_type = TRANSLATION_MESSAGE_BUY + " " + TRANSLATION_BUTTON_ORDER_TYPE_INSTANT; } // If additional entry label is on, merge it with the button. string lots = ""; if (ShowAdditionalEntryLabel) { - lots = " - " + FormatDouble(DoubleToString(OutputPositionSize, LotStep_digits), LotStep_digits) + " lot"; + lots = " - " + FormatDouble(DoubleToString(OutputPositionSize, LotStep_digits), LotStep_digits); } m_OutsideTradeButton.Text(order_type + lots); @@ -1738,6 +1796,12 @@ void CPositionSizeCalculator::RefreshValues() } } + if (ShowATROptions) // Make sure ATR SL and TP multipliers get initialzied with non-zero values if default ones were zero. + { + if (sets.ATRMultiplierSL == 0) UpdateFixedSL(); + if ((sets.ATRMultiplierTP == 0) && (sets.TakeProfitLevel != 0)) UpdateFixedTP(); + } + double read_value; if ((sets.ATRMultiplierSL == 0) || (!ShowATROptions)) { @@ -1846,13 +1910,13 @@ void CPositionSizeCalculator::RefreshValues() if (m_minimized) { - if (sets.TradeDirection == Short) PanelCaption = "Short | " + PanelCaptionBase; - else PanelCaption = "Long | " + PanelCaptionBase; + if (sets.TradeDirection == Short) PanelCaption = TRANSLATION_BUTTON_SHORT + " | " + PanelCaptionBase; + else PanelCaption = TRANSLATION_BUTTON_LONG + " | " + PanelCaptionBase; } else { - if (sets.TradeDirection == Short) PanelCaption = PanelCaptionBase + " Short"; - else PanelCaption = PanelCaptionBase + " Long"; + if (sets.TradeDirection == Short) PanelCaption = PanelCaptionBase + " " + TRANSLATION_BUTTON_SHORT; + else PanelCaption = PanelCaptionBase + " " + TRANSLATION_BUTTON_LONG; } if (sets.TPLockedOnSL) @@ -2071,7 +2135,8 @@ void CPositionSizeCalculator::ProcessTPChange(const bool tp_button_click) // Profit = Risk * N + Commission * 2. // TP distance = (Risk * N + Commission * 2) / Point_value. if ((UnitCost_reward != 0) && (OutputPositionSize != 0) && (TickSize != 0)) - tp_distance = (RiskMoney * TP_Multiplier + OutputPositionSize * commission * 2) / (OutputPositionSize * UnitCost_reward / TickSize); + //tp_distance = (RiskMoney * TP_Multiplier + OutputPositionSize * commission * 2) / (OutputPositionSize * UnitCost_reward / TickSize); + tp_distance = (OutputRiskMoney * TP_Multiplier + OutputPositionSize * commission * 2) / (OutputPositionSize * UnitCost_reward / TickSize); if (tEntryLevel < tStopLossLevel) tp_distance = -tp_distance; } else tp_distance = (tEntryLevel - tStopLossLevel) * TP_Multiplier; @@ -2114,7 +2179,7 @@ void CPositionSizeCalculator::ProcessTPChange(const bool tp_button_click) ObjectSetInteger(ChartID(), ObjectPrefix + "TakeProfitLine", OBJPROP_STYLE, takeprofit_line_style); ObjectSetInteger(ChartID(), ObjectPrefix + "TakeProfitLine", OBJPROP_COLOR, takeprofit_line_color); ObjectSetInteger(ChartID(), ObjectPrefix + "TakeProfitLine", OBJPROP_WIDTH, takeprofit_line_width); - ObjectSetString(ChartID(), ObjectPrefix + "TakeProfitLine", OBJPROP_TOOLTIP, "Take-Profit"); + ObjectSetString(ChartID(), ObjectPrefix + "TakeProfitLine", OBJPROP_TOOLTIP, TRANSLATION_LABEL_TAKEPROFIT); // Create multiple TP lines. for (int i = 1; i < sets.TakeProfitsNumber; i++) @@ -2123,7 +2188,7 @@ void CPositionSizeCalculator::ProcessTPChange(const bool tp_button_click) ObjectSetInteger(ChartID(), ObjectPrefix + "TakeProfitLine" + IntegerToString(i), OBJPROP_STYLE, takeprofit_line_style); ObjectSetInteger(ChartID(), ObjectPrefix + "TakeProfitLine" + IntegerToString(i), OBJPROP_COLOR, takeprofit_line_color); ObjectSetInteger(ChartID(), ObjectPrefix + "TakeProfitLine" + IntegerToString(i), OBJPROP_WIDTH, takeprofit_line_width); - ObjectSetString(ChartID(), ObjectPrefix + "TakeProfitLine" + IntegerToString(i), OBJPROP_TOOLTIP, "Take-Profit #" + IntegerToString(i + 1)); + ObjectSetString(ChartID(), ObjectPrefix + "TakeProfitLine" + IntegerToString(i), OBJPROP_TOOLTIP, TRANSLATION_LABEL_TAKEPROFIT + " #" + IntegerToString(i + 1)); } } else @@ -2135,14 +2200,16 @@ void CPositionSizeCalculator::ProcessTPChange(const bool tp_button_click) ObjectSetDouble(ChartID(), ObjectPrefix + "TakeProfitLine" + IntegerToString(i), OBJPROP_PRICE, sets.TP[i]); } } - ObjectSetInteger(ChartID(), ObjectPrefix + "TakeProfitLine", OBJPROP_SELECTABLE, true); - if (DefaultLinesSelected) ObjectSetInteger(ChartID(), ObjectPrefix + "TakeProfitLine", OBJPROP_SELECTED, true); + if (!sets.TPLockedOnSL) + { + ObjectSetInteger(ChartID(), ObjectPrefix + "TakeProfitLine", OBJPROP_SELECTABLE, true); + if (DefaultLinesSelected) ObjectSetInteger(ChartID(), ObjectPrefix + "TakeProfitLine", OBJPROP_SELECTED, true); + } for (int i = 1; i < sets.TakeProfitsNumber; i++) { ObjectSetInteger(ChartID(), ObjectPrefix + "TakeProfitLine" + IntegerToString(i), OBJPROP_SELECTABLE, true); if (DefaultLinesSelected) ObjectSetInteger(ChartID(), ObjectPrefix + "TakeProfitLine" + IntegerToString(i), OBJPROP_SELECTED, true); } - if (StringToDouble(m_EdtTP.Text()) == 0) // Hide. { m_LblRR.Hide(); @@ -2199,8 +2266,11 @@ void CPositionSizeCalculator::ProcessTPChange(const bool tp_button_click) } } } - HideShowMaximize(); - MoveAndResize(); + if (tp_button_click) + { + HideShowMaximize(); + //MoveAndResize(); + } } // Need to call RefreshValues() only if this function is invoked from TP Button click event handler. In all other cases it is called from within RefreshValues() itself. if (tp_button_click) @@ -2317,7 +2387,11 @@ void CPositionSizeCalculator::OnClickBtnOrderType() m_BtnEntryIncrease.Show(); m_BtnEntryDecrease.Show(); } - if ((sets.ShowLines) && (ShowLineLabels)) ObjectSetInteger(ChartID(), ObjectPrefix + "EntryLabel", OBJPROP_TIMEFRAMES, OBJ_ALL_PERIODS); + if (sets.ShowLines) + { + ObjectSetInteger(ChartID(), ObjectPrefix + "EntryLine", OBJPROP_TIMEFRAMES, OBJ_ALL_PERIODS); + if (ShowLineLabels) ObjectSetInteger(ChartID(), ObjectPrefix + "EntryLabel", OBJPROP_TIMEFRAMES, OBJ_ALL_PERIODS); + } } RefreshValues(); @@ -2330,7 +2404,7 @@ void CPositionSizeCalculator::OnClickBtnAccount() case Balance: // Switch to Equity. sets.AccountButton = Equity; - m_BtnAccount.Text("Account equity"); + m_BtnAccount.Text(TRANSLATION_BUTTON_ACCOUNT_EQUITY); // Account balance uneditable. m_EdtAccount.ReadOnly(true); m_EdtAccount.ColorBackground(CONTROLS_EDIT_COLOR_DISABLE); @@ -2338,7 +2412,7 @@ void CPositionSizeCalculator::OnClickBtnAccount() case Equity: // Switch to Balance minus Risk. sets.AccountButton = Balance_minus_Risk; - m_BtnAccount.Text("Balance - CPR"); + m_BtnAccount.Text(TRANSLATION_BUTTON_BALANCE_MINUS_CPR); // Account balance uneditable. m_EdtAccount.ReadOnly(true); m_EdtAccount.ColorBackground(CONTROLS_EDIT_COLOR_DISABLE); @@ -2347,7 +2421,7 @@ void CPositionSizeCalculator::OnClickBtnAccount() case Balance_minus_Risk: // Switch to Balance. sets.AccountButton = Balance; - m_BtnAccount.Text("Account balance"); + m_BtnAccount.Text(TRANSLATION_BUTTON_ACCOUNT_BALANCE); // Account balance editable. m_EdtAccount.ReadOnly(false); m_EdtAccount.ColorBackground(CONTROLS_EDIT_COLOR_ENABLE); @@ -2361,11 +2435,11 @@ void CPositionSizeCalculator::OnClickBtnLines() sets.ShowLines = !sets.ShowLines; if (sets.ShowLines) { - m_BtnLines.Text("Hide lines"); + m_BtnLines.Text(TRANSLATION_BUTTON_HIDE_LINES); } else { - m_BtnLines.Text("Show lines"); + m_BtnLines.Text(TRANSLATION_BUTTON_SHOW_LINES); } if (sets.ShowLines) { @@ -2459,7 +2533,7 @@ void CPositionSizeCalculator::OnClickBtnLines() void CPositionSizeCalculator::OnClickButtonClose() { - if ((!AskBeforeClosing) || (MessageBox("Are you sure you want to close the Position Sizer?", "Exit?", MB_YESNO) == IDYES)) + if ((!AskBeforeClosing) || (MessageBox(TRANSLATION_MESSAGE_ARE_YOU_SURE, TRANSLATION_MESSAGE_EXIT, MB_YESNO) == IDYES)) { CAppDialog::OnClickButtonClose(); } @@ -2493,6 +2567,8 @@ void CPositionSizeCalculator::OnClickBtnTakeProfit() { m_BtnTakeProfit.ColorBackground(CONTROLS_BUTTON_COLOR_TP_UNLOCKED); sets.TPLockedOnSL = false; + ObjectSetInteger(ChartID(), ObjectPrefix + "TakeProfitLine", OBJPROP_SELECTABLE, true); + ObjectSetInteger(ChartID(), ObjectPrefix + "TakeProfitLine", OBJPROP_SELECTED, sets.WasSelectedTakeProfitLine); return; } // If already have some take-profit, switch to a locked mode - TP always follows SL when Entry-SL difference changes. @@ -2500,6 +2576,9 @@ void CPositionSizeCalculator::OnClickBtnTakeProfit() { sets.TPLockedOnSL = true; m_BtnTakeProfit.ColorBackground(CONTROLS_BUTTON_COLOR_TP_LOCKED); + sets.WasSelectedTakeProfitLine = ObjectGetInteger(ChartID(), ObjectPrefix + "TakeProfitLine", OBJPROP_SELECTED); + ObjectSetInteger(ChartID(), ObjectPrefix + "TakeProfitLine", OBJPROP_SELECTED, false); + ObjectSetInteger(ChartID(), ObjectPrefix + "TakeProfitLine", OBJPROP_SELECTABLE, false); } ProcessTPChange(true); @@ -2652,7 +2731,7 @@ void CPositionSizeCalculator::OnClickBtnATRTimeframe() break; } if (sets.ATRTimeframe != PERIOD_CURRENT) m_BtnATRTimeframe.Text(EnumToString(sets.ATRTimeframe)); - else m_BtnATRTimeframe.Text("CURRENT"); + else m_BtnATRTimeframe.Text(TRANSLATION_BUTTON_ATR_PERIOD_CURRENT); RefreshValues(); } @@ -3075,12 +3154,12 @@ void CPositionSizeCalculator::OnClickBtnTakeProfitsNumberAdd() ArrayResize(TradingTPEdits, sets.TakeProfitsNumber); ArrayResize(TradingTPShareEdits, sets.TakeProfitsNumber); } - string additional_tp_label_beginning = "Take-profit "; + string additional_tp_label_beginning = TRANSLATION_LABEL_TAKEPROFIT + " "; string additional_tp_label_end = ":"; if (sets.TPDistanceInPoints) { - additional_tp_label_beginning = "TP "; - additional_tp_label_end = ", points:"; + additional_tp_label_beginning = TRANSLATION_LABEL_TAKEPROFIT_MULTIPLE_DISTANCE + " "; + additional_tp_label_end = ", " + TRANSLATION_LABEL_TAKEPROFIT_MULTIPLE_POINTS + ":"; } if (ArraySize(sets.TP) < sets.TakeProfitsNumber) // Resize only if required. Sometimes, when switching symbols, this won't be required. { @@ -3149,7 +3228,7 @@ void CPositionSizeCalculator::OnClickBtnTakeProfitsNumberAdd() // And it is added for the first time, create the Remove button: if (MaxTakeProfitsNumber == 1) { - ButtonCreate(MainTabList, m_BtnTakeProfitsNumberRemove, first_column_start, y, first_column_start + v_spacing * 4 - 1, y + element_height, name, "x", "Remove Take-profit"); + ButtonCreate(MainTabList, m_BtnTakeProfitsNumberRemove, first_column_start, y, first_column_start + v_spacing * 4 - 1, y + element_height, name, "x", TRANSLATION_TOOLTIP_TAKEPROFIT_REMOVE); if (DarkMode) { m_BtnTakeProfitsNumberRemove.ColorBackground(DARKMODE_BUTTON_BG_COLOR); @@ -3187,7 +3266,7 @@ void CPositionSizeCalculator::OnClickBtnTakeProfitsNumberAdd() MainTabList.MoveListElementByName(name, index + 1); name = "m_BtnAdditionalTPButtonsIncrease" + IntegerToString(i + 2); - ButtonCreate(MainTabList, AdditionalTPButtonsIncrease[i], second_column_start + normal_edit_width + 1, y, second_column_start + normal_edit_width + v_spacing * 4, y + element_height / 2, name, "+", "Increase Take-profit #" + IntegerToString(i + 2) + " by 1 point"); + ButtonCreate(MainTabList, AdditionalTPButtonsIncrease[i], second_column_start + normal_edit_width + 1, y, second_column_start + normal_edit_width + v_spacing * 4, y + element_height / 2, name, "+", TRANSLATION_TOOLTIP_TAKEPROFIT_INCREASE_MULTIPLE + " #" + IntegerToString(i + 2) + " " + TRANSLATION_TOOLTIP_TAKEPROFIT_BY_ONE_POINT); if (DarkMode) { AdditionalTPButtonsIncrease[i].ColorBackground(DARKMODE_BUTTON_BG_COLOR); @@ -3196,7 +3275,7 @@ void CPositionSizeCalculator::OnClickBtnTakeProfitsNumberAdd() MainTabList.MoveListElementByName(name, index + 2); name = "m_BtnAdditionalTPButtonsDecrease" + IntegerToString(i + 2); - ButtonCreate(MainTabList, AdditionalTPButtonsDecrease[i], second_column_start + normal_edit_width + 1, y + element_height / 2, second_column_start + normal_edit_width + v_spacing * 4, y + element_height, name, "-", "Decrease Take-profit #" + IntegerToString(i + 2) + " by 1 point"); + ButtonCreate(MainTabList, AdditionalTPButtonsDecrease[i], second_column_start + normal_edit_width + 1, y + element_height / 2, second_column_start + normal_edit_width + v_spacing * 4, y + element_height, name, "-", TRANSLATION_TOOLTIP_TAKEPROFIT_DECREASE_MULTIPLE + " #" + IntegerToString(i + 2) + " " + TRANSLATION_TOOLTIP_TAKEPROFIT_BY_ONE_POINT); if (DarkMode) { AdditionalTPButtonsDecrease[i].ColorBackground(DARKMODE_BUTTON_BG_COLOR); @@ -3248,7 +3327,7 @@ void CPositionSizeCalculator::OnClickBtnTakeProfitsNumberAdd() if (MaxTakeProfitsNumber == 1) { name = "m_LblTradingTP"; - LabelCreate(TradingTabList, m_LblTradingTP, multi_tp_column_start, y, multi_tp_column_start + multi_tp_label_width, y + element_height, name, "TP"); + LabelCreate(TradingTabList, m_LblTradingTP, multi_tp_column_start, y, multi_tp_column_start + multi_tp_label_width, y + element_height, name, TRANSLATION_LABEL_TAKEPROFIT_MULTIPLE_DISTANCE); if (DarkMode) { m_LblTradingTP.Color(DARKMODE_TEXT_COLOR); @@ -3256,7 +3335,7 @@ void CPositionSizeCalculator::OnClickBtnTakeProfitsNumberAdd() TradingTabList.MoveListElementByName(name, index); name = "m_BtnTPsInward"; - ButtonCreate(TradingTabList, m_BtnTPsInward, multi_tp_button_start, y, multi_tp_button_start + leverage_edit_width, y + element_height, name, "<<", "Fill additional TPs equidistantly between Entry and Main TP."); + ButtonCreate(TradingTabList, m_BtnTPsInward, multi_tp_button_start, y, multi_tp_button_start + leverage_edit_width, y + element_height, name, "<<", TRANSLATION_TOOLTIP_FILL_INWARD); if (DarkMode) { m_BtnTPsInward.ColorBackground(DARKMODE_BUTTON_BG_COLOR); @@ -3265,7 +3344,7 @@ void CPositionSizeCalculator::OnClickBtnTakeProfitsNumberAdd() TradingTabList.MoveListElementByName(name, index + 1); name = "m_BtnTPsOutward"; - ButtonCreate(TradingTabList, m_BtnTPsOutward, multi_tp_button_start + leverage_edit_width + v_spacing, y, multi_tp_button_start + 2 * leverage_edit_width + v_spacing, y + element_height, name, ">>", "Place additional TPs beyond the Main TP using the same distance."); + ButtonCreate(TradingTabList, m_BtnTPsOutward, multi_tp_button_start + leverage_edit_width + v_spacing, y, multi_tp_button_start + 2 * leverage_edit_width + v_spacing, y + element_height, name, ">>", TRANSLATION_TOOLTIP_FILL_OUTWARD); if (DarkMode) { m_BtnTPsOutward.ColorBackground(DARKMODE_BUTTON_BG_COLOR); @@ -3274,7 +3353,7 @@ void CPositionSizeCalculator::OnClickBtnTakeProfitsNumberAdd() TradingTabList.MoveListElementByName(name, index + 2); name = "m_BtnTradingTPShare"; - ButtonCreate(TradingTabList, m_BtnTradingTPShare, third_trading_column_start, y, third_trading_column_start + normal_edit_width, y + element_height, name, "Share, %", "Automatically fill the volume shares"); + ButtonCreate(TradingTabList, m_BtnTradingTPShare, third_trading_column_start, y, third_trading_column_start + normal_edit_width, y + element_height, name, TRANSLATION_LABEL_SHARE + ", %", TRANSLATION_TOOLTIP_SHARE); if (DarkMode) { m_BtnTradingTPShare.ColorBackground(DARKMODE_BUTTON_BG_COLOR); @@ -3288,7 +3367,7 @@ void CPositionSizeCalculator::OnClickBtnTakeProfitsNumberAdd() // First (main) TP: name = "m_LblTradingTPLabel1"; - LabelCreate(TradingTabList, TradingTPLabels[0], first_column_start, y, first_column_start + normal_label_width, y + element_height, name, "Take-profit 1"); + LabelCreate(TradingTabList, TradingTPLabels[0], first_column_start, y, first_column_start + normal_label_width, y + element_height, name, TRANSLATION_LABEL_TAKEPROFIT + " 1"); if (DarkMode) { TradingTPLabels[0].Color(DARKMODE_TEXT_COLOR); @@ -3338,7 +3417,7 @@ void CPositionSizeCalculator::OnClickBtnTakeProfitsNumberAdd() if (MaxTakeProfitsNumber < sets.TakeProfitsNumber) { name = "m_LblTradingTPLabel" + IntegerToString(sets.TakeProfitsNumber); - LabelCreate(TradingTabList, TradingTPLabels[sets.TakeProfitsNumber - 1], first_column_start, y, first_column_start + normal_label_width, y + element_height, name, "Take-profit " + IntegerToString(sets.TakeProfitsNumber)); + LabelCreate(TradingTabList, TradingTPLabels[sets.TakeProfitsNumber - 1], first_column_start, y, first_column_start + normal_label_width, y + element_height, name, TRANSLATION_LABEL_TAKEPROFIT + " " + IntegerToString(sets.TakeProfitsNumber)); if (DarkMode) { TradingTPLabels[sets.TakeProfitsNumber - 1].Color(DARKMODE_TEXT_COLOR); @@ -3574,7 +3653,7 @@ void CPositionSizeCalculator::OnEndEditEdtSL() { if ((int)StringToInteger(m_EdtSL.Text()) <= 0) { - Print("StopLoss should be positive."); + Print(TRANSLATION_MESSAGE_SL_SHOULD_BE_POSITIVE); m_EdtSL.Text(IntegerToString(sets.StopLoss)); } else @@ -3653,7 +3732,7 @@ void CPositionSizeCalculator::OnEndEditEdtTP() ObjectSetInteger(ChartID(), ObjectPrefix + "TakeProfitLine", OBJPROP_STYLE, takeprofit_line_style); ObjectSetInteger(ChartID(), ObjectPrefix + "TakeProfitLine", OBJPROP_COLOR, takeprofit_line_color); ObjectSetInteger(ChartID(), ObjectPrefix + "TakeProfitLine", OBJPROP_WIDTH, takeprofit_line_width); - ObjectSetString(ChartID(), ObjectPrefix + "TakeProfitLine", OBJPROP_TOOLTIP, "Take-Profit"); + ObjectSetString(ChartID(), ObjectPrefix + "TakeProfitLine", OBJPROP_TOOLTIP, TRANSLATION_LABEL_TAKEPROFIT); // Create multiple TP lines. for (int i = 1; i < sets.TakeProfitsNumber; i++) { @@ -3661,7 +3740,7 @@ void CPositionSizeCalculator::OnEndEditEdtTP() ObjectSetInteger(ChartID(), ObjectPrefix + "TakeProfitLine" + IntegerToString(i), OBJPROP_STYLE, takeprofit_line_style); ObjectSetInteger(ChartID(), ObjectPrefix + "TakeProfitLine" + IntegerToString(i), OBJPROP_COLOR, takeprofit_line_color); ObjectSetInteger(ChartID(), ObjectPrefix + "TakeProfitLine" + IntegerToString(i), OBJPROP_WIDTH, takeprofit_line_width); - ObjectSetString(ChartID(), ObjectPrefix + "TakeProfitLine" + IntegerToString(i), OBJPROP_TOOLTIP, "Take-Profit #" + IntegerToString(i + 1)); + ObjectSetString(ChartID(), ObjectPrefix + "TakeProfitLine" + IntegerToString(i), OBJPROP_TOOLTIP, TRANSLATION_LABEL_TAKEPROFIT + " #" + IntegerToString(i + 1)); } } else @@ -3736,8 +3815,12 @@ void CPositionSizeCalculator::OnEndEditEdtTP() } if (ShowATROptions) // Update ATR multiplier after the line was moved by the user. { - double atr = iATR(_Symbol, sets.ATRTimeframe, sets.ATRPeriod, ATRCandle); - if (atr != 0) sets.ATRMultiplierTP = MathAbs(sets.TakeProfitLevel - sets.EntryLevel) / atr; + if (sets.TakeProfitLevel == 0) sets.ATRMultiplierTP = 0; + else + { + double atr = iATR(_Symbol, sets.ATRTimeframe, sets.ATRPeriod, ATRCandle); + if (atr != 0) sets.ATRMultiplierTP = MathAbs(sets.TakeProfitLevel - sets.EntryLevel) / atr; + } m_EdtATRMultiplierTP.Text(DoubleToString(sets.ATRMultiplierTP, 2)); // Untick spread adjustment checkbox as TP was set explicitly: m_ChkSpreadAdjustmentTP.Checked(false); @@ -3967,14 +4050,27 @@ void CPositionSizeCalculator::OnChangeChkIgnoreOrdersWithoutTP() } } -void CPositionSizeCalculator::OnChangeChkIgnoreOtherSymbols() +void CPositionSizeCalculator::OnClickBtnIgnoreSymbols() { - if (sets.IgnoreOtherSymbols != m_ChkIgnoreOtherSymbols.Checked()) + // Switch to the next value. + switch(sets.IgnoreSymbols) { - sets.IgnoreOtherSymbols = m_ChkIgnoreOtherSymbols.Checked(); - CalculatePortfolioRisk(); - DisplayValues(); + default: + case IGNORE_SYMBOLS_NONE: + sets.IgnoreSymbols = IGNORE_SYMBOLS_OTHER; + m_BtnIgnoreSymbols.Text(TRANSLATION_BUTTON_SYMBOLS_OTHER); + break; + case IGNORE_SYMBOLS_OTHER: + sets.IgnoreSymbols = IGNORE_SYMBOLS_CURRENT; + m_BtnIgnoreSymbols.Text(TRANSLATION_BUTTON_SYMBOLS_CURRENT); + break; + case IGNORE_SYMBOLS_CURRENT: + sets.IgnoreSymbols = IGNORE_SYMBOLS_NONE; + m_BtnIgnoreSymbols.Text(TRANSLATION_BUTTON_SYMBOLS_NO); + break; } + CalculatePortfolioRisk(); + DisplayValues(); } void CPositionSizeCalculator::OnEndEditEdtCustomLeverage() @@ -4030,6 +4126,11 @@ void CPositionSizeCalculator::OnEndEditEdtMinEntrySLDistance() sets.MinEntrySLDistance = (int)StringToInteger(m_EdtMinEntrySLDistance.Text()); } +void CPositionSizeCalculator::OnEndEditEdtMaxRiskPercentage() +{ + sets.MaxRiskPercentage = (double)StringToDouble(m_EdtMaxRiskPercentage.Text()); +} + void CPositionSizeCalculator::OnEndEditEdtMaxPositionSizeTotal() { string s = m_EdtMaxPositionSizeTotal.Text(); @@ -4134,7 +4235,7 @@ void CPositionSizeCalculator::OnEndEditEdtExpiry() if ((sets.ExpiryMinutes != 0) && (sets.ExpiryMinutes < 10)) { sets.ExpiryMinutes = 0; - Print("Minimum expiry duration is 10 minutes."); + Print(TRANSLATION_MESSAGE_MINIMUM_EXPIRY); } m_EdtExpiry.Text(IntegerToString(sets.ExpiryMinutes)); } @@ -4144,14 +4245,14 @@ void CPositionSizeCalculator::OnEndEditEdtExpiry() //|+----------------------+ bool CPositionSizeCalculator::SaveSettingsOnDisk(string symbol = "") { - Print("Trying to save settings to file: " + m_FileName + "."); + Print(TRANSLATION_MESSAGE_TRYING_TO_SAVE_FILE + ": " + m_FileName + "."); int fh; // Save to new format only. fh = FileOpen("PS_Settings\\" + m_FileName, FILE_CSV | FILE_WRITE); if (fh == INVALID_HANDLE) { - Print("Failed to open file for writing: PS_Settings\\" + m_FileName + ". Error: " + IntegerToString(GetLastError())); + Print(TRANSLATION_MESSAGE_FAILED_TO_OPEN_FOR_WRITING + ": PS_Settings\\" + m_FileName + ". " + TRANSLATION_MESSAGE_ERROR + ": " + IntegerToString(GetLastError())); return false; } @@ -4199,8 +4300,8 @@ bool CPositionSizeCalculator::SaveSettingsOnDisk(string symbol = "") FileWrite(fh, IntegerToString(sets.IgnoreOrdersWithoutSL)); FileWrite(fh, "IgnoreOrdersWithoutTP"); FileWrite(fh, IntegerToString(sets.IgnoreOrdersWithoutTP)); - FileWrite(fh, "IgnoreOtherSymbols"); - FileWrite(fh, IntegerToString(sets.IgnoreOtherSymbols)); + FileWrite(fh, "IgnoreSymbols"); + FileWrite(fh, IntegerToString(sets.IgnoreSymbols)); FileWrite(fh, "ShowLines"); FileWrite(fh, IntegerToString(sets.ShowLines)); FileWrite(fh, "SelectedTab"); @@ -4232,6 +4333,8 @@ bool CPositionSizeCalculator::SaveSettingsOnDisk(string symbol = "") FileWrite(fh, IntegerToString(sets.MaxEntrySLDistance)); FileWrite(fh, "MinEntrySLDistance"); FileWrite(fh, IntegerToString(sets.MinEntrySLDistance)); + FileWrite(fh, "MaxRiskPercentage"); + FileWrite(fh, DoubleToString(sets.MaxRiskPercentage)); FileWrite(fh, "SLDistanceInPoints"); FileWrite(fh, IntegerToString(sets.SLDistanceInPoints)); FileWrite(fh, "TPDistanceInPoints"); @@ -4356,8 +4459,8 @@ bool CPositionSizeCalculator::SaveSettingsOnDisk(string symbol = "") FileWrite(fh, IntegerToString(DefaultIgnoreOrdersWithoutSL)); FileWrite(fh, "Parameter_DefaultIgnoreOrdersWithoutTP"); FileWrite(fh, IntegerToString(DefaultIgnoreOrdersWithoutTP)); - FileWrite(fh, "Parameter_DefaultIgnoreOtherSymbols"); - FileWrite(fh, IntegerToString(DefaultIgnoreOtherSymbols)); + FileWrite(fh, "Parameter_DefaultIgnoreSymbols"); + FileWrite(fh, IntegerToString(DefaultIgnoreSymbols)); FileWrite(fh, "Parameter_DefaultCustomLeverage"); FileWrite(fh, DoubleToString(DefaultCustomLeverage)); FileWrite(fh, "Parameter_DefaultMagicNumber"); @@ -4376,6 +4479,8 @@ bool CPositionSizeCalculator::SaveSettingsOnDisk(string symbol = "") FileWrite(fh, IntegerToString(DefaultMaxEntrySLDistance)); FileWrite(fh, "Parameter_DefaultMinEntrySLDistance"); FileWrite(fh, IntegerToString(DefaultMinEntrySLDistance)); + FileWrite(fh, "Parameter_DefaultMaxRiskPercentage"); + FileWrite(fh, DoubleToString(DefaultMaxRiskPercentage)); FileWrite(fh, "Parameter_DefaultMaxPositionSizeTotal"); FileWrite(fh, DoubleToString(DefaultMaxPositionSizeTotal, LotStep_digits)); FileWrite(fh, "Parameter_DefaultMaxPositionSizePerSymbol"); @@ -4426,13 +4531,13 @@ bool CPositionSizeCalculator::SaveSettingsOnDisk(string symbol = "") FileClose(fh); - Print("Saved settings successfully."); + Print(TRANSLATION_MESSAGE_SAVED_SETTINGS); return true; } bool CPositionSizeCalculator::LoadSettingsFromDisk() { - Print("Trying to load settings from file."); + Print(TRANSLATION_MESSAGE_TRYING_TO_LOAD_FILE); int fh; @@ -4441,7 +4546,7 @@ bool CPositionSizeCalculator::LoadSettingsFromDisk() fh = FileOpen("PS_Settings\\" + m_FileName, FILE_CSV | FILE_READ); if (fh == INVALID_HANDLE) { - Print("Failed to open file for reading: PS_Settings\\" + m_FileName + ". Error: " + IntegerToString(GetLastError())); + Print(TRANSLATION_MESSAGE_FAILED_TO_OPEN_FOR_READING + ": PS_Settings\\" + m_FileName + ". " + TRANSLATION_MESSAGE_ERROR + ": " + IntegerToString(GetLastError())); return false; } } @@ -4449,13 +4554,13 @@ bool CPositionSizeCalculator::LoadSettingsFromDisk() { if (!FileIsExist("PS_" + m_FileName)) { - Print("No settings file to load."); + Print(TRANSLATION_MESSAGE_NO_SETTINGS_FILE_TO_LOAD); return false; } fh = FileOpen("PS_" + m_FileName, FILE_CSV | FILE_READ); if (fh == INVALID_HANDLE) { - Print("Failed to open file for reading: PS_" + m_FileName + ". Error: " + IntegerToString(GetLastError())); + Print(TRANSLATION_MESSAGE_FAILED_TO_OPEN_FOR_READING + ": PS_" + m_FileName + ". " + TRANSLATION_MESSAGE_ERROR + ": " + IntegerToString(GetLastError())); return false; } } @@ -4514,8 +4619,8 @@ bool CPositionSizeCalculator::LoadSettingsFromDisk() sets.IgnoreOrdersWithoutSL = (bool)StringToInteger(var_content); else if (var_name == "IgnoreOrdersWithoutTP") sets.IgnoreOrdersWithoutTP = (bool)StringToInteger(var_content); - else if (var_name == "IgnoreOtherSymbols") - sets.IgnoreOtherSymbols = (bool)StringToInteger(var_content); + else if (var_name == "IgnoreSymbols") + sets.IgnoreSymbols = (IGNORE_SYMBOLS)StringToInteger(var_content); else if (var_name == "ShowLines") sets.ShowLines = (bool)StringToInteger(var_content); else if (var_name == "SelectedTab") @@ -4572,6 +4677,8 @@ bool CPositionSizeCalculator::LoadSettingsFromDisk() sets.MaxEntrySLDistance = (int)StringToInteger(var_content); else if (var_name == "MinEntrySLDistance") sets.MinEntrySLDistance = (int)StringToInteger(var_content); + else if (var_name == "MaxRiskPercentage") + sets.MaxRiskPercentage = StringToDouble(var_content); else if (var_name == "TradeDirection") sets.TradeDirection = (TRADE_DIRECTION)StringToInteger(var_content); else if (var_name == "SLDistanceInPoints") @@ -4744,9 +4851,9 @@ bool CPositionSizeCalculator::LoadSettingsFromDisk() { if ((bool)StringToInteger(var_content) != DefaultIgnoreOrdersWithoutTP) sets.IgnoreOrdersWithoutTP = DefaultIgnoreOrdersWithoutTP; } - else if (var_name == "Parameter_DefaultIgnoreOtherSymbols") + else if (var_name == "Parameter_DefaultIgnoreSymbols") { - if ((bool)StringToInteger(var_content) != DefaultIgnoreOtherSymbols) sets.IgnoreOtherSymbols = DefaultIgnoreOtherSymbols; + if ((IGNORE_SYMBOLS)StringToInteger(var_content) != DefaultIgnoreSymbols) sets.IgnoreSymbols = DefaultIgnoreSymbols; } else if (var_name == "Parameter_DefaultCustomLeverage") { @@ -4784,6 +4891,10 @@ bool CPositionSizeCalculator::LoadSettingsFromDisk() { if (StringToInteger(var_content) != DefaultMinEntrySLDistance) sets.MinEntrySLDistance = DefaultMinEntrySLDistance; } + else if (var_name == "Parameter_DefaultMaxRiskPercentage") + { + if (StringToDouble(var_content) != DefaultMaxRiskPercentage) sets.MaxRiskPercentage = DefaultMaxRiskPercentage; + } else if (var_name == "Parameter_DefaultMaxPositionSizeTotal") { if (StringToDouble(var_content) != DefaultMaxPositionSizeTotal) sets.MaxPositionSizeTotal = DefaultMaxPositionSizeTotal; @@ -4910,7 +5021,7 @@ bool CPositionSizeCalculator::LoadSettingsFromDisk() if ((sets.MaxRiskTotal < sets.MaxRiskPerSymbol) && (sets.MaxRiskTotal != 0)) sets.MaxRiskTotal = sets.MaxRiskPerSymbol; FileClose(fh); - Print("Loaded settings successfully."); + Print(TRANSLATION_MESSAGE_LOADED_SETTINGS); // Is expert advisor reloading due to the input parameters change? Delete the flag variable. if (GlobalVariableGet("PS-" + IntegerToString(ChartID()) + "-Parameters") > 0) GlobalVariableDel("PS-" + IntegerToString(ChartID()) + "-Parameters"); @@ -4927,16 +5038,16 @@ bool CPositionSizeCalculator::DeleteSettingsFile() } if (!FileIsExist(fn_with_path)) { - Print("No settings file to delete."); + Print(TRANSLATION_MESSAGE_NO_SETTINGS_FILE_TO_DELETE); return false; } - Print("Trying to delete settings file."); + Print(TRANSLATION_MESSAGE_TRYING_TO_DELETE_FILE); if (!FileDelete(fn_with_path)) { - Print("Failed to delete file: " + fn_with_path + ". Error: " + IntegerToString(GetLastError())); + Print(TRANSLATION_MESSAGE_FAILED_TO_DELETE_FILE + ": " + m_FileName + ". " + TRANSLATION_MESSAGE_ERROR + ": " + IntegerToString(GetLastError())); return false; } - Print("Deleted settings file successfully."); + Print(TRANSLATION_MESSAGE_DELETED_SETTINGS); return true; } @@ -5244,7 +5355,7 @@ void CPositionSizeCalculator::CheckAndRestoreLines() ObjectSetInteger(ChartID(), ObjectPrefix + "EntryLine", OBJPROP_STYLE, entry_line_style); ObjectSetInteger(ChartID(), ObjectPrefix + "EntryLine", OBJPROP_COLOR, entry_line_color); ObjectSetInteger(ChartID(), ObjectPrefix + "EntryLine", OBJPROP_WIDTH, entry_line_width); - ObjectSetString(ChartID(), ObjectPrefix + "EntryLine", OBJPROP_TOOLTIP, "Entry"); + ObjectSetString(ChartID(), ObjectPrefix + "EntryLine", OBJPROP_TOOLTIP, TRANSLATION_LABEL_ENTRY); if (sets.EntryType == Instant) { ObjectSetInteger(ChartID(), ObjectPrefix + "EntryLine", OBJPROP_SELECTABLE, false); @@ -5266,7 +5377,7 @@ void CPositionSizeCalculator::CheckAndRestoreLines() ObjectSetInteger(ChartID(), ObjectPrefix + "StopLossLine", OBJPROP_COLOR, stoploss_line_color); ObjectSetInteger(ChartID(), ObjectPrefix + "StopLossLine", OBJPROP_WIDTH, stoploss_line_width); ObjectSetInteger(ChartID(), ObjectPrefix + "StopLossLine", OBJPROP_SELECTABLE, true); - ObjectSetString(ChartID(), ObjectPrefix + "StopLossLine", OBJPROP_TOOLTIP, "Stop-Loss"); + ObjectSetString(ChartID(), ObjectPrefix + "StopLossLine", OBJPROP_TOOLTIP, TRANSLATION_LABEL_STOPLOSS); if (DefaultLinesSelected) ObjectSetInteger(ChartID(), ObjectPrefix + "StopLossLine", OBJPROP_SELECTED, true); if (!sets.ShowLines) ObjectSetInteger(ChartID(), ObjectPrefix + "StopLossLine", OBJPROP_TIMEFRAMES, OBJ_NO_PERIODS); RestoredSomething = true; @@ -5281,7 +5392,7 @@ void CPositionSizeCalculator::CheckAndRestoreLines() ObjectSetInteger(ChartID(), ObjectPrefix + "TakeProfitLine", OBJPROP_COLOR, takeprofit_line_color); ObjectSetInteger(ChartID(), ObjectPrefix + "TakeProfitLine", OBJPROP_WIDTH, takeprofit_line_width); ObjectSetInteger(ChartID(), ObjectPrefix + "TakeProfitLine", OBJPROP_SELECTABLE, true); - ObjectSetString(ChartID(), ObjectPrefix + "TakeProfitLine", OBJPROP_TOOLTIP, "Take-Profit"); + ObjectSetString(ChartID(), ObjectPrefix + "TakeProfitLine", OBJPROP_TOOLTIP, TRANSLATION_LABEL_TAKEPROFIT); if (DefaultLinesSelected) ObjectSetInteger(ChartID(), ObjectPrefix + "TakeProfitLine", OBJPROP_SELECTED, true); // Only for new lines. Old lines retain their selected status unless default parameter value changed. RestoredSomething = true; } @@ -5298,7 +5409,7 @@ void CPositionSizeCalculator::CheckAndRestoreLines() ObjectSetInteger(ChartID(), ObjectPrefix + "TakeProfitLine" + IntegerToString(i), OBJPROP_COLOR, takeprofit_line_color); ObjectSetInteger(ChartID(), ObjectPrefix + "TakeProfitLine" + IntegerToString(i), OBJPROP_WIDTH, takeprofit_line_width); ObjectSetInteger(ChartID(), ObjectPrefix + "TakeProfitLine" + IntegerToString(i), OBJPROP_SELECTABLE, true); - ObjectSetString(ChartID(), ObjectPrefix + "TakeProfitLine" + IntegerToString(i), OBJPROP_TOOLTIP, "Take-Profit #" + IntegerToString(i + 1)); + ObjectSetString(ChartID(), ObjectPrefix + "TakeProfitLine" + IntegerToString(i), OBJPROP_TOOLTIP, TRANSLATION_LABEL_TAKEPROFIT + " #" + IntegerToString(i + 1)); if (DefaultLinesSelected) ObjectSetInteger(ChartID(), ObjectPrefix + "TakeProfitLine" + IntegerToString(i), OBJPROP_SELECTED, true); // Only for new lines. Old lines retain their selected status unless default parameter value changed. RestoredSomething = true; } @@ -5325,7 +5436,7 @@ void CPositionSizeCalculator::SeekAndDestroyDuplicatePanels() // Reset object counter. ot = ObjectsTotal(ChartID()); i = ot; - Print("Deleted duplicate panel objects with prefix = ", prefix, "."); + Print(TRANSLATION_MESSAGE_DELETED_DUPLICATE_PANEL + " = ", prefix, "."); continue; } } @@ -5344,6 +5455,333 @@ int CPositionSizeCalculator::KeyBasedMultiplier() return 1; } +// Cycles through the controls list of the currently active tab to find the object with the given name. +// Returns control id, which can then be used in custom event processing. +long CPositionSizeCalculator::FindControlId(string obj_name) +{ + long id = FindControlIdInList(obj_name, PersistentList); // Check tab buttons and the outside Trade button. + if (id != -1) return id; // Return if found. + + // Proceed to all other buttons. + if (sets.SelectedTab == MainTab) + { + return FindControlIdInList(obj_name, MainTabList); + } + else if (sets.SelectedTab == RiskTab) + { + return FindControlIdInList(obj_name, RiskTabList); + } + else if (sets.SelectedTab == MarginTab) + { + return FindControlIdInList(obj_name, MarginTabList); + } + else if (sets.SelectedTab == SwapsTab) + { + return FindControlIdInList(obj_name, SwapsTabList); + } + else if (sets.SelectedTab == TradingTab) + { + return FindControlIdInList(obj_name, TradingTabList); + } + + return -1; +} + +// Finds the specific object inside the specific list. +long CPositionSizeCalculator::FindControlIdInList(string obj_name, CPanelList* list) +{ + for (CStringForList * obj = list.GetFirstNode(); obj != NULL; obj = list.GetNextNode()) + { + if (obj.Obj.Name() == obj_name) + { + return(obj.Obj.Id()); + } + } + return -1; // Object not found. +} + +// Creates and positions a Close button for an order in Visual Backtesting mode. +void CPositionSizeCalculator::CreateOutsideCloseButton(int ticket) +{ + int Starting_X = 0, Y_Offset = 0; + if (OutsideCloseButtonsCorner == CORNER_RIGHT_LOWER) + { + Starting_X = normal_edit_width * 3; + Y_Offset = element_height; + } + else if (OutsideCloseButtonsCorner == CORNER_RIGHT_UPPER) + { + Starting_X = normal_edit_width * 3; + Y_Offset = 0; + } + else if (OutsideCloseButtonsCorner == CORNER_LEFT_UPPER) + { + Starting_X = 0; + Y_Offset = 0; + } + else if (OutsideCloseButtonsCorner == CORNER_LEFT_LOWER) + { + Starting_X = 0; + Y_Offset = element_height; + } + int prev_size = ArraySize(OutsideCloseButtons); + ArrayResize(OutsideCloseButtons, prev_size + 1, 100); + if (!OrderSelect(ticket, SELECT_BY_TICKET)) + { + Print(TRANSLATION_MESSAGE_ORDERSELECT_FAILED); + return; + } + string obj_name = Name() + "m_BtnOutsideClose" + IntegerToString(ticket); // Using tickets for object naming because they have to be unique. And not recreate when an order is closed and a new one opens. + OutsideCloseButtons[prev_size].Create(0, obj_name, 0, Starting_X, prev_size * (element_height + 1) + Y_Offset, normal_edit_width * 3, element_height); + OutsideCloseButtons[prev_size].Corner(OutsideCloseButtonsCorner); + if (DarkMode) + { + OutsideCloseButtons[prev_size].BackColor(CONTROLS_BUTTON_COLOR_ENABLE); + OutsideCloseButtons[prev_size].BorderColor(DARKMODE_CONTROL_BRODER_COLOR); + } + OutsideCloseButtons[prev_size].Color(clrBlack); + OutsideCloseButtons[prev_size].Description(TRANSLATION_CLOSE_BUTTON + " " + OrderTypeToString(OrderType()) + " #" + IntegerToString(ticket)); + + if (prev_size == 0) // If no buttons existed, need to create the switch button too. + { + CreateOutsideCloseButtonsSwitch(); + } + else // Move the switch button. + { + OutsideCloseButtonsSwitchButton.Y_Distance((prev_size + 1) * (element_height + 1) + Y_Offset); + } +} + +// Closes the order, deletes it from the array, re-arranges the buttons, "unclicks" the button. +void CPositionSizeCalculator::ProcessOutsideCloseButtonClick(int ticket) +{ + // Convert the ticket to array element number. + int n = -1; + int buttons_total = ArraySize(OutsideCloseButtons); + for (int i = 0; i < buttons_total; i++) + { + if (OutsideCloseButtons[i].Name() == Name() + "m_BtnOutsideClose" + IntegerToString(ticket)) + { + n = i; + break; + } + } + if (n < 0) + { + Print(TRANSLATION_MESSAGE_OBJECT_NOT_FOUND); + return; + } + if (CloseOrder(ticket)) // Close successful. + { + RemoveOutsideCloseButton(n); + } + else // Close failed. + { + OutsideCloseButtons[n].State(false); // Unclick required only if OrderClose failed, otherwise, it's deleted. + } +} + +void CPositionSizeCalculator::RemoveOutsideCloseButton(int n) +{ + // Prepare the correct Y offset because it's different if the buttons are anchored to the top of the screen. + int Y_Offset = element_height; + if (OutsideCloseButtonsCorner == CORNER_RIGHT_UPPER) + { + Y_Offset = 0; + } + else if (OutsideCloseButtonsCorner == CORNER_LEFT_UPPER) + { + Y_Offset = 0; + } + + OutsideCloseButtons[n].Delete(); + int old_size = ArraySize(OutsideCloseButtons); + // The button can now be removed from the array with next elements shifted backwards. + for (int i = n; i < old_size; i++) + { + if (i == old_size - 1) // Final element. + { + OutsideCloseButtons[i].Detach(); // Dissociate the CChartObjectButton object from the actual chart object, so that deleting the CChartObjectButton object wouldn't result in the deletion of the chart object. + ArrayResize(OutsideCloseButtons, old_size - 1); + } + else + { + OutsideCloseButtons[i] = OutsideCloseButtons[i + 1]; + OutsideCloseButtons[i].Y_Distance(i * (element_height + 1) + Y_Offset); + } + } + if (old_size - 1 == 0) // If there are no more Close buttons, the switch is no longer required. + { + OutsideCloseButtonsSwitchButton.Delete(); + } + else // Move the switch button. + { + OutsideCloseButtonsSwitchButton.Y_Distance((old_size - 1) * (element_height + 1) + Y_Offset); + } +} + +// Basic close trade funciton: either deletes a pending order or closes a position. +bool CPositionSizeCalculator::CloseOrder(int ticket) +{ + if (!OrderSelect(ticket, SELECT_BY_TICKET)) + { + Print(TRANSLATION_MESSAGE_ORDERSELECT_FAILED + ": " + ErrorDescription(GetLastError()) + "."); + return false; + } + if ((OrderType() != OP_BUY) && (OrderType() != OP_SELL)) + { + bool res = OrderDelete(ticket); + if (!res) + { + Print(TRANSLATION_MESSAGE_ORDERDELETE_FAILED + ": " + ErrorDescription(GetLastError()) + "."); + return false; + } + else return true; + } + double price; + if (OrderType() == OP_BUY) + { + price = SymbolInfoDouble(Symbol(), SYMBOL_BID); + } + else // OP_SELL + { + price = SymbolInfoDouble(Symbol(), SYMBOL_ASK); + } + bool res = OrderClose(ticket, OrderLots(), price, 0, clrGoldenrod); + if (!res) + { + Print(TRANSLATION_MESSAGE_ORDERCLOSE_FAILED + ": " + ErrorDescription(GetLastError()) + "."); + return false; + } + else return true; +} + +// Checks: +// - if any TP/SL has been hit (trade disappeared); +// - if any pending order turned into a trade, including the case when the resulting order closed immediately. +// Updates profit for open positions. +void CPositionSizeCalculator::UpdateStrategyTesterTrades() +{ + int buttons_total = ArraySize(OutsideCloseButtons); + for (int i = buttons_total - 1; i >= 0; i--) // Going to because some buttons might get deleted. + { + string button_text = OutsideCloseButtons[i].Description(); + int start_pos = StringFind(button_text, "#") + 1; // The ticket number starts right after #. + int ticket = (int)StringToInteger(StringSubstr(button_text, start_pos)); + + // OrderSelect by ticket will work on closed orders too. Need to check further if the order is closed after it's selected. + if (!OrderSelect(ticket, SELECT_BY_TICKET)) // Deleted pending order. + { + RemoveOutsideCloseButton(i); + } + else // Either an existing market order, existing pending order, or a pending-turned-market order. + { + if (OrderCloseTime() > 0) // Closed order. + { + RemoveOutsideCloseButton(i); + continue; + } + int order_type = OrderType(); + if ((order_type == OP_BUY) || (order_type == OP_SELL)) + { + double profit_money = OrderProfit() + OrderCommission() + OrderSwap(); + double profit_points; + if (order_type == OP_BUY) profit_points = (OrderClosePrice() - OrderOpenPrice()) / SymbolInfoDouble(Symbol(), SYMBOL_POINT); + else profit_points = (OrderOpenPrice() - OrderClosePrice()) / SymbolInfoDouble(Symbol(), SYMBOL_POINT); + + string profit_string = DoubleToString(profit_points, 0) + "/" + DoubleToString(profit_money, 2); + OutsideCloseButtons[i].Description("[" + profit_string + "] " + TRANSLATION_CLOSE_BUTTON + " " + OrderTypeToString(OrderType()) + " #" + IntegerToString(ticket)); + } + } + } +} + +void CPositionSizeCalculator::CreateOutsideCloseButtonsSwitch() +{ + int array_size = ArraySize(OutsideCloseButtons); + string obj_name = Name() + "m_BtnOutsideCloseButtonsSwitchButton"; + + int Starting_X = 0, Y_Offset = 0; + if (OutsideCloseButtonsCorner == CORNER_RIGHT_LOWER) + { + Starting_X = element_height; + Y_Offset = 0; + } + else if (OutsideCloseButtonsCorner == CORNER_RIGHT_UPPER) + { + Starting_X = element_height; + Y_Offset = element_height; + } + else if (OutsideCloseButtonsCorner == CORNER_LEFT_UPPER) + { + Starting_X = 0; + Y_Offset = element_height; + } + else if (OutsideCloseButtonsCorner == CORNER_LEFT_LOWER) + { + Starting_X = 0; + Y_Offset = 0; + } + + OutsideCloseButtonsSwitchButton.Create(0, obj_name, 0, Starting_X, array_size * (element_height + 1) + element_height - Y_Offset, element_height, element_height); + OutsideCloseButtonsSwitchButton.Corner(OutsideCloseButtonsCorner); + if (DarkMode) + { + OutsideCloseButtonsSwitchButton.BackColor(CONTROLS_BUTTON_COLOR_ENABLE); + OutsideCloseButtonsSwitchButton.BorderColor(DARKMODE_CONTROL_BRODER_COLOR); + } + OutsideCloseButtonsSwitchButton.Color(clrBlack); + if (OutsideCloseButtonsCorner == CORNER_RIGHT_LOWER) OutsideCloseButtonsSwitchButton.Description("^"); + else if (OutsideCloseButtonsCorner == CORNER_RIGHT_UPPER) OutsideCloseButtonsSwitchButton.Description("<"); + else if (OutsideCloseButtonsCorner == CORNER_LEFT_UPPER) OutsideCloseButtonsSwitchButton.Description("v"); + else if (OutsideCloseButtonsCorner == CORNER_LEFT_LOWER) OutsideCloseButtonsSwitchButton.Description(">"); +} + +void CPositionSizeCalculator::ProcessOutsideCloseButtonsSwitchClick() +{ + int Starting_X = 0, Y_Offset = 0; + if (OutsideCloseButtonsCorner == CORNER_RIGHT_LOWER) // Switching from right-lower to right-upper. + { + OutsideCloseButtonsCorner = CORNER_RIGHT_UPPER; + OutsideCloseButtonsSwitchButton.Description("<"); + Starting_X = element_height; + Y_Offset = element_height; + } + else if (OutsideCloseButtonsCorner == CORNER_RIGHT_UPPER) // Switching from right-upper to left-upper. + { + OutsideCloseButtonsCorner = CORNER_LEFT_UPPER; + OutsideCloseButtonsSwitchButton.Description("v"); + Starting_X = 0; + Y_Offset = 0; + } + else if (OutsideCloseButtonsCorner == CORNER_LEFT_UPPER) // Switching from left-upper to left-lower. + { + OutsideCloseButtonsCorner = CORNER_LEFT_LOWER; + OutsideCloseButtonsSwitchButton.Description(">"); + Starting_X = 0; + Y_Offset = -element_height; + } + else if (OutsideCloseButtonsCorner == CORNER_LEFT_LOWER) // Switching from left-lower to right-lower. + { + OutsideCloseButtonsCorner = CORNER_RIGHT_LOWER; + OutsideCloseButtonsSwitchButton.Description("^"); + Starting_X = element_height; + Y_Offset = 0; + } + OutsideCloseButtonsSwitchButton.X_Distance(Starting_X); + OutsideCloseButtonsSwitchButton.Y_Distance(OutsideCloseButtonsSwitchButton.Y_Distance() - Y_Offset); + // Set the new corner to all buttons. + int buttons_total = ArraySize(OutsideCloseButtons); + for (int i = 0; i < buttons_total; i++) + { + if (Starting_X != 0) Starting_X = normal_edit_width * 3; // Change from the switch button's value to a close button's value. + OutsideCloseButtons[i].Corner(OutsideCloseButtonsCorner); + OutsideCloseButtons[i].X_Distance(Starting_X); + OutsideCloseButtons[i].Y_Distance(OutsideCloseButtons[i].Y_Distance() - Y_Offset); + } + OutsideCloseButtonsSwitchButton.Corner(OutsideCloseButtonsCorner); +} + //+------------------------------------------------+ //| | //| Calculation Functions | @@ -5373,7 +5811,7 @@ double DisplayRisk, RiskMoney, PositionMargin, UsedMargin, FutureMargin, PreHedg string InputRR, OutputRR, MainOutputRR, PLM, CPR, PRM, CPRew, PPMR, PPR, PPMRew, PPRew, CPL, PPL, CPRRR, PPRRR, AdditionalOutputRR[]; string InputReward; double OutputReward, AdditionalOutputReward[], MainOutputReward; -string OutputPointValue = "", OutputSwapsType = "Unknown", SwapsTripleDay = "?", +string OutputPointValue = "", OutputSwapsType = TRANSLATION_LABEL_UNKNOWN, SwapsTripleDay = "?", OutputSwapsDailyLongLot = "?", OutputSwapsDailyShortLot = "?", OutputSwapsDailyLongPS = "?", OutputSwapsDailyShortPS = "?", OutputSwapsYearlyLongLot = "?", OutputSwapsYearlyShortLot = "?", OutputSwapsYearlyLongPS = "?", OutputSwapsYearlyShortPS = "?", OutputSwapsCurrencyDailyLot = "", OutputSwapsCurrencyDailyPS = "", OutputSwapsCurrencyYearlyLot = "", OutputSwapsCurrencyYearlyPS = ""; @@ -5435,8 +5873,7 @@ void Initialization() if ((sets.TPDistanceInPoints) && (sets.TakeProfit == 0) && (sets.TakeProfitLevel != 0)) sets.TakeProfit = (int)MathRound(MathAbs((sets.TakeProfitLevel - sets.EntryLevel) / _Point)); if (sets.EntryLevel - sets.StopLossLevel == 0) { - Print("Entry and Stop-Loss levels should be different and non-zero."); -// return; + Print(TRANSLATION_MESSAGE_ENTRY_SL_DIFFERENT_NON_ZERO); } if (sets.EntryType == Instant) @@ -5476,7 +5913,7 @@ void Initialization() ObjectSetInteger(ChartID(), ObjectPrefix + "EntryLine", OBJPROP_STYLE, entry_line_style); ObjectSetInteger(ChartID(), ObjectPrefix + "EntryLine", OBJPROP_COLOR, entry_line_color); ObjectSetInteger(ChartID(), ObjectPrefix + "EntryLine", OBJPROP_WIDTH, entry_line_width); - ObjectSetString(ChartID(), ObjectPrefix + "EntryLine", OBJPROP_TOOLTIP, "Entry"); + ObjectSetString(ChartID(), ObjectPrefix + "EntryLine", OBJPROP_TOOLTIP, TRANSLATION_LABEL_ENTRY); if (sets.EntryType == Instant) { ObjectSetInteger(ChartID(), ObjectPrefix + "EntryLine", OBJPROP_SELECTABLE, false); @@ -5507,7 +5944,7 @@ void Initialization() ObjectSetInteger(ChartID(), ObjectPrefix + "StopLossLine", OBJPROP_COLOR, stoploss_line_color); ObjectSetInteger(ChartID(), ObjectPrefix + "StopLossLine", OBJPROP_WIDTH, stoploss_line_width); ObjectSetInteger(ChartID(), ObjectPrefix + "StopLossLine", OBJPROP_SELECTABLE, true); - ObjectSetString(ChartID(), ObjectPrefix + "StopLossLine", OBJPROP_TOOLTIP, "Stop-Loss"); + ObjectSetString(ChartID(), ObjectPrefix + "StopLossLine", OBJPROP_TOOLTIP, TRANSLATION_LABEL_STOPLOSS); if (!line_existed) { if (DefaultLinesSelected) ObjectSetInteger(ChartID(), ObjectPrefix + "StopLossLine", OBJPROP_SELECTED, true); // Only for new lines. Old lines retain their selected status unless default parameter value changed. @@ -5529,7 +5966,7 @@ void Initialization() ObjectSetInteger(ChartID(), ObjectPrefix + "StopLossLabel", OBJPROP_HIDDEN, false); ObjectSetInteger(ChartID(), ObjectPrefix + "StopLossLabel", OBJPROP_CORNER, CORNER_LEFT_UPPER); ObjectSetInteger(ChartID(), ObjectPrefix + "StopLossLabel", OBJPROP_BACK, DrawTextAsBackground); - ObjectSetString(ChartID(), ObjectPrefix + "StopLossLabel", OBJPROP_TOOLTIP, "SL Distance, points"); + ObjectSetString(ChartID(), ObjectPrefix + "StopLossLabel", OBJPROP_TOOLTIP, TRANSLATION_TOOLTIP_SL_LABEL); if ((ShowAdditionalSLLabel) && (ObjectFind(0, ObjectPrefix + "SLAdditionalLabel") == -1)) { ObjectCreate(ChartID(), ObjectPrefix + "SLAdditionalLabel", OBJ_LABEL, 0, 0, 0); @@ -5540,7 +5977,7 @@ void Initialization() ObjectSetInteger(ChartID(), ObjectPrefix + "SLAdditionalLabel", OBJPROP_HIDDEN, false); ObjectSetInteger(ChartID(), ObjectPrefix + "SLAdditionalLabel", OBJPROP_CORNER, CORNER_LEFT_UPPER); ObjectSetInteger(ChartID(), ObjectPrefix + "SLAdditionalLabel", OBJPROP_BACK, DrawTextAsBackground); - ObjectSetString(ChartID(), ObjectPrefix + "SLAdditionalLabel", OBJPROP_TOOLTIP, "Risk, % ($)"); + ObjectSetString(ChartID(), ObjectPrefix + "SLAdditionalLabel", OBJPROP_TOOLTIP, TRANSLATION_LABEL_RISK + ", % ($)"); } ObjectCreate(ChartID(), ObjectPrefix + "EntryLabel", OBJ_LABEL, 0, 0, 0); @@ -5551,7 +5988,7 @@ void Initialization() ObjectSetInteger(ChartID(), ObjectPrefix + "EntryLabel", OBJPROP_HIDDEN, false); ObjectSetInteger(ChartID(), ObjectPrefix + "EntryLabel", OBJPROP_CORNER, CORNER_LEFT_UPPER); ObjectSetInteger(ChartID(), ObjectPrefix + "EntryLabel", OBJPROP_BACK, DrawTextAsBackground); - ObjectSetString(ChartID(), ObjectPrefix + "EntryLabel", OBJPROP_TOOLTIP, "Entry Distance, points"); + ObjectSetString(ChartID(), ObjectPrefix + "EntryLabel", OBJPROP_TOOLTIP, TRANSLATION_TOOLTIP_ENTRY_LABEL); if ((ShowAdditionalEntryLabel) && (AdditionalTradeButtons != ADDITIONAL_TRADE_BUTTONS_LINE) && (AdditionalTradeButtons != ADDITIONAL_TRADE_BUTTONS_BOTH) && (ObjectFind(0, ObjectPrefix + "EntryAdditionalLabel") == -1)) { ObjectCreate(ChartID(), ObjectPrefix + "EntryAdditionalLabel", OBJ_LABEL, 0, 0, 0); @@ -5562,7 +5999,7 @@ void Initialization() ObjectSetInteger(ChartID(), ObjectPrefix + "EntryAdditionalLabel", OBJPROP_HIDDEN, false); ObjectSetInteger(ChartID(), ObjectPrefix + "EntryAdditionalLabel", OBJPROP_CORNER, CORNER_LEFT_UPPER); ObjectSetInteger(ChartID(), ObjectPrefix + "EntryAdditionalLabel", OBJPROP_BACK, DrawTextAsBackground); - ObjectSetString(ChartID(), ObjectPrefix + "EntryAdditionalLabel", OBJPROP_TOOLTIP, "Position Size, lots"); + ObjectSetString(ChartID(), ObjectPrefix + "EntryAdditionalLabel", OBJPROP_TOOLTIP, TRANSLATION_TOOLTIP_ENTRY_LABEL_ADDITIONAL); } } @@ -5582,7 +6019,7 @@ void Initialization() ObjectSetInteger(ChartID(), ObjectPrefix + "TakeProfitLine", OBJPROP_COLOR, takeprofit_line_color); ObjectSetInteger(ChartID(), ObjectPrefix + "TakeProfitLine", OBJPROP_WIDTH, takeprofit_line_width); ObjectSetInteger(ChartID(), ObjectPrefix + "TakeProfitLine", OBJPROP_SELECTABLE, true); - ObjectSetString(ChartID(), ObjectPrefix + "TakeProfitLine", OBJPROP_TOOLTIP, "Take-Profit"); + ObjectSetString(ChartID(), ObjectPrefix + "TakeProfitLine", OBJPROP_TOOLTIP, TRANSLATION_LABEL_TAKEPROFIT); if (!line_existed) { if (DefaultLinesSelected) ObjectSetInteger(ChartID(), ObjectPrefix + "TakeProfitLine", OBJPROP_SELECTED, true); // Only for new lines. Old lines retain their selected status unless default parameter value changed. @@ -5602,7 +6039,7 @@ void Initialization() ObjectSetInteger(ChartID(), ObjectPrefix + "TakeProfitLabel", OBJPROP_HIDDEN, false); ObjectSetInteger(ChartID(), ObjectPrefix + "TakeProfitLabel", OBJPROP_CORNER, CORNER_LEFT_UPPER); ObjectSetInteger(ChartID(), ObjectPrefix + "TakeProfitLabel", OBJPROP_BACK, DrawTextAsBackground); - ObjectSetString(ChartID(), ObjectPrefix + "TakeProfitLabel", OBJPROP_TOOLTIP, "TP Distance, points"); + ObjectSetString(ChartID(), ObjectPrefix + "TakeProfitLabel", OBJPROP_TOOLTIP, TRANSLATION_TOOLTIP_TP_LABEL); if (ShowAdditionalTPLabel) { ObjectCreate(ChartID(), ObjectPrefix + "TPAdditionalLabel", OBJ_LABEL, 0, 0, 0); @@ -5613,7 +6050,7 @@ void Initialization() ObjectSetInteger(ChartID(), ObjectPrefix + "TPAdditionalLabel", OBJPROP_HIDDEN, false); ObjectSetInteger(ChartID(), ObjectPrefix + "TPAdditionalLabel", OBJPROP_CORNER, CORNER_LEFT_UPPER); ObjectSetInteger(ChartID(), ObjectPrefix + "TPAdditionalLabel", OBJPROP_BACK, DrawTextAsBackground); - ObjectSetString(ChartID(), ObjectPrefix + "TPAdditionalLabel", OBJPROP_TOOLTIP, "Reward, % ($), R/R"); + ObjectSetString(ChartID(), ObjectPrefix + "TPAdditionalLabel", OBJPROP_TOOLTIP, TRANSLATION_LABEL_REWARD + ", % ($), R/R"); } } @@ -5636,7 +6073,7 @@ void Initialization() ObjectSetInteger(ChartID(), ObjectPrefix + "TakeProfitLine" + IntegerToString(i), OBJPROP_COLOR, takeprofit_line_color); ObjectSetInteger(ChartID(), ObjectPrefix + "TakeProfitLine" + IntegerToString(i), OBJPROP_WIDTH, takeprofit_line_width); ObjectSetInteger(ChartID(), ObjectPrefix + "TakeProfitLine" + IntegerToString(i), OBJPROP_SELECTABLE, true); - ObjectSetString(ChartID(), ObjectPrefix + "TakeProfitLine" + IntegerToString(i), OBJPROP_TOOLTIP, "Take-Profit #" + IntegerToString(i + 1)); + ObjectSetString(ChartID(), ObjectPrefix + "TakeProfitLine" + IntegerToString(i), OBJPROP_TOOLTIP, TRANSLATION_LABEL_TAKEPROFIT + " #" + IntegerToString(i + 1)); if (!line_existed) { if (DefaultLinesSelected) ObjectSetInteger(ChartID(), ObjectPrefix + "TakeProfitLine" + IntegerToString(i), OBJPROP_SELECTED, true); // Only for new lines. Old lines retain their selected status unless default parameter value changed. @@ -5656,7 +6093,7 @@ void Initialization() ObjectSetInteger(ChartID(), ObjectPrefix + "TakeProfitLabel" + IntegerToString(i), OBJPROP_HIDDEN, false); ObjectSetInteger(ChartID(), ObjectPrefix + "TakeProfitLabel" + IntegerToString(i), OBJPROP_CORNER, CORNER_LEFT_UPPER); ObjectSetInteger(ChartID(), ObjectPrefix + "TakeProfitLabel" + IntegerToString(i), OBJPROP_BACK, DrawTextAsBackground); - ObjectSetString(ChartID(), ObjectPrefix + "TakeProfitLabel" + IntegerToString(i), OBJPROP_TOOLTIP, "TP #" + IntegerToString(i + 1) + " Distance, points"); + ObjectSetString(ChartID(), ObjectPrefix + "TakeProfitLabel" + IntegerToString(i), OBJPROP_TOOLTIP, TRANSLATION_LABEL_TAKEPROFIT_MULTIPLE_DISTANCE + " #" + IntegerToString(i + 1) + ", " + TRANSLATION_LABEL_TAKEPROFIT_MULTIPLE_POINTS); if (ShowAdditionalTPLabel) { ObjectCreate(ChartID(), ObjectPrefix + "TPAdditionalLabel" + IntegerToString(i), OBJ_LABEL, 0, 0, 0); @@ -5667,7 +6104,7 @@ void Initialization() ObjectSetInteger(ChartID(), ObjectPrefix + "TPAdditionalLabel" + IntegerToString(i), OBJPROP_HIDDEN, false); ObjectSetInteger(ChartID(), ObjectPrefix + "TPAdditionalLabel" + IntegerToString(i), OBJPROP_CORNER, CORNER_LEFT_UPPER); ObjectSetInteger(ChartID(), ObjectPrefix + "TPAdditionalLabel" + IntegerToString(i), OBJPROP_BACK, DrawTextAsBackground); - ObjectSetString(ChartID(), ObjectPrefix + "TPAdditionalLabel" + IntegerToString(i), OBJPROP_TOOLTIP, "Reward #" + IntegerToString(i + 1) + ", $ (%), R/R"); + ObjectSetString(ChartID(), ObjectPrefix + "TPAdditionalLabel" + IntegerToString(i), OBJPROP_TOOLTIP, TRANSLATION_LABEL_REWARD + " #" + IntegerToString(i + 1) + ", $ (%), R/R"); } } } @@ -5767,7 +6204,7 @@ void RecalculatePositionSize() double AskBid = 0; if (sets.EntryType == Instant) { - if ((tStopLossLevel < Ask) && (tStopLossLevel > Bid)) WarningSL = "(Wrong value!)"; + if ((tStopLossLevel < Ask) && (tStopLossLevel > Bid)) WarningSL = " " + TRANSLATION_LABEL_WARNING_WRONG_VALUE; else if (tStopLossLevel < Ask) AskBid = Ask; else if (tStopLossLevel > Bid) AskBid = Bid; } @@ -5777,16 +6214,16 @@ void RecalculatePositionSize() else if (tStopLossLevel > tEntryLevel) AskBid = Bid; if (AskBid) { - if (MathAbs(AskBid - tEntryLevel) < StopLevel) WarningEntry = "(Too close!)"; + if (MathAbs(AskBid - tEntryLevel) < StopLevel) WarningEntry = " " + TRANSLATION_LABEL_WARNING_TOO_CLOSE; } - else WarningSL = "(Wrong value!)"; + else WarningSL = " " + TRANSLATION_LABEL_WARNING_WRONG_VALUE; } - if ((WarningSL == "") && (MathAbs(tStopLossLevel - tEntryLevel) < StopLevel)) WarningSL = "(Too close!)"; + if ((WarningSL == "") && (MathAbs(tStopLossLevel - tEntryLevel) < StopLevel)) WarningSL = " " + TRANSLATION_LABEL_WARNING_TOO_CLOSE; if (tTakeProfitLevel > 0) { - if (MathAbs(tTakeProfitLevel - tEntryLevel) < StopLevel) WarningTP = "(Too close!)"; + if (MathAbs(tTakeProfitLevel - tEntryLevel) < StopLevel) WarningTP = " " + TRANSLATION_LABEL_WARNING_TOO_CLOSE; } for (int i = 1; i < sets.TakeProfitsNumber; i++) @@ -5796,7 +6233,7 @@ void RecalculatePositionSize() add_tTakeProfitLevel = Round(add_tTakeProfitLevel, _Digits); if (add_tTakeProfitLevel > 0) { - if (MathAbs(add_tTakeProfitLevel - tEntryLevel) < StopLevel) AdditionalWarningTP[i - 1] = "(Too close!)"; + if (MathAbs(add_tTakeProfitLevel - tEntryLevel) < StopLevel) AdditionalWarningTP[i - 1] = " " + TRANSLATION_LABEL_WARNING_TOO_CLOSE; } } @@ -5862,7 +6299,7 @@ void RecalculatePositionSize() if (ShowAdditionalTPLabel) { string label_text; - if ((WarningTP == "") && (MainOutputRR != "Invalid TP")) + if ((WarningTP == "") && (MainOutputRR != TRANSLATION_LABEL_WARNING_INVALID_TP)) { string perc_risk; if (AccSize > 0) perc_risk = FormatDouble(DoubleToString(Round(MainOutputReward / AccSize * 100, 2, RoundDown), 2)); @@ -5874,7 +6311,7 @@ void RecalculatePositionSize() else { label_text = WarningTP; - if (MainOutputRR == "Invalid TP") label_text += MainOutputRR; + if (MainOutputRR == TRANSLATION_LABEL_WARNING_INVALID_TP) label_text += MainOutputRR; } DrawLineLabel(ObjectPrefix + "TPAdditionalLabel", label_text, tTakeProfitLevel, tp_label_font_color, true); if (sets.ShowLines) ObjectSetInteger(ChartID(), ObjectPrefix + "TPAdditionalLabel", OBJPROP_TIMEFRAMES, OBJ_ALL_PERIODS); @@ -5891,7 +6328,7 @@ void RecalculatePositionSize() if (ShowAdditionalTPLabel) { string label_text; - if ((AdditionalWarningTP[i - 1] == "") && (AdditionalOutputRR[i - 1] != "Invalid TP")) + if ((AdditionalWarningTP[i - 1] == "") && (AdditionalOutputRR[i - 1] != TRANSLATION_LABEL_WARNING_INVALID_TP)) { string perc_risk; if (AccSize > 0) perc_risk = FormatDouble(DoubleToString(Round(AdditionalOutputReward[i - 1] / AccSize * 100, 2, RoundDown), 2)); @@ -5901,7 +6338,7 @@ void RecalculatePositionSize() else { label_text = AdditionalWarningTP[i - 1]; - if (AdditionalOutputRR[i - 1] == "Invalid TP") label_text += AdditionalOutputRR[i - 1]; + if (AdditionalOutputRR[i - 1] == TRANSLATION_LABEL_WARNING_INVALID_TP) label_text += AdditionalOutputRR[i - 1]; } DrawLineLabel(ObjectPrefix + "TPAdditionalLabel" + IntegerToString(i), label_text, add_tTakeProfitLevel, tp_label_font_color, true); if (sets.ShowLines) ObjectSetInteger(ChartID(), ObjectPrefix + "TPAdditionalLabel" + IntegerToString(i), OBJPROP_TIMEFRAMES, OBJ_ALL_PERIODS); @@ -5912,7 +6349,7 @@ void RecalculatePositionSize() if (StopLoss == 0) { - Print("Stop-loss should be different from Entry."); + Print(TRANSLATION_MESSAGE_ENTRY_SL_DIFFERENT); return; } @@ -5993,17 +6430,17 @@ double CalculateAdjustment(const PROFIT_LOSS calc_mode, string profit_currency = // The condition checks whether we are caclulating conversion coefficient for the chart's symbol or for some other. // The error output is OK for the current symbol only because it won't be repeated ad infinitum. // It should be avoided for non-chart symbols because it will just flood the log. - if (profit_currency == ProfitCurrency) Print("Couldn't detect proper currency pair for adjustment calculation. Profit currency: ", profit_currency, ". Account currency: ", account_currency, ". Trying to find a possible two-symbol combination."); + if (profit_currency == ProfitCurrency) Print(TRANSLATION_MESSAGE_COULDNT_DETECT + " " + TRANSLATION_LABEL_PROFIT_CURRENCY + ": ", profit_currency, ". " + TRANSLATION_MESSAGE_ACCOUNT_CURRENCY + ": ", account_currency, ". " + TRANSLATION_MESSAGE_TRYING_TO_FIND); if ((FindDoubleReferenceSymbol("USD", profit_currency, ref_symbol, ref_mode, add_ref_symbol, add_ref_mode)) // USD should work in 99.9% of cases. || (FindDoubleReferenceSymbol("EUR", profit_currency, ref_symbol, ref_mode, add_ref_symbol, add_ref_mode)) // For very rare cases. || (FindDoubleReferenceSymbol("GBP", profit_currency, ref_symbol, ref_mode, add_ref_symbol, add_ref_mode)) // For extremely rare cases. || (FindDoubleReferenceSymbol("JPY", profit_currency, ref_symbol, ref_mode, add_ref_symbol, add_ref_mode))) // For extremely rare cases. { - if (profit_currency == ProfitCurrency) Print("Converting via ", ref_symbol, " and ", add_ref_symbol, "."); + if (profit_currency == ProfitCurrency) Print(TRANSLATION_MESSAGE_CONVERTING_VIA + ": ", ref_symbol, ", ", add_ref_symbol, "."); } else { - Print("Adjustment calculation critical failure. Failed both simple and two-pair conversion methods."); + Print(TRANSLATION_MESSAGE_ADJUSTMENT_CALCULATION_CRITICAL_FAILURE); return 1; } } @@ -6105,7 +6542,7 @@ bool FindDoubleReferenceSymbol(const string cross_currency, const string profit_ } if (ref_symbol == NULL) { - Print("Error. Couldn't detect proper currency pair for 2-pair adjustment calculation. Cross currency: ", cross_currency, ". Account currency: ", account_currency, "."); + Print(TRANSLATION_MESSAGE_COULDNT_DETECT_PROPER_CURRENCY_PAIR + " " + TRANSLATION_MESSAGE_CROSS_CURRENCY + ": ", cross_currency, ". " + TRANSLATION_MESSAGE_ACCOUNT_CURRENCY + ": ", account_currency, "."); return false; } @@ -6123,7 +6560,7 @@ bool FindDoubleReferenceSymbol(const string cross_currency, const string profit_ } if (add_ref_symbol == NULL) { - Print("Error. Couldn't detect proper currency pair for 2-pair adjustment calculation. Cross currency: ", cross_currency, ". Chart's pair currency: ", profit_currency, "."); + Print(TRANSLATION_MESSAGE_COULDNT_DETECT_PROPER_CURRENCY_PAIR + " " + TRANSLATION_MESSAGE_CROSS_CURRENCY + ": ", cross_currency, ". " + TRANSLATION_MESSAGE_CHARTS_PAIR_CURRENCY + ": ", profit_currency, "."); return false; } @@ -6184,12 +6621,14 @@ void CalculateRiskAndPositionSize() if (!sets.UseMoneyInsteadOfPercentage) { RiskMoney = Round(AccSize * sets.Risk / 100, 2, RoundDown); + sets.MoneyRisk = RiskMoney; } else { RiskMoney = sets.MoneyRisk; if (AccSize != 0) DisplayRisk = Round(sets.MoneyRisk / AccSize * 100, 2); - else DisplayRisk = 0; + else DisplayRisk = 0; + sets.Risk = DisplayRisk; } // If Symbol is CFD or futures but with different profit currency. @@ -6246,6 +6685,7 @@ void CalculateRiskAndPositionSize() sets.MoneyRisk = RiskMoney; if (AccSize != 0) DisplayRisk = Round(sets.MoneyRisk / AccSize * 100, 2); else DisplayRisk = 0; + sets.Risk = DisplayRisk; PositionSize = OutputPositionSize; } else @@ -6257,13 +6697,9 @@ void CalculateRiskAndPositionSize() if (!CalculateUnadjustedPositionSize) // If need to adjust to broker's restrictions. { - if (PositionSize < MinLot) OutputPositionSize = MinLot; - else if ((PositionSize > MaxLot) && (!SurpassBrokerMaxPositionSize)) OutputPositionSize = MaxLot; - double steps = 0; - if (LotStep != 0) steps = OutputPositionSize / LotStep; - if (MathAbs(MathRound(steps) - steps) < 0.00000001) steps = MathRound(steps); - if (MathFloor(steps) < steps) OutputPositionSize = MathFloor(steps) * LotStep; + OutputPositionSize = AdjustPositionSizeByMinMaxStep(PositionSize); } + if ((CapMaxPositionSizeBasedOnMargin) && (OutputPositionSize > OutputMaxPositionSize)) OutputPositionSize = OutputMaxPositionSize; // Cap with max position size by free margin if necessary. if (TickSize == 0) return; OutputRiskMoney = Round((StopLoss * UnitCost / TickSize + 2 * commission) * OutputPositionSize, 2); @@ -6316,7 +6752,7 @@ void CalculateRiskAndPositionSize() } else { - InputRR = "Invalid TP"; + InputRR = TRANSLATION_LABEL_WARNING_INVALID_TP; MainOutputRR = InputRR; } if (MainOutputRR == InputRR) InputRR = ""; @@ -6359,7 +6795,7 @@ void CalculateRiskAndPositionSize() } else { - AdditionalOutputRR[i - 1] = "Invalid TP"; + AdditionalOutputRR[i - 1] = TRANSLATION_LABEL_WARNING_INVALID_TP; } } else AdditionalOutputRR[i - 1] = ""; @@ -6382,12 +6818,12 @@ void CalculateRiskAndPositionSize() for (int i = 1; i < sets.TakeProfitsNumber; i++) { OutputReward += AdditionalOutputReward[i - 1]; - if ((AdditionalOutputRR[i - 1] == "Invalid TP") || (MainOutputRR == "Invalid TP")) OutputRR = "Invalid TP"; // At least one Invalid TP means that total RR is also invalid. + if ((AdditionalOutputRR[i - 1] == TRANSLATION_LABEL_WARNING_INVALID_TP) || (MainOutputRR == TRANSLATION_LABEL_WARNING_INVALID_TP)) OutputRR = TRANSLATION_LABEL_WARNING_INVALID_TP; // At least one Invalid TP means that total RR is also invalid. if ((OutputPositionSize > 0) && (ArrayPositionSize[i] > 0)) TotalOutputRisk += (OutputRiskMoney / OutputPositionSize * ArrayPositionSize[i]); TotalInputRisk += (RiskMoney * (double)sets.TPShare[i] / 100.0); if (sets.TP[i] > 0) InputReward = DoubleToString(StringToDouble(InputReward) + Round(RiskMoney * (double)sets.TPShare[i] / 100.0 * MathAbs(sets.TP[i] - tEntryLevel) / StopLoss, 2, RoundDown), 2); } - if (OutputRR != "Invalid TP") + if (OutputRR != TRANSLATION_LABEL_WARNING_INVALID_TP) { if (TotalOutputRisk != 0) OutputRR = DoubleToString(Round(OutputReward / TotalOutputRisk, 2, RoundDown), 2); else OutputRR = ""; @@ -6445,7 +6881,8 @@ void CalculatePortfolioRisk(const CALCULATE_RISK_FOR_TRADING_TAB calculate_risk_ // Skip orders in other symbols if the ignore checkbox is ticked. if (!calculate_risk_for_trading_tab) { - if ((OrderSymbol() != Symbol()) && (sets.IgnoreOtherSymbols)) continue; + if ((OrderSymbol() != Symbol()) && (sets.IgnoreSymbols == IGNORE_SYMBOLS_OTHER)) continue; + else if ((OrderSymbol() == Symbol()) && (sets.IgnoreSymbols == IGNORE_SYMBOLS_CURRENT)) continue; } else if ((OrderSymbol() != Symbol()) && (calculate_risk_for_trading_tab == CALCULATE_RISK_FOR_TRADING_TAB_PER_SYMBOL)) continue; @@ -6523,7 +6960,7 @@ void CalculatePortfolioRisk(const CALCULATE_RISK_FOR_TRADING_TAB calculate_risk_ if (TickSize_local == 0) { - Print("Cannot retrieve tick size for ", OrderSymbol(), ". Looks like the instrument is no longer available. Calculation may not be accurate."); + Print(TRANSLATION_MESSAGE_CANNOT_RETRIEVE_TICKSIZE, OrderSymbol(), ". " + TRANSLATION_MESSAGE_LOOKS_LIKE); } else { @@ -6581,7 +7018,7 @@ void CalculatePortfolioRisk(const CALCULATE_RISK_FOR_TRADING_TAB calculate_risk_ if (TickSize_local == 0) { - Print("Cannot retrieve tick size for ", OrderSymbol(), ". Looks like the instrument is no longer available. Calculation may not be accurate."); + Print(TRANSLATION_MESSAGE_CANNOT_RETRIEVE_TICKSIZE, OrderSymbol(), ". " + TRANSLATION_MESSAGE_LOOKS_LIKE); } else { @@ -6616,28 +7053,28 @@ void CalculatePortfolioRisk(const CALCULATE_RISK_FOR_TRADING_TAB calculate_risk_ // If account size did not load yet. if (AccSize == 0) return; - if (PortfolioLossMoney == DBL_MAX) PLM = " Infinity"; + if (PortfolioLossMoney == DBL_MAX) PLM = " " + TRANSLATION_MESSAGE_INFINITY; else PLM = FormatDouble(DoubleToString(PortfolioLossMoney, 2)); - if (PortfolioLossMoney == DBL_MAX) CPR = " Infinity"; + if (PortfolioLossMoney == DBL_MAX) CPR = " " + TRANSLATION_MESSAGE_INFINITY; else CPR = FormatDouble(DoubleToString(PortfolioLossMoney / AccSize * 100, 2)); - if (PortfolioLossMoney == DBL_MAX) PPMR = " Infinity"; + if (PortfolioLossMoney == DBL_MAX) PPMR = " " + TRANSLATION_MESSAGE_INFINITY; else PPMR = FormatDouble(DoubleToString(PortfolioLossMoney + OutputRiskMoney, 2)); - if (PortfolioLossMoney == DBL_MAX) PPR = " Infinity"; + if (PortfolioLossMoney == DBL_MAX) PPR = " " + TRANSLATION_MESSAGE_INFINITY; else PPR = FormatDouble(DoubleToString((PortfolioLossMoney + OutputRiskMoney) / AccSize * 100, 2)); - if (PortfolioRewardMoney == DBL_MAX) PRM = " Infinity"; + if (PortfolioRewardMoney == DBL_MAX) PRM = " " + TRANSLATION_MESSAGE_INFINITY; else PRM = FormatDouble(DoubleToString(PortfolioRewardMoney, 2)); - if (PortfolioRewardMoney == DBL_MAX) CPRew = " Infinity"; + if (PortfolioRewardMoney == DBL_MAX) CPRew = " " + TRANSLATION_MESSAGE_INFINITY; else CPRew = FormatDouble(DoubleToString(PortfolioRewardMoney / AccSize * 100, 2)); - if ((PortfolioRewardMoney == DBL_MAX) || (OutputReward == 0)) PPMRew = " Infinity"; + if ((PortfolioRewardMoney == DBL_MAX) || (OutputReward == 0)) PPMRew = " " + TRANSLATION_MESSAGE_INFINITY; else PPMRew = FormatDouble(DoubleToString(PortfolioRewardMoney + OutputReward, 2)); - if ((PortfolioRewardMoney == DBL_MAX) || (OutputReward == 0)) PPRew = " Infinity"; + if ((PortfolioRewardMoney == DBL_MAX) || (OutputReward == 0)) PPRew = " " + TRANSLATION_MESSAGE_INFINITY; else PPRew = FormatDouble(DoubleToString((PortfolioRewardMoney + OutputReward) / AccSize * 100, 2)); CPL = FormatDouble(DoubleToString(volume, LotStep_digits), LotStep_digits); @@ -6646,12 +7083,12 @@ void CalculatePortfolioRisk(const CALCULATE_RISK_FOR_TRADING_TAB calculate_risk_ if (PortfolioRewardMoney == DBL_MAX) { if (PortfolioLossMoney == DBL_MAX) CPRRR = "-"; - else CPRRR = "Infinity"; + else CPRRR = TRANSLATION_MESSAGE_INFINITY; } else if (PortfolioLossMoney == DBL_MAX) CPRRR = "0.00"; else if (PortfolioLossMoney == 0) { - if (PortfolioRewardMoney != 0) CPRRR = "Infinity"; + if (PortfolioRewardMoney != 0) CPRRR = TRANSLATION_MESSAGE_INFINITY; else CPRRR = "-"; } else CPRRR = FormatDouble(DoubleToString(PortfolioRewardMoney / PortfolioLossMoney, 2)); @@ -6659,12 +7096,12 @@ void CalculatePortfolioRisk(const CALCULATE_RISK_FOR_TRADING_TAB calculate_risk_ if ((PortfolioRewardMoney == DBL_MAX) || (OutputReward == 0)) { if (PortfolioLossMoney == DBL_MAX) PPRRR = "-"; - else PPRRR = "Infinity"; + else PPRRR = TRANSLATION_MESSAGE_INFINITY; } else if (PortfolioLossMoney == DBL_MAX) PPRRR = "0.00"; else if (PortfolioLossMoney + OutputRiskMoney == 0) { - if (PortfolioRewardMoney + OutputReward != 0) PPRRR = "Infinity"; + if (PortfolioRewardMoney + OutputReward != 0) PPRRR = TRANSLATION_MESSAGE_INFINITY; else PPRRR = "-"; } else PPRRR = FormatDouble(DoubleToString((PortfolioRewardMoney + OutputReward) / (PortfolioLossMoney + OutputRiskMoney), 2)); @@ -6816,12 +7253,7 @@ void CalculateMargin() OutputMaxPositionSize = MaxPositionSizeByMargin; if (!CalculateUnadjustedPositionSize) // If need to adjust to broker's restrictions. { - if (MaxPositionSizeByMargin < MinLot) OutputMaxPositionSize = 0; // Cannot open any position at all. - else if ((MaxPositionSizeByMargin > MaxLot) && (!SurpassBrokerMaxPositionSize)) OutputMaxPositionSize = MaxLot; - double steps = 0; - if (LotStep != 0) steps = OutputMaxPositionSize / LotStep; - if (MathAbs(MathRound(steps) - steps) < 0.00000001) steps = MathRound(steps); - if (MathFloor(steps) < steps) OutputMaxPositionSize = MathFloor(steps) * LotStep; + OutputMaxPositionSize = AdjustPositionSizeByMinMaxStep(OutputMaxPositionSize); } UsedMargin = AccountMargin() + PositionMargin; @@ -6892,7 +7324,7 @@ void GetSwapData() tick_value_long = tick_value; tick_value_short = tick_value; } - OutputSwapsType = "Points"; + OutputSwapsType = TRANSLATION_LABEL_POINTS; swap_long_1_lot = swap_long * tick_value_long; swap_short_1_lot = swap_short * tick_value_short; } @@ -6901,7 +7333,7 @@ void GetSwapData() case 1: { string base_currency = SymbolInfoString(Symbol(), SYMBOL_CURRENCY_BASE); - OutputSwapsType = "Base currency (" + base_currency + ")"; + OutputSwapsType = TRANSLATION_LABEL_BASE_CURRENCY + " (" + base_currency + ")"; // Simple case: if (account_currency == base_currency) { @@ -6986,7 +7418,7 @@ void GetSwapData() { if (TickSize == 0) return; double symbol_cost_1_lot_profit, symbol_cost_1_lot_loss; - OutputSwapsType = "Interest"; + OutputSwapsType = TRANSLATION_LABEL_INTEREST; // Calculate it by pending order's price. // If Forex or futures (same currency), current formula should be OK. @@ -7261,7 +7693,7 @@ void WarnAboutZeroUnitCost() { if (WarnedAboutZeroUnitCost == 1) // Issue the actual alert only after the first dry run, to avoid sending an alert when symbol data is still loading. { - if (WarnedAboutZeroUnitCost != 2) Alert("Misconfigured symbol on trading server - zero unit cost."); + if (WarnedAboutZeroUnitCost != 2) Alert(TRANSLATION_MESSAGE_MISCONFIGURED_SYMBOL); WarnedAboutZeroUnitCost = 2; return; } @@ -7343,4 +7775,15 @@ void PositionSizeToArray(double ps) } else ArrayPositionSize[0] = ps; } + +double AdjustPositionSizeByMinMaxStep(double ps) +{ + if (ps < MinLot) ps = MinLot; + else if ((ps > MaxLot) && (!SurpassBrokerMaxPositionSize)) ps = MaxLot; + double steps = 0; + if (LotStep != 0) steps = ps / LotStep; + if (MathAbs(MathRound(steps) - steps) < 0.00000001) steps = MathRound(steps); + if (MathFloor(steps) < steps) ps = MathFloor(steps) * LotStep; + return ps; +} //+------------------------------------------------------------------+ \ No newline at end of file diff --git a/MQL4/Experts/Position Sizer/TesterSupport.mqh b/MQL4/Experts/Position Sizer/TesterSupport.mqh new file mode 100644 index 0000000..32cbd36 --- /dev/null +++ b/MQL4/Experts/Position Sizer/TesterSupport.mqh @@ -0,0 +1,206 @@ +//+------------------------------------------------------------------+ +//| TesterSupport.mqh | +//| Copyright © 2024, EarnForex.com | +//| https://www.earnforex.com/ | +//+------------------------------------------------------------------+ + +// Checks chart objects and generates events if required: +// - Buttons: check OBJPROP_STATE. +// - Edits: check vs. previous registered value. +// - Checkbox: simply check state. +void ListenToChartEvents(string panel_id) +{ + int panel_id_length = StringLen(panel_id); + + // Standard chart event parameters to pass to the handler: + long lparam = 0; + double dparam = 0.0; + string sparam = ""; + + // Start with the buttons: + int buttons_total = ObjectsTotal(0, -1, OBJ_BUTTON); + for (int i = 0; i < buttons_total; i++) + { + string object_name = ObjectName(0, i, -1, OBJ_BUTTON); + // Looking for 12345m_BtnABCDE object names. + if (StringSubstr(object_name, 0, panel_id_length + 2) != panel_id + "m_") continue; + + if ((bool)ObjectGetInteger(0, object_name, OBJPROP_STATE) == true) // Pressed button. + { + lparam = ExtDialog.FindControlId(object_name); + if (lparam == -1) + { + // If no control id, this is likely some external button or there is an error. + // Try to process it as a standard click chart event (non-custom). + OnChartEvent(CHARTEVENT_OBJECT_CLICK, lparam, dparam, object_name); + // It can also be additional panel buttons that don't have id. + OnChartEvent(CHARTEVENT_CUSTOM + ON_CLICK, lparam, dparam, object_name); + } + else + { + OnChartEvent(CHARTEVENT_CUSTOM + ON_CLICK, lparam, dparam, object_name); + } + ObjectSetInteger(0, object_name, OBJPROP_STATE, false); // Unpress it. + return; // No need to check anything else. + } + } + + // Do edits: + int edits_total = ObjectsTotal(0, -1, OBJ_EDIT); + for (int i = 0; i < edits_total; i++) + { + string object_name = ObjectName(0, i, -1, OBJ_EDIT); + // Looking for 12345m_EdtABCDE object names. + if (StringSubstr(object_name, 0, panel_id_length + 5) == panel_id + "m_Edt") + { + + string text = StringTrimRight(StringTrimLeft(ObjectGetString(0, object_name, OBJPROP_TEXT))); + double double_from_text = StringToDouble(text); + + // Prepare the same for the balance/commission fields. Need to strip it out of formatting: + string text_stripped = text; + // Try to swap , for . in the "normal" decimal separator positions only. Other commas will be simply removed. + if (StringGetCharacter(text_stripped, StringLen(text_stripped) - 2) == ',') StringSetCharacter(text_stripped, StringLen(text_stripped) - 2, '.'); + if (StringGetCharacter(text_stripped, StringLen(text_stripped) - 3) == ',') StringSetCharacter(text_stripped, StringLen(text_stripped) - 3, '.'); + StringReplace(text_stripped, ",", ""); // Remove commas that might appear as the thousands separator due to number formatting. + double double_from_stripped_text = StringToDouble(text_stripped); + + // The checkbox part has "Button" added to its name. + if (((object_name == panel_id + "m_EdtEntryLevel") && (CompareDoubles(double_from_text, sets.EntryLevel))) || + ((!sets.SLDistanceInPoints) && (object_name == panel_id + "m_EdtSL") && (CompareDoubles(double_from_text, sets.StopLossLevel))) || + ((sets.SLDistanceInPoints) && (object_name == panel_id + "m_EdtSL") && (text != IntegerToString(sets.StopLoss))) || + ((!sets.TPDistanceInPoints) && (object_name == panel_id + "m_EdtTP") && (CompareDoubles(double_from_text, sets.TakeProfitLevel))) || + ((sets.TPDistanceInPoints) && (object_name == panel_id + "m_EdtTP") && (text != IntegerToString(sets.TakeProfit))) || + // Account size is editable only when it's set to Balance. If different from the actual account balance, a custom value has been entered. + ((sets.AccountButton == Balance) && (object_name == panel_id + "m_EdtAccount") && (CompareDoubles(double_from_stripped_text, AccountBalance() + AdditionalFunds)) && (CompareDoubles(double_from_stripped_text, sets.CustomBalance))) || + ((object_name == panel_id + "m_EdtCommissionSize") && (CompareDoubles(double_from_text, sets.CommissionPerLot, 3))) || + ((object_name == panel_id + "m_EdtRiskPIn") && (CompareDoubles(double_from_text, sets.Risk))) || + ((object_name == panel_id + "m_EdtRiskMIn") && (CompareDoubles(double_from_stripped_text, sets.MoneyRisk, 2))) || + ((object_name == panel_id + "m_EdtPosSize") && (CompareDoubles(double_from_text, OutputPositionSize, 2))) || + ((object_name == panel_id + "m_EdtATRPeriod") && (text != IntegerToString(sets.ATRPeriod))) || + ((object_name == panel_id + "m_EdtATRMultiplierSL") && (CompareDoubles(double_from_text, sets.ATRMultiplierSL, 2))) || + ((object_name == panel_id + "m_EdtATRMultiplierTP") && (CompareDoubles(double_from_text, sets.ATRMultiplierTP, 2))) || + ((object_name == panel_id + "m_EdtCustomLeverage") && (CompareDoubles(double_from_text, sets.CustomLeverage))) || + ((object_name == panel_id + "m_EdtMagicNumber") && (text != IntegerToString(sets.MagicNumber))) || + ((object_name == panel_id + "m_EdtExpiry") && (text != IntegerToString(sets.ExpiryMinutes))) || + ((object_name == panel_id + "m_EdtCommentary") && (text != sets.Commentary)) || + ((object_name == panel_id + "m_EdtMaxSlippage") && (text != IntegerToString(sets.MaxSlippage))) || + ((object_name == panel_id + "m_EdtMaxSpread") && (text != IntegerToString(sets.MaxSpread))) || + ((object_name == panel_id + "m_EdtMaxEntrySLDistance") && (text != IntegerToString(sets.MaxEntrySLDistance))) || + ((object_name == panel_id + "m_EdtMinEntrySLDistance") && (text != IntegerToString(sets.MinEntrySLDistance))) || + ((object_name == panel_id + "m_EdtMaxPositionSizeTotal") && (CompareDoubles(double_from_text, sets.MaxPositionSizeTotal, 2))) || + ((object_name == panel_id + "m_EdtMaxPositionSizePerSymbol") && (CompareDoubles(double_from_text, sets.MaxPositionSizePerSymbol, 2))) || + ((object_name == panel_id + "m_EdtTrailingStopPoints") && (text != IntegerToString(sets.TrailingStopPoints))) || + ((object_name == panel_id + "m_EdtBreakEvenPoints") && (text != IntegerToString(sets.BreakEvenPoints))) || + ((object_name == panel_id + "m_EdtMaxNumberOfTradesTotal") && (text != IntegerToString(sets.MaxNumberOfTradesTotal))) || + ((object_name == panel_id + "m_EdtMaxNumberOfTradesPerSymbol") && (text != IntegerToString(sets.MaxNumberOfTradesPerSymbol))) || + ((object_name == panel_id + "m_EdtMaxRiskTotal") && (CompareDoubles(double_from_text, sets.MaxRiskTotal, 2))) || + ((object_name == panel_id + "m_EdtMaxRiskPerSymbol") && (CompareDoubles(double_from_text, sets.MaxRiskPerSymbol, 2))) || + ((object_name == panel_id + "m_EdtMaxRiskPercentage") && (CompareDoubles(double_from_text, sets.MaxRiskPercentage, 2))) + ) + { + lparam = ExtDialog.FindControlId(object_name); + if (lparam != -1) + { + OnChartEvent(CHARTEVENT_CUSTOM + ON_END_EDIT, lparam, dparam, object_name); + return; // No need to check anything else. + } + } + + // These edits have numbers at the end because there can be multiple of them. + if (StringSubstr(object_name, 0, StringLen(panel_id + "m_EdtTradingTPEdit")) == panel_id + "m_EdtTradingTPEdit") + { + int num = (int)StringToInteger(StringSubstr(object_name, StringLen(panel_id + "m_EdtTradingTPEdit"))) - 1; + if (CompareDoubles(double_from_text, sets.TP[num])) + { + OnChartEvent(CHARTEVENT_CUSTOM + ON_END_EDIT, lparam, dparam, object_name); + return; + } + } + else if (StringSubstr(object_name, 0, StringLen(panel_id + "m_EdtTradingTPShareEdit")) == panel_id + "m_EdtTradingTPShareEdit") + { + int num = (int)StringToInteger(StringSubstr(object_name, StringLen(panel_id + "m_EdtTradingTPShareEdit"))) - 1; + if (text != IntegerToString(sets.TPShare[num])) + { + OnChartEvent(CHARTEVENT_CUSTOM + ON_END_EDIT, lparam, dparam, object_name); + return; + } + } + else if (StringSubstr(object_name, 0, StringLen(panel_id + "m_EdtAdditionalTPEdits")) == panel_id + "m_EdtAdditionalTPEdits") + { + int num = (int)StringToInteger(StringSubstr(object_name, StringLen(panel_id + "m_EdtAdditionalTPEdits"))) - 2; // -2 because, there is no 1st additional TP edit, there is a normal TP edit in its place. So, the chart object numbering starts at 2, which should be translated to 0th array element. + + if (((!sets.TPDistanceInPoints) && (CompareDoubles(double_from_text, sets.TP[num + 1]))) || + ((sets.TPDistanceInPoints) && (text != IntegerToString((int)MathRound(MathAbs(sets.TP[num + 1] - sets.EntryLevel) / _Point))))) + { + OnChartEvent(CHARTEVENT_CUSTOM + ON_END_EDIT, lparam, dparam, object_name); + return; + } + } + } + } + + // Do checkboxes (bitmap buttons/labels): + int checkboxes_total = ObjectsTotal(0, -1, OBJ_BITMAP_LABEL); + for (int i = 0; i < checkboxes_total; i++) + { + string object_name = ObjectName(0, i, -1, OBJ_BITMAP_LABEL); + + // Special case: Min/Max and Close (X): + if (object_name == panel_id + "MinMax") + { + lparam = ExtDialog.MinMaxButtonId; + if (((bool)ObjectGetInteger(0, object_name, OBJPROP_STATE)) && (!ExtDialog.IsMinimized())) + OnChartEvent(CHARTEVENT_CUSTOM + ON_CLICK, lparam, dparam, object_name); + else if ((!(bool)ObjectGetInteger(0, object_name, OBJPROP_STATE)) && (ExtDialog.IsMinimized())) + OnChartEvent(CHARTEVENT_CUSTOM + ON_CLICK, lparam, dparam, object_name); + return; + } + else if ((object_name == panel_id + "Close") && ((bool)ObjectGetInteger(0, object_name, OBJPROP_STATE))) + { + lparam = 4; + OnChartEvent(CHARTEVENT_CUSTOM + ON_CLICK, lparam, dparam, object_name); + return; + } + + // Looking for 12345m_ChkABCDE object names. + if (StringSubstr(object_name, 0, panel_id_length + 5) != panel_id + "m_Chk") continue; + + bool state = (bool)ObjectGetInteger(0, object_name, OBJPROP_STATE); // Ticked checkbox? + + // The checkbox part has "Button" added to its name. + if (((object_name == panel_id + "m_ChkSpreadAdjustmentSL" + "Button") && (state != sets.SpreadAdjustmentSL)) || + ((object_name == panel_id + "m_ChkSpreadAdjustmentTP" + "Button") && (state != sets.SpreadAdjustmentTP)) || + ((object_name == panel_id + "m_ChkCountPendings" + "Button") && (state != sets.CountPendingOrders)) || + ((object_name == panel_id + "m_ChkDisableTradingWhenLinesAreHidden" + "Button") && (state != sets.DisableTradingWhenLinesAreHidden)) || + ((object_name == panel_id + "m_ChkIgnoreOrdersWithoutSL" + "Button") && (state != sets.IgnoreOrdersWithoutSL)) || + ((object_name == panel_id + "m_ChkIgnoreOrdersWithoutTP" + "Button") && (state != sets.IgnoreOrdersWithoutTP)) || + ((object_name == panel_id + "m_ChkSubtractPositions" + "Button") && (state != sets.SubtractPositions)) || + ((object_name == panel_id + "m_ChkSubtractPendingOrders" + "Button") && (state != sets.SubtractPendingOrders)) || + ((object_name == panel_id + "m_ChkDoNotApplyStopLoss" + "Button") && (state != sets.DoNotApplyStopLoss)) || + ((object_name == panel_id + "m_ChkDoNotApplyTakeProfit" + "Button") && (state != sets.DoNotApplyTakeProfit)) || + ((object_name == panel_id + "m_ChkCommentAutoSuffix" + "Button") && (state != sets.CommentAutoSuffix)) || + ((object_name == panel_id + "m_ChkAskForConfirmation" + "Button") && (state != sets.AskForConfirmation)) + ) + { + object_name = StringSubstr(object_name, 0, StringLen(object_name) - 6); // Remove the "Button" ending. + lparam = ExtDialog.FindControlId(object_name); + if (lparam != -1) + { + OnChartEvent(CHARTEVENT_CUSTOM + ON_CHANGE, lparam, dparam, object_name); + return; // No need to check anything else. + } + } + } +} + +// Safe double comparison. +// Returns true if different. False if equal. +inline bool CompareDoubles(double d1, double d2, int precision = 0) +{ + double min_diff = _Point / 2; + if (precision > 0) min_diff = MathPow(0.1, precision); + if (MathAbs(d1 - d2) < min_diff) return false; + return true; +} +//+------------------------------------------------------------------+ \ No newline at end of file diff --git a/MQL4/Experts/Position Sizer/Translations/Arabic.mqh b/MQL4/Experts/Position Sizer/Translations/Arabic.mqh new file mode 100644 index 0000000..72aec04 --- /dev/null +++ b/MQL4/Experts/Position Sizer/Translations/Arabic.mqh @@ -0,0 +1,279 @@ +// Tabs +#define TRANSLATION_TAB_BUTTON_MAIN "الرئيسي" +#define TRANSLATION_TAB_BUTTON_RISK "المخاطرة" +#define TRANSLATION_TAB_BUTTON_MARGIN "الهامش" +#define TRANSLATION_TAB_BUTTON_SWAPS "السواب" +#define TRANSLATION_TAB_BUTTON_TRADING "التداول" + +// Caption +#define TRANSLATION_LABEL_SPREAD "السبريد" + +// Main tab +// Entry +#define TRANSLATION_LABEL_ENTRY "الدخول" +#define TRANSLATION_BUTTON_LONG "شراء" +#define TRANSLATION_BUTTON_SHORT "بيع" + +#define TRANSLATION_TOOLTIP_BUTTON_LONG_SHORT "التبديل بين الشراء والبيع" + +#define TRANSLATION_TOOLTIP_ENTRY_INCREASE "زيادة سعر الدخول بـ 1 نقطة" +#define TRANSLATION_TOOLTIP_ENTRY_DECREASE "تقليل سعر الدخول بـ 1 نقطة" + +// Stop-loss +#define TRANSLATION_LABEL_STOPLOSS "إيقاف الخسارة" +#define TRANSLATION_BUTTON_SL "إيقاف الخسارة، بالنقاط" + +#define TRANSLATION_TOOLTIP_STOPLOSS_INCREASE "زيادة إيقاف الخسارة بـ 1 نقطة" +#define TRANSLATION_TOOLTIP_STOPLOSS_DECREASE "تقليل إيقاف الخسارة بـ 1 نقطة" + +// Take-profit +#define TRANSLATION_LABEL_TAKEPROFIT "أخذ الربح" +#define TRANSLATION_BUTTON_TP "أخذ الربح، بالنقاط" + +#define TRANSLATION_TOOLTIP_TAKEPROFIT_ADD "أضِف مستوى أخذ الربح" +#define TRANSLATION_TOOLTIP_BUTTON_TP "تعيين TP بناءً على SL أو تفعيل وضع تأمين TP " + +#define TRANSLATION_TOOLTIP_TAKEPROFIT_INCREASE "زيادة أخذ الربح بـ 1 نقطة" +#define TRANSLATION_TOOLTIP_TAKEPROFIT_DECREASE "تقليل أخذ الربح بـ 1 نقطة" + +#define TRANSLATION_LABEL_TAKEPROFIT_MULTIPLE_DISTANCE "أخذ الربح" +#define TRANSLATION_LABEL_TAKEPROFIT_MULTIPLE_POINTS "نقاط" + +#define TRANSLATION_TOOLTIP_TAKEPROFIT_REMOVE "حذف أخذ الربح" + +#define TRANSLATION_TOOLTIP_TAKEPROFIT_INCREASE_MULTIPLE "زيادة أخذ الربح" +#define TRANSLATION_TOOLTIP_TAKEPROFIT_DECREASE_MULTIPLE "تقليل أخذ الربح" +#define TRANSLATION_TOOLTIP_TAKEPROFIT_BY_ONE_POINT "بـ 1 نقطة" + +// ATR options +#define TRANSLATION_LABEL_ATR_PERIOD "فترة ATR" +#define TRANSLATION_BUTTON_ATR_PERIOD_CURRENT "الحالية" +#define TRANSLATION_LABEL_ATR_SL_MULTIPLIER "مُضاعف SL " +#define TRANSLATION_LABEL_ATR_TP_MULTIPLIER "مُضاعف TP " +#define TRANSLATION_CHECKBOX_ATR_SA "تعديل السبريد" +#define TRANSLATION_TOOLTIP_ATR_SA_SL "تطبيق تعديل السبريد على إيقاف الخسارة" +#define TRANSLATION_TOOLTIP_ATR_SA_TP " تطبيق تعديل السبريد على أخذ الربح" +#define TRANSLATION_LABEL_ATR_TIMEFRAME "إطار ATR الزمني" +#define TRANSLATION_LABEL_ATR_VALUE "ATR" + +// Order type +#define TRANSLATION_LABEL_ORDER_TYPE "نوع الأمر" +#define TRANSLATION_BUTTON_ORDER_TYPE_INSTANT "فوري" +#define TRANSLATION_BUTTON_ORDER_TYPE_PENDING "معلق" + +#define TRANSLATION_TOOLTIP_ORDER_TYPE "التبديل بين الفوري والمعلق وحد الإيقاف" + +// Hide/show lines +#define TRANSLATION_BUTTON_HIDE_LINES "إخفاء الخطوط" +#define TRANSLATION_BUTTON_SHOW_LINES "إظهار الخطوط" + +// Commission +#define TRANSLATION_LABEL_COMMISSION "العمولة لكل لوت (جانب واحد)" + +#define TRANSLATION_TOOLTIP_COMMISSION "بعملة الحساب أو %، لكل لوت قياسي" +#define TRANSLATION_TOOLTIP_COMMISSION_TYPE "انقر للتبديل" + +// Account size +#define TRANSLATION_BUTTON_ACCOUNT_BALANCE "رصيد الحساب" +#define TRANSLATION_BUTTON_ACCOUNT_EQUITY "سهم الحساب" +#define TRANSLATION_BUTTON_BALANCE_MINUS_CPR "الرصيد - CPR" + +#define TRANSLATION_TOOLTIP_ACCOUNT_SIZE "التبديل بين الرصيد، والسهم، والرصيد مطروحًا منه مخاطرة المحفظة الحالية" +#define TRANSLATION_TOOLTIP_ACCOUNT_SIZE_ASTERISK_CUSTOM "مجموعة الرصيد المخصص" +#define TRANSLATION_TOOLTIP_ACCOUNT_SIZE_ASTERISK_ADD "أموال إضافية" +#define TRANSLATION_TOOLTIP_ACCOUNT_SIZE_ASTERISK_SUB "الأموال المخصومة" + +// Calculations +#define TRANSLATION_LABEL_INPUT "المدخلات" +#define TRANSLATION_LABEL_RESULT "النتيجة" +#define TRANSLATION_LABEL_RISK "المخاطرة" +#define TRANSLATION_LABEL_MONEY "الأموال" +#define TRANSLATION_LABEL_REWARD "العائد" +#define TRANSLATION_LABEL_REWARD_RISK "العائد/المخاطرة" +#define TRANSLATION_LABEL_POSITION_SIZE "حجم المركز" +#define TRANSLATION_BUTTON_MAX_PS "الحد الأقصى لحجم المركز" +#define TRANSLATION_LABEL_POINT_VALUE "قيمة النقطة" + + +// Risk tab +#define TRANSLATION_CHECKBOX_COUNT_PENDING_ORDERS "عد الأوامر المعلقة" +#define TRANSLATION_CHECKBOX_IGNORE_ORDERS_WO_SL "تجاهل الأوامر بدون إيقاف الخسارة" +#define TRANSLATION_CHECKBOX_IGNORE_ORDERS_WO_TP "تجاهل الأوامر بدون أخذ الربح" +#define TRANSLATION_CHECKBOX_IGNORE_ORDERS_IN_OTHER_SYMBOLS "تجاهل الأوامر في رموز أخرى" +#define TRANSLATION_LABEL_LOTS "لوت" +#define TRANSLATION_LABEL_CURRENT_PORTFOLIO "المحفظة الحالية" +#define TRANSLATION_TOOLTIP_CURRENT_PORTFOLIO "الصفقات المفتوحة حاليًا" +#define TRANSLATION_LABEL_POTENTIAL_PORTFOLIO "المحفظة المحتملة" +#define TRANSLATION_TOOLTIP_POTENTIAL_PORTFOLIO "بما في ذلك المركز الذي يجري حسابه" +#define TRANSLATION_LABEL_CRRR_TOOLTIP "نسبة المخاطرة إلى العائد للمحفظة الحالية" +#define TRANSLATION_LABEL_PRRR_TOOLTIP "نسبة المخاطرة إلى العائد للمحفظة المحتملة" + + +// Margin tab +#define TRANSLATION_LABEL_POSITION_MARGIN "هامش المركز" +#define TRANSLATION_LABEL_FUTURE_USED_MARGIN "الهامش المستخدم المستقبلي" +#define TRANSLATION_LABEL_FUTURE_FREE_MARGIN "الهامش الحر المستقبلي" +#define TRANSLATION_LABEL_CUSTOM_LEVERAGE "الرافعة المالية المخصصة" +#define TRANSLATION_LABEL_DEFAULT "افتراضي" +#define TRANSLATION_LABEL_SYMBOL "الرمز" +#define TRANSLATION_LABEL_MAX_PS_BY_MARGIN "الحد الأقصى لحجم المركز بحسب الهامش" +#define TRANSLATION_TOOLTIP_MAX_PS_BY_MARGIN "باللوت" + + +// Swaps tab +#define TRANSLATION_LABEL_TYPE "النوع" +#define TRANSLATION_LABEL_UNKNOWN "غير معروف" +#define TRANSLATION_LABEL_TRIPLE_SWAP "سواب ثلاثي" +#define TRANSLATION_EDIT_WEEKDAY_SUNDAY "الأحد" +#define TRANSLATION_EDIT_WEEKDAY_MONDAY "الاثنين" +#define TRANSLATION_EDIT_WEEKDAY_TUESDAY "الثلاثاء" +#define TRANSLATION_EDIT_WEEKDAY_WEDNESDAY "الأربعاء" +#define TRANSLATION_EDIT_WEEKDAY_THURSDAY "الخميس" +#define TRANSLATION_EDIT_WEEKDAY_FRIDAY "الجمعة" +#define TRANSLATION_EDIT_WEEKDAY_SATURDAY "السبت" + +#define TRANSLATION_LABEL_NOMINAL "الاسمي" +#define TRANSLATION_LABEL_DAILY "اليومي" +#define TRANSLATION_LABEL_YEARLY "السنوي" +#define TRANSLATION_LABEL_PER_LOT "لكل لوت" +#define TRANSLATION_LABEL_PER_PS "لكل ح م" +#define TRANSLATION_LABEL_BASE_CURRENCY "عملة الأساس" +#define TRANSLATION_LABEL_MARGIN_CURRENCY "عملة الهامش" + + +// Trading tab +#define TRANSLATION_BUTTON_TRADE "تداول" +#define TRANSLATION_LABEL_TRAILING_STOP "إيقاف متحرك" +#define TRANSLATION_LABEL_BREAKEVEN "التعادل" +#define TRANSLATION_LABEL_MAGIC_NUMBER "الرقم السحري" +#define TRANSLATION_LABEL_ORDER_COMMENTARY "تعليق الأمر" +#define TRANSLATION_LABEL_ORDER_AUTOSUFFIX "لاحقة تلقائية" +#define TRANSLATION_TOOLTIP_ORDER_AUTOSUFFIX "هل تريد إضافة رقم تصاعدي تلقائيًا إلى التعليق على كل صفقة جديدة؟" +#define TRANSLATION_LABEL_MAX_NUMBER_OF_TRADES "الحد الأقصى لعدد الصفقات" +#define TRANSLATION_LABEL_TOTAL "الإجمالي" +#define TRANSLATION_LABEL_PER_SYMBOL "لكل رمز" +#define TRANSLATION_LABEL_MAX_VOLUME "الحد الأقصى لحجم التداول" +#define TRANSLATION_LABEL_MAX_RISK "الحد الأقصى للمخاطرة" +#define TRANSLATION_CHECKBOX_DISABLE_TRADING_LINES_HIDDEN "تعطيل التداول عندما تكون الخطوط مخفية" +#define TRANSLATION_TOOLTIP_FILL_INWARD "تعبئة مستويات TPs إضافية على مسافة متساوية بين سعر الدخول وTP الرئيسي" +#define TRANSLATION_TOOLTIP_FILL_OUTWARD "وضع مستويات TPs إضافية بين TP الرئيسي باستخدام نفس المسافة." +#define TRANSLATION_LABEL_SHARE "الحصة" +#define TRANSLATION_TOOLTIP_SHARE "تعبئة حصة الحجم تلقائيًا" +#define TRANSLATION_LABEL_POINTS "نقاط" +#define TRANSLATION_LABEL_MAX_SLIPPAGE "الحد الأقصى للانزلاق السعري" +#define TRANSLATION_LABEL_MAX_SPREAD "الحد الأقصى للسبريد" +#define TRANSLATION_LABEL_MAX_ENTRY_SL_DISTANCE "مسافة الدخول/SLالقصوى" +#define TRANSLATION_LABEL_MIN_ENTRY_SL_DISTANCE "مسافة الدخول/SLالأدنى" +#define TRANSLATION_CHECKBOX_SUBTRACT_OPEN_POSITIONS_VOLUME "اطرح حجم المراكز المفتوحة" +#define TRANSLATION_CHECKBOX_SUBTRACT_PENDING_ORDERS_VOLUME "اطرح حجم الأوامر المعلقة" +#define TRANSLATION_CHECKBOX_DO_NOT_APPLY_STOPLOSS "لا تُطبِق إيقاف الخسارة" +#define TRANSLATION_CHECKBOX_DO_NOT_APPLY_TAKEPROFIT "لا تُطبِق أخذ الربح" +#define TRANSLATION_TOOLTIP_SUBTRACT_OPEN_POSITIONS_VOLUME "سيقوم المستشار الخبير بطرح حجم الصفقات المفتوحة حاليًا من حجم المركز المحسوب قبل فتح صفقة." +#define TRANSLATION_TOOLTIP_SUBTRACT_PENDING_ORDERS_VOLUME "سيقوم المستشار الخبير بطرح حجم الأوامر المعلقة من حجم المركز المحسوب قبل فتح الصفقة." +#define TRANSLATION_TOOLTIP_DO_NOT_APPLY_STOPLOSS "لن يطبق المستشار الخبير إيقاف الخسارة على الصفقة التي يفتحها." +#define TRANSLATION_TOOLTIP_DO_NOT_APPLY_TAKEPROFIT "لن يطبق المستشار الخبير أخذ الربح على الصفقة التي يفتحها." +#define TRANSLATION_CHECKBOX_ASK_FOR_CONFIRMATION "اطلب التأكيد" +#define TRANSLATION_TOOLTIP_ASK_FOR_CONFIRMATION "سيطلب المستشار الخبير التأكيد قبل فتح الصفقة." +#define TRANSLATION_LABEL_EXPIRY "الانتهاء" +#define TRANSLATION_TOOLTIP_EXPIRY "وقت الانتهاء بالدقائق للأمر المعلق التالي الذي تم إنشائه. الحد الأدنى = 10." +#define TRANSLATION_LABEL_MINUTES "الحد الأدنى." +#define TRANSLATION_TOOLTIP_MINUTES "دقائق" + + +// Chart objects +#define TRANSLATION_TOOLTIP_SL_LABEL "مسافة إيقاف الخسارة، نقاط " +#define TRANSLATION_TOOLTIP_TP_LABEL "مسافة أخذ الربح، نقاط" +#define TRANSLATION_TOOLTIP_ENTRY_LABEL "مسافة الدخول، نقاط" +#define TRANSLATION_TOOLTIP_ENTRY_LABEL_ADDITIONAL "حجم المركز، لوت" +#define TRANSLATION_TOOLTIP_OUTSIDE_TRADE_BUTTON "انقر لفتح أمر/مركز." + + +// Warnings +#define TRANSLATION_LABEL_WARNING_TOO_CLOSE "(قريب للغاية!)" +#define TRANSLATION_LABEL_WARNING_WRONG_VALUE "(قيمة خاطئة!)" +#define TRANSLATION_LABEL_WARNING_INVALID_TP "قيمة TP خاطئة" + +#define TRANSLATION_TOOLTIP_WARNING_PS "أكبر من الحد الأقصى لحجم المركز حسب الهامش!" + +// Messages +#define TRANSLATION_MESSAGE_SL_SHOULD_BE_POSITIVE "يجب أن تكون قيمة إيقاف الخسارة موجبة." +#define TRANSLATION_MESSAGE_TRYING_TO_SAVE_FILE "محاولة حفظ الإعدادات في ملف" +#define TRANSLATION_MESSAGE_FAILED_TO_OPEN_FOR_WRITING "فشل في فتح ملف للكتابة" +#define TRANSLATION_MESSAGE_ERROR "خطأ" +#define TRANSLATION_MESSAGE_SAVED_SETTINGS "تم حفظ الإعدادات بنجاح." +#define TRANSLATION_MESSAGE_TRYING_TO_LOAD_FILE "محاولة تحميل الإعدادات من ملف." +#define TRANSLATION_MESSAGE_NO_SETTINGS_FILE_TO_LOAD "لا يوجد ملف إعدادات لتحميله." +#define TRANSLATION_MESSAGE_FAILED_TO_OPEN_FOR_READING "فشل في فتح الملف للقراءة" +#define TRANSLATION_MESSAGE_LOADED_SETTINGS "تم تحميل الإعدادات بنجاح" +#define TRANSLATION_MESSAGE_NO_SETTINGS_FILE_TO_DELETE "لا يوجد ملف إعدادات لحذفه." +#define TRANSLATION_MESSAGE_TRYING_TO_DELETE_FILE "محاولة حذف ملف الإعدادات." +#define TRANSLATION_MESSAGE_FAILED_TO_DELETE_FILE "فشل في حذف الملف" +#define TRANSLATION_MESSAGE_DELETED_SETTINGS " تم حذف ملف الإعدادات بنجاح." +#define TRANSLATION_MESSAGE_DELETED_DUPLICATE_PANEL "حذف كائنات اللوحة ذات البادئة المُكررة" +#define TRANSLATION_MESSAGE_ENTRY_SL_DIFFERENT_NON_ZERO "يجب أن تكون مستويات الدخول وإيقاف الخسارة مختلفة وغير صفرية." +#define TRANSLATION_MESSAGE_ENTRY_SL_DIFFERENT "يجب أن يكون سعر إيقاف الخسارة مختلفًا عن الدخول." +#define TRANSLATION_MESSAGE_CANNOT_RETRIEVE_TICKSIZE "تعذر استعادة حجم المزايدة السعرية لـ" +#define TRANSLATION_MESSAGE_LOOKS_LIKE "يبدو أن الأداة المالية لم تعد متوفرة. قد لا تكون العملية الحسابية دقيقة." +#define TRANSLATION_MESSAGE_MISCONFIGURED_SYMBOL "تكوين الرمز خاطئ في خادم التداول – تكلفة وحدة صفرية." +#define TRANSLATION_MESSAGE_ALGO_TRADING_DISABLED "تم تعطيل التداول الآلي! يرجى تفعيله." +#define TRANSLATION_MESSAGE_STOPLOSS_PROBLEM "مشكلة في إيقاف الخسارة" +#define TRANSLATION_MESSAGE_WRONG_POSITION_SIZE_VALUE "قيمة حجم المركز خاطئة!" +#define TRANSLATION_MESSAGE_MULTIPLE_TP_VOLUME_SHARE_SUM "مجموع حصة حجم مستويات TPs متعددة" +#define TRANSLATION_MESSAGE_INCORRECT_VOLUME_SUM "مجموع حجم التداول لمستويات TPs المتعددة خاطئ – لا يفتح أي صفقات." +#define TRANSLATION_MESSAGE_NOT_TAKING_A_TRADE "لا يفتح صفقات" +#define TRANSLATION_MESSAGE_NTAT_LINES "الخطوط مخفية، وتم تعيين اللوحة على وضع عدم التداول عندما تكون مخفية." +#define TRANSLATION_MESSAGE_NTAT_SPREAD "السبريد الحالي" +#define TRANSLATION_MESSAGE_MAXIMUM_SPREAD "الحد الأقصى للسبريد" +#define TRANSLATION_MESSAGE_NTAT_ENTRY_SL_DISTANCE "مسافة الدخول/إيقاف الخسارة الحالية" +#define TRANSLATION_MESSAGE_NTAT_TOTAL_NUMBER "إجمالي عدد الصفقات الحالية" +#define TRANSLATION_MESSAGE_NUMBER_OF_TRADES_IN_EXECUTION "عدد الصفقات قيد التنفيذ" +#define TRANSLATION_MESSAGE_MAXIMUM_TOTAL_NUMBER_OF_TRADES_ALLOWED "الحد الأقصى لعدد الصفقات المسموح بها" +#define TRANSLATION_MESSAGE_NTAT_PER_SYMBOL_NUMBER "عدد الصفقات الحالية لكل رمز" +#define TRANSLATION_MESSAGE_MAXIMUM_PER_SYMBOL_NUMBER_OF_TRADES_ALLOWED "الحد الأقصى المسموح به لعدد الصفقات لكل رمز" +#define TRANSLATION_MESSAGE_TOTAL_POTENTIAL_RISK "إجمالي المخاطر المحتملة" +#define TRANSLATION_MESSAGE_MAXIUMUM_TOTAL_RISK "الحد الأقصى لإجمالي المخاطر المسموح بها" +#define TRANSLATION_MESSAGE_INFINITE_TOTAL_POTENTIAL_RISK "إجمالي المخاطر اللانهائية المحتملة" +#define TRANSLATION_MESSAGE_PER_SYMBOL_POTENTIAL_RISK "المخاطرة المحتملة لكل رمز" +#define TRANSLATION_MESSAGE_MAXIMUM_PER_SYMBOL_RISK "الحد الأقصى للمخاطرة المسموح بها لكل رمز" +#define TRANSLATION_MESSAGE_INFINITE_PER_SYMBOL_POTENTIAL_RISK "المخاطرة اللانهائية المحتملة لكل رمز" +#define TRANSLATION_MESSAGE_IGNORE_MARKET_EXECUTION_MODE_WARNING "، ولكن IgnoreMarketExecutionMode = true. قم بالتبديل إلى false إذا لم يتم تنفيذ الصفقة." +#define TRANSLATION_MESSAGE_EXECUTION_MODE "وضع التنفيذ" +#define TRANSLATION_MESSAGE_FOUND_EXISTING_BUY_VOLUME "تم العثور على حجم الشراء الموجود" +#define TRANSLATION_MESSAGE_FOUND_EXISTING_SELL_VOLUME "تم العثور على حجم البيع الموجود" +#define TRANSLATION_MESSAGE_ADJUSTED_POSITION_SIZE "حجم المركز المُعدل" +#define TRANSLATION_MESSAGE_ADJUSTED_POSITION_SIZE_LESS_THAN_ZERO "حجم المركز المُعدل أقل من الصفر. لا يجري تنفيذ أي صفقة." +#define TRANSLATION_MESSAGE_NTAT_TOTAL_VOLUME "إجمالي حجم التداول الحالي" +#define TRANSLATION_MESSAGE_NTAT_NEW_POSITION_VOLUME "حجم المركز الجديد" +#define TRANSLATION_MESSAGE_NTAT_MAXIMUM_TOTAL_VOLUME "الحد الأقصى لإجمالي الحجم المسموح به" +#define TRANSLATION_MESSAGE_NTAT_PER_SYMBOL_VOLUME "الحجم الحالي لكل رمز" +#define TRANSLATION_MESSAGE_NTAT_MAXIMUM_PER_SYMBOL_VOLUME " الحد الأقصى لحجم المركز لكل رمز " +#define TRANSLATION_MESSAGE_BROKER_MINIMUM "الحد الأدنى لحجم المركز لدى الوسيط. لا يتم تنفيذ الصفقة." +#define TRANSLATION_MESSAGE_BROKER_MAXIMUM "الحد الأقصى لحجم المركز لدى الوسيط. تقليل الحجم." +#define TRANSLATION_MESSAGE_ERROR_SENDING_ORDER "خطأ في إرسال الأمر" +#define TRANSLATION_MESSAGE_ORDER_EXECUTED "تم تنفيذ الأمر." +#define TRANSLATION_MESSAGE_TICKET "التذكرة" +#define TRANSLATION_MESSAGE_ORDER "الأمر" +#define TRANSLATION_MESSAGE_EXECUTED "مُنفذ" +#define TRANSLATION_MESSAGE_ERROR_OPENING_POSITION "خطأ في فتح المركز" +#define TRANSLATION_MESSAGE_POSITION_SIZER_ON "مُحدد حجم المركز على" +#define TRANSLATION_MESSAGE_EXECUTE_TRADE "هل تريد تنفيذ الصفقة؟" +#define TRANSLATION_MESSAGE_BUY "شراء" +#define TRANSLATION_MESSAGE_BUY_STOP "شراء موقوف" +#define TRANSLATION_MESSAGE_BUY_LIMIT "شراء الحد" +#define TRANSLATION_MESSAGE_SELL "بيع" +#define TRANSLATION_MESSAGE_SELL_STOP "بيع موقوف" +#define TRANSLATION_MESSAGE_SELL_LIMIT "حد البيع" +#define TRANSLATION_MESSAGE_SIZE "الحجم" +#define TRANSLATION_MESSAGE_MULTIPLE "متعدد" +#define TRANSLATION_MESSAGE_TRADE_CANCELED "صفقة مُلغاة." +#define TRANSLATION_MESSAGE_TSL_APPLIED "تم تطبيق الإيقاف المتحرك على المركز" +#define TRANSLATION_MESSAGE_SL_WAS_MOVED_FROM "تم تحريك إيقاف الخسارة من" +#define TRANSLATION_MESSAGE_SL_WAS_MOVED_TO "إلى" +#define TRANSLATION_MESSAGE_BE_APPLIED "تم تطبيق التعادل على المركز" +#define TRANSLATION_MESSAGE_BE_FOR "نقطة التعادل لـ" +#define TRANSLATION_MESSAGE_ERROR_SETTING_TIMER "خطأ في ضبط المؤقت" +#define TRANSLATION_MESSAGE_FAILED_DELETE_INI "فشل في حذف ملف .ini للوحة حجم المركز" +#define TRANSLATION_MESSAGE_MINIMUM_EXPIRY "الحد الأدنى لفترة انتهاء الصلاحية هو دقيقتين." +#define TRANSLATION_MESSAGE_DONOTAPPLLYSL_SET "تم تحديد مربع الاختيار ’عدم تطبيق إيقاف الخسارة‘. " +#define TRANSLATION_MESSAGE_DONOTAPPLLYTP_SET "تم تحديد مربع الاختيار ’عدم تطبيق أخذ الربح‘." +#define TRANSLATION_MESSAGE_FAILED_TO_CREATE_OUTSIDE_BUTTON "فشل في إنشاء زر خارجي." \ No newline at end of file diff --git a/MQL4/Experts/Position Sizer/Translations/Chinese.mqh b/MQL4/Experts/Position Sizer/Translations/Chinese.mqh new file mode 100644 index 0000000..19d2e02 --- /dev/null +++ b/MQL4/Experts/Position Sizer/Translations/Chinese.mqh @@ -0,0 +1,260 @@ +#define TRANSLATION_TAB_BUTTON_MAIN "主选项" +#define TRANSLATION_TAB_BUTTON_RISK "风险" +#define TRANSLATION_TAB_BUTTON_MARGIN "保证金" +#define TRANSLATION_TAB_BUTTON_SWAPS "掉期" +#define TRANSLATION_TAB_BUTTON_TRADING "交易" + +#define TRANSLATION_LABEL_SPREAD "点差" + +#define TRANSLATION_LABEL_ENTRY "入场位" + +#define TRANSLATION_BUTTON_LONG "做多" +#define TRANSLATION_BUTTON_SHORT "做空" + +#define TRANSLATION_TOOLTIP_BUTTON_LONG_SHORT "在做多与做空之间切换" + +#define TRANSLATION_TOOLTIP_ENTRY_INCREASE "入场位增加1点" +#define TRANSLATION_TOOLTIP_ENTRY_DECREASE "入场位减少1点" + +#define TRANSLATION_LABEL_STOPLOSS "止损位" +#define TRANSLATION_BUTTON_SL "止损位,点数" + +#define TRANSLATION_TOOLTIP_STOPLOSS_INCREASE "止损位增加1点" +#define TRANSLATION_TOOLTIP_STOPLOSS_DECREASE "止损位减少1点" + +#define TRANSLATION_LABEL_TAKEPROFIT "止盈位" +#define TRANSLATION_BUTTON_TP "止盈位,点数" + +#define TRANSLATION_TOOLTIP_TAKEPROFIT_ADD "添加止盈位" +#define TRANSLATION_TOOLTIP_BUTTON_TP "让止盈位基于止损位或启用锁定止盈位模式 " + +#define TRANSLATION_TOOLTIP_TAKEPROFIT_INCREASE "止盈位增加1点" +#define TRANSLATION_TOOLTIP_TAKEPROFIT_DECREASE "止损位减少1点" + +#define TRANSLATION_LABEL_TAKEPROFIT_MULTIPLE_DISTANCE "止盈位" +#define TRANSLATION_LABEL_TAKEPROFIT_MULTIPLE_POINTS "点数" + +#define TRANSLATION_TOOLTIP_TAKEPROFIT_REMOVE "移除止盈位" + +#define TRANSLATION_TOOLTIP_TAKEPROFIT_INCREASE_MULTIPLE "止盈位增加" +#define TRANSLATION_TOOLTIP_TAKEPROFIT_DECREASE_MULTIPLE "止盈位减少" +#define TRANSLATION_TOOLTIP_TAKEPROFIT_BY_ONE_POINT "1点" + +#define TRANSLATION_LABEL_ATR_PERIOD "ATR时段" +#define TRANSLATION_BUTTON_ATR_PERIOD_CURRENT "当前时段" +#define TRANSLATION_LABEL_ATR_SL_MULTIPLIER "止损乘数" +#define TRANSLATION_LABEL_ATR_TP_MULTIPLIER "止盈乘数" + +#define TRANSLATION_CHECKBOX_ATR_SA "点差调整" +#define TRANSLATION_TOOLTIP_ATR_SA_SL "将点差调整应用至止损位" +#define TRANSLATION_TOOLTIP_ATR_SA_TP "将点差调整应用至止盈位" + +#define TRANSLATION_LABEL_ATR_TIMEFRAME "ATR时间周期" +#define TRANSLATION_LABEL_ATR_VALUE "ATR" + +#define TRANSLATION_LABEL_ORDER_TYPE "订单类型" + +#define TRANSLATION_BUTTON_ORDER_TYPE_INSTANT "即时单" +#define TRANSLATION_BUTTON_ORDER_TYPE_PENDING "挂单" + +#define TRANSLATION_TOOLTIP_ORDER_TYPE "在即时单、挂单、限价止损单之间切换" + +#define TRANSLATION_BUTTON_HIDE_LINES "隐藏线" +#define TRANSLATION_BUTTON_SHOW_LINES "显示线" + +#define TRANSLATION_LABEL_COMMISSION "每手佣金(单向)" + +#define TRANSLATION_TOOLTIP_COMMISSION "以账户币种或百分比计算,每1标准手" +#define TRANSLATION_TOOLTIP_COMMISSION_TYPE "点击切换" + +#define TRANSLATION_BUTTON_ACCOUNT_BALANCE "账户余额" +#define TRANSLATION_BUTTON_ACCOUNT_EQUITY "账户净值" +#define TRANSLATION_BUTTON_BALANCE_MINUS_CPR "余额 - CPR" + +#define TRANSLATION_TOOLTIP_ACCOUNT_SIZE "在余额、净值、余额减当前投资组合风险之间切换" +#define TRANSLATION_TOOLTIP_ACCOUNT_SIZE_ASTERISK_CUSTOM "自定义余额设置" +#define TRANSLATION_TOOLTIP_ACCOUNT_SIZE_ASTERISK_ADD "追加资金" +#define TRANSLATION_TOOLTIP_ACCOUNT_SIZE_ASTERISK_SUB "减去资金" + +#define TRANSLATION_LABEL_INPUT "输入" +#define TRANSLATION_LABEL_RESULT "结果" +#define TRANSLATION_LABEL_RISK "风险" +#define TRANSLATION_LABEL_MONEY "资金" +#define TRANSLATION_LABEL_REWARD "回报" +#define TRANSLATION_LABEL_REWARD_RISK "回报/风险" +#define TRANSLATION_LABEL_POSITION_SIZE "头寸数量" +#define TRANSLATION_BUTTON_MAX_PS "最大PS" +#define TRANSLATION_LABEL_POINT_VALUE "点数值" + +#define TRANSLATION_CHECKBOX_COUNT_PENDING_ORDERS "统计挂单" +#define TRANSLATION_CHECKBOX_IGNORE_ORDERS_WO_SL "忽略无止损位订单" +#define TRANSLATION_CHECKBOX_IGNORE_ORDERS_WO_TP "忽略无止盈位订单" +#define TRANSLATION_CHECKBOX_IGNORE_ORDERS_IN_OTHER_SYMBOLS "忽略其他交易品种的订单" + +#define TRANSLATION_LABEL_LOTS "手数" +#define TRANSLATION_LABEL_CURRENT_PORTFOLIO "当前投资组合" +#define TRANSLATION_TOOLTIP_CURRENT_PORTFOLIO "当前未平仓交易" +#define TRANSLATION_LABEL_POTENTIAL_PORTFOLIO "潜力投资组合" +#define TRANSLATION_TOOLTIP_POTENTIAL_PORTFOLIO "包括正在计算的头寸" +#define TRANSLATION_LABEL_CRRR_TOOLTIP "当前投资组合的风险回报比率" +#define TRANSLATION_LABEL_PRRR_TOOLTIP "潜在投资组合的风险回报比率" + +#define TRANSLATION_LABEL_POSITION_MARGIN "头寸保证金" +#define TRANSLATION_LABEL_FUTURE_USED_MARGIN "未来的已用保证金" +#define TRANSLATION_LABEL_FUTURE_FREE_MARGIN "未来的可用保证金" +#define TRANSLATION_LABEL_CUSTOM_LEVERAGE "自定义杠杆" + +#define TRANSLATION_LABEL_DEFAULT "默认" +#define TRANSLATION_LABEL_SYMBOL "交易品种" +#define TRANSLATION_LABEL_MAX_PS_BY_MARGIN "按保证金计算的最大头寸数量" + +#define TRANSLATION_TOOLTIP_MAX_PS_BY_MARGIN "以手数计" + +#define TRANSLATION_LABEL_TYPE "类型" +#define TRANSLATION_LABEL_TRIPLE_SWAP "三倍掉期" +#define TRANSLATION_EDIT_WEEKDAY_SUNDAY "周日" +#define TRANSLATION_EDIT_WEEKDAY_MONDAY "周一" +#define TRANSLATION_EDIT_WEEKDAY_TUESDAY "周二" +#define TRANSLATION_EDIT_WEEKDAY_WEDNESDAY "周三" +#define TRANSLATION_EDIT_WEEKDAY_THURSDAY "周四" +#define TRANSLATION_EDIT_WEEKDAY_FRIDAY "周五" +#define TRANSLATION_EDIT_WEEKDAY_SATURDAY "周六" + +#define TRANSLATION_LABEL_NOMINAL "名义" +#define TRANSLATION_LABEL_DAILY "每日" +#define TRANSLATION_LABEL_YEARLY "每年" +#define TRANSLATION_LABEL_PER_LOT "每手" +#define TRANSLATION_LABEL_PER_PS "每PS" +#define TRANSLATION_LABEL_BASE_CURRENCY "基准货币" +#define TRANSLATION_LABEL_MARGIN_CURRENCY "保证金货币" + +#define TRANSLATION_BUTTON_TRADE "交易" +#define TRANSLATION_LABEL_TRAILING_STOP "移动止损" +#define TRANSLATION_LABEL_BREAKEVEN "盈亏平衡" +#define TRANSLATION_LABEL_MAGIC_NUMBER "幻数" +#define TRANSLATION_LABEL_ORDER_COMMENTARY "订单注释" +#define TRANSLATION_LABEL_ORDER_AUTOSUFFIX "自动后缀" +#define TRANSLATION_TOOLTIP_ORDER_AUTOSUFFIX "为每笔新交易的注释添加自动递增数字?" +#define TRANSLATION_LABEL_MAX_NUMBER_OF_TRADES "最大交易数" +#define TRANSLATION_LABEL_TOTAL "总共" +#define TRANSLATION_LABEL_PER_SYMBOL "每品种" +#define TRANSLATION_LABEL_MAX_VOLUME "最大交易量" +#define TRANSLATION_LABEL_MAX_RISK "最大风险" +#define TRANSLATION_CHECKBOX_DISABLE_TRADING_LINES_HIDDEN "当线条被隐藏时禁用交易" +#define TRANSLATION_TOOLTIP_FILL_INWARD "在入场位与主止盈位之间等距填充追加止盈位。" +#define TRANSLATION_TOOLTIP_FILL_OUTWARD "用相同的距离在主止盈位之外设置追加止盈位。" +#define TRANSLATION_LABEL_SHARE "份额" +#define TRANSLATION_TOOLTIP_SHARE "自动填充交易量份额" +#define TRANSLATION_LABEL_POINTS "点数" +#define TRANSLATION_LABEL_MAX_SLIPPAGE "最大滑点" +#define TRANSLATION_LABEL_MAX_SPREAD "最大点差" +#define TRANSLATION_LABEL_MAX_ENTRY_SL_DISTANCE "最大入场位/止损距离" +#define TRANSLATION_LABEL_MIN_ENTRY_SL_DISTANCE "最小入场位/止损距离" +#define TRANSLATION_CHECKBOX_SUBTRACT_OPEN_POSITIONS_VOLUME "减去未平仓头寸数量" +#define TRANSLATION_CHECKBOX_SUBTRACT_PENDING_ORDERS_VOLUME "减去挂单量" +#define TRANSLATION_CHECKBOX_DO_NOT_APPLY_STOPLOSS "不应用止损位" +#define TRANSLATION_CHECKBOX_DO_NOT_APPLY_TAKEPROFIT "不应用止盈位" +#define TRANSLATION_TOOLTIP_SUBTRACT_OPEN_POSITIONS_VOLUME "开始交易前,EA 将从计算的头寸数量中减去当前未平仓交易量。" +#define TRANSLATION_TOOLTIP_SUBTRACT_PENDING_ORDERS_VOLUME "开始交易前,EA 将从计算的头寸数量中减去挂单量。" +#define TRANSLATION_TOOLTIP_DO_NOT_APPLY_STOPLOSS "EA 不会对它开立的交易应用止损位。" +#define TRANSLATION_TOOLTIP_DO_NOT_APPLY_TAKEPROFIT "EA 不会对它开立的交易应用止盈位。" +#define TRANSLATION_CHECKBOX_ASK_FOR_CONFIRMATION "要求确认" +#define TRANSLATION_TOOLTIP_ASK_FOR_CONFIRMATION "EA 将在开立交易前要求确认。" +#define TRANSLATION_LABEL_EXPIRY "到期" +#define TRANSLATION_TOOLTIP_EXPIRY "下一个已创建挂单的到期时间(以分钟为单位)。最小值=10。" +#define TRANSLATION_LABEL_MINUTES "分钟" +#define TRANSLATION_TOOLTIP_MINUTES "分钟" + +#define TRANSLATION_TOOLTIP_SL_LABEL "止损距离,点数" +#define TRANSLATION_TOOLTIP_TP_LABEL "止盈距离,点数" +#define TRANSLATION_TOOLTIP_ENTRY_LABEL "入场距离,点数" +#define TRANSLATION_TOOLTIP_ENTRY_LABEL_ADDITIONAL "头寸数量,手数" +#define TRANSLATION_TOOLTIP_OUTSIDE_TRADE_BUTTON "点击可打开订单/头寸。" + +#define TRANSLATION_LABEL_WARNING_TOO_CLOSE "(太接近!)" +#define TRANSLATION_LABEL_WARNING_WRONG_VALUE "(错误值!)" +#define TRANSLATION_LABEL_WARNING_INVALID_TP "无效止盈位" + +#define TRANSLATION_TOOLTIP_WARNING_PS "大于按保证金计算的最大头寸数量" + +#define TRANSLATION_MESSAGE_SL_SHOULD_BE_POSITIVE "止损位应为正值。" +#define TRANSLATION_MESSAGE_TRYING_TO_SAVE_FILE "尝试将设置保存至文件" +#define TRANSLATION_MESSAGE_FAILED_TO_OPEN_FOR_WRITING "无法打开文件进行写入" +#define TRANSLATION_MESSAGE_ERROR "错误" +#define TRANSLATION_MESSAGE_SAVED_SETTINGS "已成功保存设置。" +#define TRANSLATION_MESSAGE_TRYING_TO_LOAD_FILE "尝试从文件加载设置。" +#define TRANSLATION_MESSAGE_NO_SETTINGS_FILE_TO_LOAD "没有可加载的设置文件。" +#define TRANSLATION_MESSAGE_FAILED_TO_OPEN_FOR_READING "无法打开文件进行读取" +#define TRANSLATION_MESSAGE_LOADED_SETTINGS "已成功加载设置。" +#define TRANSLATION_MESSAGE_NO_SETTINGS_FILE_TO_DELETE "没有可删除的设置文件。" +#define TRANSLATION_MESSAGE_TRYING_TO_DELETE_FILE "尝试删除设置文件。" +#define TRANSLATION_MESSAGE_FAILED_TO_DELETE_FILE "文件删除失败" +#define TRANSLATION_MESSAGE_DELETED_SETTINGS "已成功删除设置文件。" +#define TRANSLATION_MESSAGE_DELETED_DUPLICATE_PANEL "删除了带有前缀的重复面板对象。" +#define TRANSLATION_MESSAGE_ENTRY_SL_DIFFERENT_NON_ZERO "入场位与止损位应不相同,且为非零值。" +#define TRANSLATION_MESSAGE_ENTRY_SL_DIFFERENT "止损位应与入场位不相同。" +#define TRANSLATION_MESSAGE_CANNOT_RETRIEVE_TICKSIZE "无法检索跳动点的大小" +#define TRANSLATION_MESSAGE_LOOKS_LIKE "这项工具似乎已不可用。计算可能有误。" +#define TRANSLATION_MESSAGE_MISCONFIGURED_SYMBOL "交易服务器上的交易品种配置错误 - 零单位成本。" +#define TRANSLATION_MESSAGE_ALGO_TRADING_DISABLED "算法交易被禁用!请开启算法交易。" +#define TRANSLATION_MESSAGE_STOPLOSS_PROBLEM "止损问题" +#define TRANSLATION_MESSAGE_WRONG_POSITION_SIZE_VALUE "头寸数量值错误!" +#define TRANSLATION_MESSAGE_MULTIPLE_TP_VOLUME_SHARE_SUM "多个止盈交易量份额的总和" +#define TRANSLATION_MESSAGE_INCORRECT_VOLUME_SUM "多个止盈交易量份额的总和错误 - 未进行任何交易。" +#define TRANSLATION_MESSAGE_NOT_TAKING_A_TRADE "未进行交易" +#define TRANSLATION_MESSAGE_NTAT_LINES "线条被隐藏,面板被设为在线条隐藏时不做交易。" +#define TRANSLATION_MESSAGE_NTAT_SPREAD "当前点差" +#define TRANSLATION_MESSAGE_MAXIMUM_SPREAD "最大点差" +#define TRANSLATION_MESSAGE_NTAT_ENTRY_SL_DISTANCE "当前入场位/止损距离" +#define TRANSLATION_MESSAGE_NTAT_TOTAL_NUMBER "当前交易总数" +#define TRANSLATION_MESSAGE_NUMBER_OF_TRADES_IN_EXECUTION "执行中的交易数量" +#define TRANSLATION_MESSAGE_MAXIMUM_TOTAL_NUMBER_OF_TRADES_ALLOWED "允许的最大交易总数" +#define TRANSLATION_MESSAGE_NTAT_PER_SYMBOL_NUMBER "每个交易品种的当前交易数量" +#define TRANSLATION_MESSAGE_MAXIMUM_PER_SYMBOL_NUMBER_OF_TRADES_ALLOWED "每个交易品种允许的最大交易数量" +#define TRANSLATION_MESSAGE_TOTAL_POTENTIAL_RISK "总潜在风险" +#define TRANSLATION_MESSAGE_MAXIUMUM_TOTAL_RISK "允许的最大风险总量" +#define TRANSLATION_MESSAGE_INFINITE_TOTAL_POTENTIAL_RISK "无限潜在风险总量" +#define TRANSLATION_MESSAGE_PER_SYMBOL_POTENTIAL_RISK "每个交易品种的潜在风险" +#define TRANSLATION_MESSAGE_MAXIMUM_PER_SYMBOL_RISK "每个交易品种允许的最大风险" +#define TRANSLATION_MESSAGE_INFINITE_PER_SYMBOL_POTENTIAL_RISK "每个交易品种的无限潜在风险" +#define TRANSLATION_MESSAGE_IGNORE_MARKET_EXECUTION_MODE_WARNING ",但 IgnoreMarketExecutionMode = true。如果交易未执行,则切换为 false。" +#define TRANSLATION_MESSAGE_EXECUTION_MODE "执行模式" +#define TRANSLATION_MESSAGE_FOUND_EXISTING_BUY_VOLUME "发现现有买入量" +#define TRANSLATION_MESSAGE_FOUND_EXISTING_SELL_VOLUME "发现现有卖出量" +#define TRANSLATION_MESSAGE_ADJUSTED_POSITION_SIZE "调整头寸数量" +#define TRANSLATION_MESSAGE_ADJUSTED_POSITION_SIZE_LESS_THAN_ZERO "调整后的头寸数量小于零。不会执行任何交易。" +#define TRANSLATION_MESSAGE_NTAT_TOTAL_VOLUME "当前总交易量" +#define TRANSLATION_MESSAGE_NTAT_NEW_POSITION_VOLUME "新头寸量" +#define TRANSLATION_MESSAGE_NTAT_MAXIMUM_TOTAL_VOLUME "允许的最大总交易量" +#define TRANSLATION_MESSAGE_NTAT_PER_SYMBOL_VOLUME "每个交易品种的当前交易量" +#define TRANSLATION_MESSAGE_NTAT_MAXIMUM_PER_SYMBOL_VOLUME "每个交易品种允许的最大交易量" +#define TRANSLATION_MESSAGE_BROKER_MINIMUM "经纪商的最小头寸规模。不会执行交易。" +#define TRANSLATION_MESSAGE_BROKER_MAXIMUM "经纪商的最大头寸规模。减少它。" +#define TRANSLATION_MESSAGE_ERROR_SENDING_ORDER "发送订单出错" +#define TRANSLATION_MESSAGE_ORDER_EXECUTED "订单已执行。" +#define TRANSLATION_MESSAGE_TICKET "凭据" +#define TRANSLATION_MESSAGE_ORDER "订单" +#define TRANSLATION_MESSAGE_EXECUTED "已执行" +#define TRANSLATION_MESSAGE_ERROR_OPENING_POSITION "开立头寸出错" +#define TRANSLATION_MESSAGE_POSITION_SIZER_ON "头寸数量计算器用于" +#define TRANSLATION_MESSAGE_EXECUTE_TRADE "执行交易吗?" +#define TRANSLATION_MESSAGE_BUY "买入" +#define TRANSLATION_MESSAGE_BUY_STOP "买入止损" +#define TRANSLATION_MESSAGE_BUY_LIMIT "买入限价" +#define TRANSLATION_MESSAGE_SELL "卖出" +#define TRANSLATION_MESSAGE_SELL_STOP "卖出止损" +#define TRANSLATION_MESSAGE_SELL_LIMIT "卖出限价" +#define TRANSLATION_MESSAGE_SIZE "规模" +#define TRANSLATION_MESSAGE_MULTIPLE "多个" +#define TRANSLATION_MESSAGE_TRADE_CANCELED "交易取消。" +#define TRANSLATION_MESSAGE_TSL_APPLIED "移动止损已应用于头寸" +#define TRANSLATION_MESSAGE_SL_WAS_MOVED_FROM "止损位的移动是从" +#define TRANSLATION_MESSAGE_SL_WAS_MOVED_TO "至" +#define TRANSLATION_MESSAGE_BE_APPLIED "盈亏平衡被应用至头寸" +#define TRANSLATION_MESSAGE_BE_FOR "盈亏平衡用于" +#define TRANSLATION_MESSAGE_ERROR_SETTING_TIMER "设置计时器时出错" +#define TRANSLATION_MESSAGE_FAILED_DELETE_INI "无法删除PS面板的.ini文件" +#define TRANSLATION_MESSAGE_MINIMUM_EXPIRY "最短到期时间为 2 分钟。" +#define TRANSLATION_MESSAGE_DONOTAPPLLYSL_SET "'不应用止损位'复选框被选中。" +#define TRANSLATION_MESSAGE_DONOTAPPLLYTP_SET "'不应用止盈位'复选框被选中。" +#define TRANSLATION_MESSAGE_FAILED_TO_CREATE_OUTSIDE_BUTTON "无法创建外部按钮。" \ No newline at end of file diff --git a/MQL4/Experts/Position Sizer/Translations/ChineseTraditional.mqh b/MQL4/Experts/Position Sizer/Translations/ChineseTraditional.mqh new file mode 100644 index 0000000..d8f2476 --- /dev/null +++ b/MQL4/Experts/Position Sizer/Translations/ChineseTraditional.mqh @@ -0,0 +1,257 @@ +#define TRANSLATION_TAB_BUTTON_MAIN "主選項" +#define TRANSLATION_TAB_BUTTON_RISK "風險" +#define TRANSLATION_TAB_BUTTON_MARGIN "保證金" +#define TRANSLATION_TAB_BUTTON_SWAPS "利息" +#define TRANSLATION_TAB_BUTTON_TRADING "交易" + +#define TRANSLATION_LABEL_SPREAD "點差" + +#define TRANSLATION_LABEL_ENTRY "入場位" + +#define TRANSLATION_BUTTON_LONG "做多" +#define TRANSLATION_BUTTON_SHORT "做空" + +#define TRANSLATION_TOOLTIP_BUTTON_LONG_SHORT "在做多與做空之間切換" + +#define TRANSLATION_TOOLTIP_ENTRY_INCREASE "入場位增加1點" +#define TRANSLATION_TOOLTIP_ENTRY_DECREASE "入場位元減少1點" + +#define TRANSLATION_LABEL_STOPLOSS "停損位元" +#define TRANSLATION_BUTTON_SL "停損位,點數" + +#define TRANSLATION_TOOLTIP_STOPLOSS_INCREASE "停損位元增加1點" +#define TRANSLATION_TOOLTIP_STOPLOSS_DECREASE "停損位元減少1點" + +#define TRANSLATION_LABEL_TAKEPROFIT "止盈位元" +#define TRANSLATION_BUTTON_TP "止盈位,點數" + +#define TRANSLATION_TOOLTIP_TAKEPROFIT_ADD "新增止盈位元" +#define TRANSLATION_TOOLTIP_BUTTON_TP "讓停盈位元基於停損位元或啟用鎖定止盈位元模式" + +#define TRANSLATION_TOOLTIP_TAKEPROFIT_INCREASE "止盈位元增加1點" +#define TRANSLATION_TOOLTIP_TAKEPROFIT_DECREASE "停損位元減少1點" + +#define TRANSLATION_LABEL_TAKEPROFIT_MULTIPLE_DISTANCE "止盈位元" +#define TRANSLATION_LABEL_TAKEPROFIT_MULTIPLE_POINTS "點數" + +#define TRANSLATION_TOOLTIP_TAKEPROFIT_REMOVE "移除止盈位元" + +#define TRANSLATION_TOOLTIP_TAKEPROFIT_INCREASE_MULTIPLE "止盈位增加" +#define TRANSLATION_TOOLTIP_TAKEPROFIT_DECREASE_MULTIPLE "止盈位元減少" +#define TRANSLATION_TOOLTIP_TAKEPROFIT_BY_ONE_POINT "1點" + +#define TRANSLATION_LABEL_ATR_PERIOD "ATR時段" +#define TRANSLATION_BUTTON_ATR_PERIOD_CURRENT "目前時段" +#define TRANSLATION_LABEL_ATR_SL_MULTIPLIER "停損乘數" +#define TRANSLATION_LABEL_ATR_TP_MULTIPLIER "止盈乘數" + +#define TRANSLATION_CHECKBOX_ATR_SA "點差調整" +#define TRANSLATION_TOOLTIP_ATR_SA_SL "將點差調整套用到停損位元" +#define TRANSLATION_TOOLTIP_ATR_SA_TP "將點差調整套用至止盈位元" + +#define TRANSLATION_LABEL_ATR_TIMEFRAME "ATR時間週期" +#define TRANSLATION_LABEL_ATR_VALUE "ATR" + +#define TRANSLATION_LABEL_ORDER_TYPE "訂單類型" + +#define TRANSLATION_BUTTON_ORDER_TYPE_INSTANT "即時單" +#define TRANSLATION_BUTTON_ORDER_TYPE_PENDING "掛單" + +#define TRANSLATION_TOOLTIP_ORDER_TYPE "在即時單、掛單、限價停損單之間切換" + +#define TRANSLATION_BUTTON_HIDE_LINES "隱藏線" +#define TRANSLATION_BUTTON_SHOW_LINES "顯示線" + +#define TRANSLATION_LABEL_COMMISSION "每手佣金(單向)" + +#define TRANSLATION_TOOLTIP_COMMISSION "以帳戶幣種或百分比計算,每1標準手" +#define TRANSLATION_TOOLTIP_COMMISSION_TYPE "點擊切換" + +#define TRANSLATION_BUTTON_ACCOUNT_BALANCE "帳戶餘額" +#define TRANSLATION_BUTTON_ACCOUNT_EQUITY "帳戶淨值" +#define TRANSLATION_BUTTON_BALANCE_MINUS_CPR "餘額- CPR" + +#define TRANSLATION_TOOLTIP_ACCOUNT_SIZE "在餘額、淨值、餘額減當前投資組合風險之間切換" +#define TRANSLATION_TOOLTIP_ACCOUNT_SIZE_ASTERISK_CUSTOM "自訂餘額設定" +#define TRANSLATION_TOOLTIP_ACCOUNT_SIZE_ASTERISK_ADD "追加資金" +#define TRANSLATION_TOOLTIP_ACCOUNT_SIZE_ASTERISK_SUB "減去資金" + +#define TRANSLATION_LABEL_INPUT "輸入" +#define TRANSLATION_LABEL_RESULT "結果" +#define TRANSLATION_LABEL_RISK "風險" +#define TRANSLATION_LABEL_MONEY "資金" +#define TRANSLATION_LABEL_REWARD "回報" +#define TRANSLATION_LABEL_REWARD_RISK "回報/風險" +#define TRANSLATION_LABEL_POSITION_SIZE "頭寸數量" +#define TRANSLATION_BUTTON_MAX_PS "最大PS" +#define TRANSLATION_LABEL_POINT_VALUE "點數值" + +#define TRANSLATION_CHECKBOX_COUNT_PENDING_ORDERS "統計掛單" +#define TRANSLATION_CHECKBOX_IGNORE_ORDERS_WO_SL "忽略無停損位訂單" +#define TRANSLATION_CHECKBOX_IGNORE_ORDERS_WO_TP "忽略無止損位元訂單" +#define TRANSLATION_CHECKBOX_IGNORE_ORDERS_IN_OTHER_SYMBOLS "忽略其他交易品種的訂單" + +#define TRANSLATION_LABEL_LOTS "手數" +#define TRANSLATION_LABEL_CURRENT_PORTFOLIO "目前投資組合" +#define TRANSLATION_TOOLTIP_CURRENT_PORTFOLIO "目前未平倉交易" +#define TRANSLATION_LABEL_POTENTIAL_PORTFOLIO "潛力投資組合" +#define TRANSLATION_TOOLTIP_POTENTIAL_PORTFOLIO "包括正在計算的部位" +#define TRANSLATION_LABEL_CRRR_TOOLTIP "目前投資組合的風險報酬比率" +#define TRANSLATION_LABEL_PRRR_TOOLTIP "潛在投資組合的風險報酬比率" + +#define TRANSLATION_LABEL_POSITION_MARGIN "部位保證金" +#define TRANSLATION_LABEL_FUTURE_USED_MARGIN "未來的已使用保證金" +#define TRANSLATION_LABEL_FUTURE_FREE_MARGIN "未來的可用保證金" +#define TRANSLATION_LABEL_CUSTOM_LEVERAGE "自訂槓桿" + +#define TRANSLATION_LABEL_DEFAULT "預設" +#define TRANSLATION_LABEL_SYMBOL "交易品種" +#define TRANSLATION_LABEL_MAX_PS_BY_MARGIN "以保證金計算的最大部位數量" + +#define TRANSLATION_TOOLTIP_MAX_PS_BY_MARGIN "以手數計" + +#define TRANSLATION_LABEL_TYPE "型別" +#define TRANSLATION_LABEL_UNKNOWN "未知" +#define TRANSLATION_LABEL_TRIPLE_SWAP "三倍利息" +#define TRANSLATION_EDIT_WEEKDAY_SUNDAY "週日" +#define TRANSLATION_EDIT_WEEKDAY_MONDAY "週一" +#define TRANSLATION_EDIT_WEEKDAY_TUESDAY "週二" +#define TRANSLATION_EDIT_WEEKDAY_WEDNESDAY "週三" +#define TRANSLATION_EDIT_WEEKDAY_THURSDAY "週四" +#define TRANSLATION_EDIT_WEEKDAY_FRIDAY "週五" +#define TRANSLATION_EDIT_WEEKDAY_SATURDAY "週六" + +#define TRANSLATION_LABEL_NOMINAL "名義" +#define TRANSLATION_LABEL_DAILY "每日" +#define TRANSLATION_LABEL_YEARLY "每年" +#define TRANSLATION_LABEL_PER_LOT "每手" +#define TRANSLATION_LABEL_PER_PS "每PS" +#define TRANSLATION_LABEL_BASE_CURRENCY "基準貨幣" +#define TRANSLATION_LABEL_MARGIN_CURRENCY "保證金貨幣" + +#define TRANSLATION_BUTTON_TRADE "交易" +#define TRANSLATION_LABEL_TRAILING_STOP "移動停損" +#define TRANSLATION_LABEL_BREAKEVEN "損益兩平" +#define TRANSLATION_LABEL_MAGIC_NUMBER "幻數" +#define TRANSLATION_LABEL_ORDER_COMMENTARY "訂單註解" +#define TRANSLATION_LABEL_ORDER_AUTOSUFFIX "自動後綴" +#define TRANSLATION_TOOLTIP_ORDER_AUTOSUFFIX "為每筆新交易的註解新增自動遞增數字?" +#define TRANSLATION_LABEL_MAX_NUMBER_OF_TRADES "最大交易數" +#define TRANSLATION_LABEL_TOTAL "總共" +#define TRANSLATION_LABEL_PER_SYMBOL "每品種" +#define TRANSLATION_LABEL_MAX_VOLUME "最大交易量" +#define TRANSLATION_LABEL_MAX_RISK "最大風險" +#define TRANSLATION_CHECKBOX_DISABLE_TRADING_LINES_HIDDEN "當線條被隱藏時停用交易" +#define TRANSLATION_TOOLTIP_FILL_INWARD "在入場位與主止盈位之間等距填充追加止盈位。" +#define TRANSLATION_TOOLTIP_FILL_OUTWARD "以相同的距離在主止盈位元之外設定追加止盈位元。" +#define TRANSLATION_LABEL_SHARE "份額" +#define TRANSLATION_TOOLTIP_SHARE "自動填入交易量份額" +#define TRANSLATION_LABEL_POINTS "點數" +#define TRANSLATION_LABEL_MAX_SLIPPAGE "最大滑點" +#define TRANSLATION_LABEL_MAX_SPREAD "最大點差" +#define TRANSLATION_LABEL_MAX_ENTRY_SL_DISTANCE "最大入場位元/停損距離" +#define TRANSLATION_LABEL_MIN_ENTRY_SL_DISTANCE "最小入場位元/停損距離" +#define TRANSLATION_CHECKBOX_SUBTRACT_OPEN_POSITIONS_VOLUME "減去未平倉部位數量" +#define TRANSLATION_CHECKBOX_SUBTRACT_PENDING_ORDERS_VOLUME "減去掛單量" +#define TRANSLATION_CHECKBOX_DO_NOT_APPLY_STOPLOSS "不施加停損位元" +#define TRANSLATION_CHECKBOX_DO_NOT_APPLY_TAKEPROFIT "不套用止盈位元" +#define TRANSLATION_TOOLTIP_SUBTRACT_OPEN_POSITIONS_VOLUME "開始交易前,EA 將從計算的頭寸數量中減去當前未平倉交易量。" +#define TRANSLATION_TOOLTIP_SUBTRACT_PENDING_ORDERS_VOLUME "開始交易前,EA 將從計算的頭寸數量中減去掛單量。" +#define TRANSLATION_TOOLTIP_DO_NOT_APPLY_STOPLOSS "EA 不會對它所開立的交易套用停損位元。" +#define TRANSLATION_TOOLTIP_DO_NOT_APPLY_TAKEPROFIT "EA 不會對它開立的交易套用止盈位元。" +#define TRANSLATION_CHECKBOX_ASK_FOR_CONFIRMATION "要求確認" +#define TRANSLATION_TOOLTIP_ASK_FOR_CONFIRMATION "EA 將在開立交易前要求確認。" +#define TRANSLATION_LABEL_EXPIRY "到期" +#define TRANSLATION_TOOLTIP_EXPIRY "下一個已建立掛單的到期時間(以分鐘為單位)。最小值=10。" +#define TRANSLATION_LABEL_MINUTES "分鐘" +#define TRANSLATION_TOOLTIP_MINUTES "分鐘" + +#define TRANSLATION_TOOLTIP_SL_LABEL "停損距離,點數" +#define TRANSLATION_TOOLTIP_TP_LABEL "止盈距離,點數" +#define TRANSLATION_TOOLTIP_ENTRY_LABEL "入場距離,點數" +#define TRANSLATION_TOOLTIP_ENTRY_LABEL_ADDITIONAL "部位數量,手數" + +#define TRANSLATION_LABEL_WARNING_TOO_CLOSE "(太接近!)" +#define TRANSLATION_LABEL_WARNING_WRONG_VALUE "(錯誤值!)" +#define TRANSLATION_LABEL_WARNING_INVALID_TP "無效止盈位元" + +#define TRANSLATION_TOOLTIP_WARNING_PS "大於以保證金計算的最大部位數量" + +#define TRANSLATION_MESSAGE_SL_SHOULD_BE_POSITIVE "停損位元應為正值。" +#define TRANSLATION_MESSAGE_TRYING_TO_SAVE_FILE "嘗試將設定儲存至檔案" +#define TRANSLATION_MESSAGE_FAILED_TO_OPEN_FOR_WRITING "無法開啟檔案進行寫入" +#define TRANSLATION_MESSAGE_ERROR "錯誤" +#define TRANSLATION_MESSAGE_SAVED_SETTINGS "已成功儲存設定。" +#define TRANSLATION_MESSAGE_TRYING_TO_LOAD_FILE "嘗試從檔案載入設定。" +#define TRANSLATION_MESSAGE_NO_SETTINGS_FILE_TO_LOAD "沒有可載入的設定檔。" +#define TRANSLATION_MESSAGE_FAILED_TO_OPEN_FOR_READING "無法開啟檔案讀取" +#define TRANSLATION_MESSAGE_LOADED_SETTINGS "已成功載入設定。" +#define TRANSLATION_MESSAGE_NO_SETTINGS_FILE_TO_DELETE "沒有可刪除的設定檔。" +#define TRANSLATION_MESSAGE_TRYING_TO_DELETE_FILE "嘗試刪除設定檔。" +#define TRANSLATION_MESSAGE_FAILED_TO_DELETE_FILE "檔案刪除失敗" +#define TRANSLATION_MESSAGE_DELETED_SETTINGS "已成功刪除設定檔。" +#define TRANSLATION_MESSAGE_DELETED_DUPLICATE_PANEL "刪除了帶有前綴的重複面板物件。" +#define TRANSLATION_MESSAGE_ENTRY_SL_DIFFERENT_NON_ZERO "入場位元與停損位元應不相同,且為非零值。" +#define TRANSLATION_MESSAGE_ENTRY_SL_DIFFERENT "停損位元應與入場位元不相同。" +#define TRANSLATION_MESSAGE_CANNOT_RETRIEVE_TICKSIZE "無法擷取跳動點的大小" +#define TRANSLATION_MESSAGE_LOOKS_LIKE "這項工具似乎已不可用。計算可能有誤。" +#define TRANSLATION_MESSAGE_MISCONFIGURED_SYMBOL "交易伺服器上的交易品種配置錯誤- 零單位成本。" +#define TRANSLATION_MESSAGE_ALGO_TRADING_DISABLED "演算法交易已停用!請開啟演算法交易。" +#define TRANSLATION_MESSAGE_STOPLOSS_PROBLEM "停損問題" +#define TRANSLATION_MESSAGE_WRONG_POSITION_SIZE_VALUE "頭寸數量值錯誤!" +#define TRANSLATION_MESSAGE_MULTIPLE_TP_VOLUME_SHARE_SUM "多個止盈交易量份額的總和" +#define TRANSLATION_MESSAGE_INCORRECT_VOLUME_SUM "多個止盈交易量份額的總和錯誤- 未進行任何交易。" +#define TRANSLATION_MESSAGE_NOT_TAKING_A_TRADE "未進行交易" +#define TRANSLATION_MESSAGE_NTAT_LINES "線條被隱藏,面板設為在線條隱藏時不做交易。" +#define TRANSLATION_MESSAGE_NTAT_SPREAD "目前點差" +#define TRANSLATION_MESSAGE_MAXIMUM_SPREAD "最大點差" +#define TRANSLATION_MESSAGE_NTAT_ENTRY_SL_DISTANCE "目前入場位元/停損距離" +#define TRANSLATION_MESSAGE_NTAT_TOTAL_NUMBER "目前交易總數" +#define TRANSLATION_MESSAGE_NUMBER_OF_TRADES_IN_EXECUTION "執行中的交易數量" +#define TRANSLATION_MESSAGE_MAXIMUM_TOTAL_NUMBER_OF_TRADES_ALLOWED "允許的最大交易總數" +#define TRANSLATION_MESSAGE_NTAT_PER_SYMBOL_NUMBER "每個交易品種的目前交易數量" +#define TRANSLATION_MESSAGE_MAXIMUM_PER_SYMBOL_NUMBER_OF_TRADES_ALLOWED "每個交易品種允許的最大交易數量" +#define TRANSLATION_MESSAGE_TOTAL_POTENTIAL_RISK "總潛在風險" +#define TRANSLATION_MESSAGE_MAXIUMUM_TOTAL_RISK "允許的最大風險總量" +#define TRANSLATION_MESSAGE_INFINITE_TOTAL_POTENTIAL_RISK "無限潛在風險總量" +#define TRANSLATION_MESSAGE_PER_SYMBOL_POTENTIAL_RISK "每個交易品種的潛在風險" +#define TRANSLATION_MESSAGE_MAXIMUM_PER_SYMBOL_RISK "每個交易品種允許的最大風險" +#define TRANSLATION_MESSAGE_INFINITE_PER_SYMBOL_POTENTIAL_RISK "每個交易品種的無限潛在風險" +#define TRANSLATION_MESSAGE_IGNORE_MARKET_EXECUTION_MODE_WARNING ",但IgnoreMarketExecutionMode = true。如果交易未執行,則切換為false。" +#define TRANSLATION_MESSAGE_EXECUTION_MODE "執行模式" +#define TRANSLATION_MESSAGE_FOUND_EXISTING_BUY_VOLUME "發現現有買入量" +#define TRANSLATION_MESSAGE_FOUND_EXISTING_SELL_VOLUME "發現現有賣出量" +#define TRANSLATION_MESSAGE_ADJUSTED_POSITION_SIZE "調整部位數量" +#define TRANSLATION_MESSAGE_ADJUSTED_POSITION_SIZE_LESS_THAN_ZERO "調整後的部位數量小於零。不會執行任何交易。" +#define TRANSLATION_MESSAGE_NTAT_TOTAL_VOLUME "目前總交易量" +#define TRANSLATION_MESSAGE_NTAT_NEW_POSITION_VOLUME "新部位量" +#define TRANSLATION_MESSAGE_NTAT_MAXIMUM_TOTAL_VOLUME "允許的最大總交易量" +#define TRANSLATION_MESSAGE_NTAT_PER_SYMBOL_VOLUME "每個交易品種的目前交易量" +#define TRANSLATION_MESSAGE_NTAT_MAXIMUM_PER_SYMBOL_VOLUME "每個交易品種允許的最大交易量" +#define TRANSLATION_MESSAGE_BROKER_MINIMUM "經紀商的最小部位規模。不會執行交易。" +#define TRANSLATION_MESSAGE_BROKER_MAXIMUM "經紀商的最大部位規模。減少它。" +#define TRANSLATION_MESSAGE_ERROR_SENDING_ORDER "發送訂單出錯" +#define TRANSLATION_MESSAGE_ORDER_EXECUTED "訂單已執行。" +#define TRANSLATION_MESSAGE_TICKET "憑證" +#define TRANSLATION_MESSAGE_ORDER "訂單" +#define TRANSLATION_MESSAGE_EXECUTED "已執行" +#define TRANSLATION_MESSAGE_ERROR_OPENING_POSITION "開立部位出錯" +#define TRANSLATION_MESSAGE_POSITION_SIZER_ON "頭寸數量計算器用於" +#define TRANSLATION_MESSAGE_EXECUTE_TRADE "執行交易嗎?" +#define TRANSLATION_MESSAGE_BUY "買入" +#define TRANSLATION_MESSAGE_BUY_STOP "買入停損" +#define TRANSLATION_MESSAGE_BUY_LIMIT "買入限價" +#define TRANSLATION_MESSAGE_SELL "賣出" +#define TRANSLATION_MESSAGE_SELL_STOP "賣出停損" +#define TRANSLATION_MESSAGE_SELL_LIMIT "賣出限價" +#define TRANSLATION_MESSAGE_SIZE "規模" +#define TRANSLATION_MESSAGE_MULTIPLE "多個" +#define TRANSLATION_MESSAGE_TRADE_CANCELED "交易取消。" +#define TRANSLATION_MESSAGE_TSL_APPLIED "移動停損已套用於部位" +#define TRANSLATION_MESSAGE_SL_WAS_MOVED_FROM "停損位元的移動是從" +#define TRANSLATION_MESSAGE_SL_WAS_MOVED_TO "至" +#define TRANSLATION_MESSAGE_BE_APPLIED "損益平衡被應用到部位" +#define TRANSLATION_MESSAGE_BE_FOR "損益平衡用於" +#define TRANSLATION_MESSAGE_ERROR_SETTING_TIMER "設定計時器時發生錯誤" +#define TRANSLATION_MESSAGE_FAILED_DELETE_INI "無法刪除PS面板的.ini檔案" +#define TRANSLATION_MESSAGE_MINIMUM_EXPIRY "最短到期時間為10 分鐘。" \ No newline at end of file diff --git a/MQL4/Experts/Position Sizer/Translations/English.mqh b/MQL4/Experts/Position Sizer/Translations/English.mqh new file mode 100644 index 0000000..f6e6bc4 Binary files /dev/null and b/MQL4/Experts/Position Sizer/Translations/English.mqh differ diff --git a/MQL4/Experts/Position Sizer/Translations/Portuguese.mqh b/MQL4/Experts/Position Sizer/Translations/Portuguese.mqh new file mode 100644 index 0000000..1603396 --- /dev/null +++ b/MQL4/Experts/Position Sizer/Translations/Portuguese.mqh @@ -0,0 +1,273 @@ +// Guias +#define TRANSLATION_TAB_BUTTON_MAIN "Geral" +#define TRANSLATION_TAB_BUTTON_RISK "Risco" +#define TRANSLATION_TAB_BUTTON_MARGIN "Margem" +#define TRANSLATION_TAB_BUTTON_SWAPS "Swaps" +#define TRANSLATION_TAB_BUTTON_TRADING "Ordem" + +// Legenda +#define TRANSLATION_LABEL_SPREAD "Spread" + +// Guia Principal +// Entrada +#define TRANSLATION_LABEL_ENTRY "Entrada" +#define TRANSLATION_BUTTON_LONG "Comprar" +#define TRANSLATION_BUTTON_SHORT "Vender" + +#define TRANSLATION_TOOLTIP_BUTTON_LONG_SHORT "Alternar entre Compra e Venda" + +#define TRANSLATION_TOOLTIP_ENTRY_INCREASE "Aumentar a Entrada em 1 ponto" +#define TRANSLATION_TOOLTIP_ENTRY_DECREASE "Diminuir a Entrada em 1 ponto" + +// Stop-loss +#define TRANSLATION_LABEL_STOPLOSS "Stop-loss" +#define TRANSLATION_BUTTON_SL "SL, pontos" + +#define TRANSLATION_TOOLTIP_STOPLOSS_INCREASE "Aumentar o Stop-loss em 1 ponto" +#define TRANSLATION_TOOLTIP_STOPLOSS_DECREASE "Diminuir o Stop-loss em 1 ponto" + +// Take-profit +#define TRANSLATION_LABEL_TAKEPROFIT "Take-profit" +#define TRANSLATION_BUTTON_TP "TP, pontos" + +#define TRANSLATION_TOOLTIP_TAKEPROFIT_ADD "Adicionar um nível de take-profit" +#define TRANSLATION_TOOLTIP_BUTTON_TP "Definir TP com base no SL ou ativar o modo TP travado" + +#define TRANSLATION_TOOLTIP_TAKEPROFIT_INCREASE "Aumentar o Take-profit em 1 ponto" +#define TRANSLATION_TOOLTIP_TAKEPROFIT_DECREASE "Diminuir o Take-profit em 1 ponto" + +#define TRANSLATION_LABEL_TAKEPROFIT_MULTIPLE_DISTANCE "TP" +#define TRANSLATION_LABEL_TAKEPROFIT_MULTIPLE_POINTS "pontos" + +#define TRANSLATION_TOOLTIP_TAKEPROFIT_REMOVE "Remover Take-profit" + +#define TRANSLATION_TOOLTIP_TAKEPROFIT_INCREASE_MULTIPLE "Aumentar Take-profit" +#define TRANSLATION_TOOLTIP_TAKEPROFIT_DECREASE_MULTIPLE "Diminuir Take-profit" +#define TRANSLATION_TOOLTIP_TAKEPROFIT_BY_ONE_POINT "em 1 ponto" + +// Opções ATR +#define TRANSLATION_LABEL_ATR_PERIOD "Período ATR" +#define TRANSLATION_BUTTON_ATR_PERIOD_CURRENT "ATUAL" +#define TRANSLATION_LABEL_ATR_SL_MULTIPLIER "Multiplicador SL ATR" +#define TRANSLATION_LABEL_ATR_TP_MULTIPLIER "Multiplicador TP ATR" + +#define TRANSLATION_CHECKBOX_ATR_SA "SA" +#define TRANSLATION_TOOLTIP_ATR_SA_SL "Aplicar ajuste de spread ao Stop-loss" +#define TRANSLATION_TOOLTIP_ATR_SA_TP "Aplicar ajuste de spread ao Take-profit" + +#define TRANSLATION_LABEL_ATR_TIMEFRAME "Intervalo ATR" +#define TRANSLATION_LABEL_ATR_VALUE "ATR" + +// Tipo de Ordem +#define TRANSLATION_LABEL_ORDER_TYPE "Tipo de Ordem" +#define TRANSLATION_BUTTON_ORDER_TYPE_INSTANT "Mercado" +#define TRANSLATION_BUTTON_ORDER_TYPE_PENDING "Pendente" +#define TRANSLATION_TOOLTIP_ORDER_TYPE "Alternar entre Mercado e Pendente" + +// Esconder/Mostrar Linhas +#define TRANSLATION_BUTTON_HIDE_LINES "Esconder" +#define TRANSLATION_BUTTON_SHOW_LINES "Mostrar" + +// Comissão +#define TRANSLATION_LABEL_COMMISSION "Comissão (unidirecional) por lote" +#define TRANSLATION_TOOLTIP_COMMISSION "Em moeda da conta ou %, por 1 lote padrão" +#define TRANSLATION_TOOLTIP_COMMISSION_TYPE "Clique para alternar" + +// Tamanho da Conta +#define TRANSLATION_BUTTON_ACCOUNT_BALANCE "Saldo da Conta" +#define TRANSLATION_BUTTON_ACCOUNT_EQUITY "Capital Líquido da Conta" +#define TRANSLATION_BUTTON_BALANCE_MINUS_CPR "Saldo-Risco Atual" +#define TRANSLATION_TOOLTIP_ACCOUNT_SIZE "Alternar entre saldo, capital líquido e saldo menos o risco atual" +#define TRANSLATION_TOOLTIP_ACCOUNT_SIZE_ASTERISK_CUSTOM "Saldo personalizado definido" +#define TRANSLATION_TOOLTIP_ACCOUNT_SIZE_ASTERISK_ADD "fundos adicionais" +#define TRANSLATION_TOOLTIP_ACCOUNT_SIZE_ASTERISK_SUB "fundos subtraídos" + +// Cálculos +#define TRANSLATION_LABEL_INPUT "Entrada" +#define TRANSLATION_LABEL_RESULT "Resultado" +#define TRANSLATION_LABEL_RISK "Risco" +#define TRANSLATION_LABEL_MONEY "Dinheiro" +#define TRANSLATION_LABEL_REWARD "Lucro" +#define TRANSLATION_LABEL_REWARD_RISK "Lucro/Risco" +#define TRANSLATION_LABEL_POSITION_SIZE "Tamanho da Ordem" +#define TRANSLATION_BUTTON_MAX_PS "Tamanho Máximo da Ordem" +#define TRANSLATION_LABEL_POINT_VALUE "Valor do Ponto" + + +// Guia Risco +#define TRANSLATION_CHECKBOX_COUNT_PENDING_ORDERS "Contar Ordens Pendentes" +#define TRANSLATION_CHECKBOX_IGNORE_ORDERS_WO_SL "Ignorar Ordens sem Stop-loss" +#define TRANSLATION_CHECKBOX_IGNORE_ORDERS_WO_TP "Ignorar Ordens sem Take-profit" +#define TRANSLATION_CHECKBOX_IGNORE_ORDERS_IN_OTHER_SYMBOLS "Ignorar Ordens em Outros Ativos" +#define TRANSLATION_LABEL_LOTS "Lotes" +#define TRANSLATION_LABEL_CURRENT_PORTFOLIO "Carteira Atual" +#define TRANSLATION_TOOLTIP_CURRENT_PORTFOLIO "Negociações que estão atualmente abertas" +#define TRANSLATION_LABEL_POTENTIAL_PORTFOLIO "Carteira Potencial" +#define TRANSLATION_TOOLTIP_POTENTIAL_PORTFOLIO "Incluindo a ordem que está sendo calculada" +#define TRANSLATION_LABEL_CRRR_TOOLTIP "Razão de risco-recompensa da carteira atual" +#define TRANSLATION_LABEL_PRRR_TOOLTIP "Razão de risco-recompensa da carteira potencial" + + +// Guia Margem +#define TRANSLATION_LABEL_POSITION_MARGIN "Margem da Ordem" +#define TRANSLATION_LABEL_FUTURE_USED_MARGIN "Margem Utili. Futura" +#define TRANSLATION_LABEL_FUTURE_FREE_MARGIN "Margem Livre Futura" +#define TRANSLATION_LABEL_CUSTOM_LEVERAGE "Alavancagem" +#define TRANSLATION_LABEL_DEFAULT "Padrão" +#define TRANSLATION_LABEL_SYMBOL "Ativo" +#define TRANSLATION_LABEL_MAX_PS_BY_MARGIN "Tam. Máx. Ord. por Margem" +#define TRANSLATION_TOOLTIP_MAX_PS_BY_MARGIN "Em lotes" + + +// Guia Swaps +#define TRANSLATION_LABEL_TYPE "Tipo" +#define TRANSLATION_LABEL_UNKNOWN "Desconhecido" +#define TRANSLATION_LABEL_TRIPLE_SWAP "Swaps Triplos" +#define TRANSLATION_EDIT_WEEKDAY_SUNDAY "Domingo" +#define TRANSLATION_EDIT_WEEKDAY_MONDAY "Segunda-feira" +#define TRANSLATION_EDIT_WEEKDAY_TUESDAY "Terça-feira" +#define TRANSLATION_EDIT_WEEKDAY_WEDNESDAY "Quarta-feira" +#define TRANSLATION_EDIT_WEEKDAY_THURSDAY "Quinta-feira" +#define TRANSLATION_EDIT_WEEKDAY_FRIDAY "Sexta-feira" +#define TRANSLATION_EDIT_WEEKDAY_SATURDAY "Sábado" +#define TRANSLATION_LABEL_NOMINAL "Nominal" +#define TRANSLATION_LABEL_DAILY "Diário" +#define TRANSLATION_LABEL_YEARLY "Anual" +#define TRANSLATION_LABEL_PER_LOT "por lote" +#define TRANSLATION_LABEL_PER_PS "por Ord." +#define TRANSLATION_LABEL_BASE_CURRENCY "Moeda Base" +#define TRANSLATION_LABEL_MARGIN_CURRENCY "Moeda de Margem" + +// Guia Trading +#define TRANSLATION_BUTTON_TRADE "Ordem" +#define TRANSLATION_LABEL_TRAILING_STOP "Trailing Stop" +#define TRANSLATION_LABEL_BREAKEVEN "Breakeven" +#define TRANSLATION_LABEL_MAGIC_NUMBER "Número Mágico" +#define TRANSLATION_LABEL_ORDER_COMMENTARY "Comentários da Ordem" +#define TRANSLATION_LABEL_ORDER_AUTOSUFFIX "Auto-sufixo" +#define TRANSLATION_TOOLTIP_ORDER_AUTOSUFFIX "Adicionar um número automaticamente a cada nova ordem?" +#define TRANSLATION_LABEL_MAX_NUMBER_OF_TRADES "Máx. # de ordens" +#define TRANSLATION_LABEL_TOTAL "Total" +#define TRANSLATION_LABEL_PER_SYMBOL "Por ativo" +#define TRANSLATION_LABEL_MAX_VOLUME "Volume Máx." +#define TRANSLATION_LABEL_MAX_RISK "Risco Máx." +#define TRANSLATION_CHECKBOX_DISABLE_TRADING_LINES_HIDDEN "Sem ordens novas com linhas ocultas" +#define TRANSLATION_TOOLTIP_FILL_INWARD "Preencher TPs adicionais equidistantemente entre Entrada e TP Principal." +#define TRANSLATION_TOOLTIP_FILL_OUTWARD "Colocar TPs adicionais além do TP Principal usando a mesma distância." +#define TRANSLATION_LABEL_SHARE "Distribuir" +#define TRANSLATION_TOOLTIP_SHARE "Preencher automaticamente o volume de distribuição." +#define TRANSLATION_LABEL_POINTS "Pontos" +#define TRANSLATION_LABEL_MAX_SLIPPAGE "Desvio Máx." +#define TRANSLATION_LABEL_MAX_SPREAD "Spread Máx." +#define TRANSLATION_LABEL_MAX_ENTRY_SL_DISTANCE "Dist. Máx. de Entrada/SL" +#define TRANSLATION_LABEL_MIN_ENTRY_SL_DISTANCE "Dist. Mín. de Entrada/SL" +#define TRANSLATION_CHECKBOX_SUBTRACT_OPEN_POSITIONS_VOLUME "Subtrair volume de ordens abertas" +#define TRANSLATION_CHECKBOX_SUBTRACT_PENDING_ORDERS_VOLUME "Subtrair volume de ordens pendentes" +#define TRANSLATION_CHECKBOX_DO_NOT_APPLY_STOPLOSS "Não aplicar Stop Loss" +#define TRANSLATION_CHECKBOX_DO_NOT_APPLY_TAKEPROFIT "Não aplicar Take Profit" +#define TRANSLATION_TOOLTIP_SUBTRACT_OPEN_POSITIONS_VOLUME "O EA subtrairá o volume das ordens atualmente abertas do tamanho de ordem calculado antes de abrir uma nova ordem." +#define TRANSLATION_TOOLTIP_SUBTRACT_PENDING_ORDERS_VOLUME "O EA subtrairá o volume das ordens pendentes do tamanho de ordem calculado antes de abrir uma nova ordem." +#define TRANSLATION_TOOLTIP_DO_NOT_APPLY_STOPLOSS "O EA não aplicará Stop Loss à ordem que abrir." +#define TRANSLATION_TOOLTIP_DO_NOT_APPLY_TAKEPROFIT "O EA não aplicará Take Profit à ordem que abrir." +#define TRANSLATION_CHECKBOX_ASK_FOR_CONFIRMATION "Pedir confirmação" +#define TRANSLATION_TOOLTIP_ASK_FOR_CONFIRMATION "O EA pedirá confirmação antes de abrir uma ordem." +#define TRANSLATION_LABEL_EXPIRY "Expiração" +#define TRANSLATION_TOOLTIP_EXPIRY "Tempo de expiração em minutos para a próxima ordem pendente criada. Mínimo = 10." +#define TRANSLATION_LABEL_MINUTES "min." +#define TRANSLATION_TOOLTIP_MINUTES "Minutos" + +// Objetos do Gráfico +#define TRANSLATION_TOOLTIP_SL_LABEL "Distância SL, pontos" +#define TRANSLATION_TOOLTIP_TP_LABEL "Distância TP, pontos" +#define TRANSLATION_TOOLTIP_ENTRY_LABEL "Distância da Entrada, pontos" +#define TRANSLATION_TOOLTIP_ENTRY_LABEL_ADDITIONAL "Tamanho da Ordem, lotes" +#define TRANSLATION_TOOLTIP_OUTSIDE_TRADE_BUTTON "Clique para abrir uma ordem." + +// Avisos +#define TRANSLATION_LABEL_WARNING_TOO_CLOSE "(Muito próximo!)" +#define TRANSLATION_LABEL_WARNING_WRONG_VALUE "(Valor incorreto!)" +#define TRANSLATION_LABEL_WARNING_INVALID_TP "TP inválido" +#define TRANSLATION_TOOLTIP_WARNING_PS "Maior que o tamanho máximo de ordem por margem!" + +// Mensagens +#define TRANSLATION_MESSAGE_SL_SHOULD_BE_POSITIVE "O Stop Loss deve ser positivo." +#define TRANSLATION_MESSAGE_TRYING_TO_SAVE_FILE "Tentando salvar as configurações no arquivo" +#define TRANSLATION_MESSAGE_FAILED_TO_OPEN_FOR_WRITING "Falha ao abrir o arquivo para escrita" +#define TRANSLATION_MESSAGE_ERROR "Erro" +#define TRANSLATION_MESSAGE_SAVED_SETTINGS "Configurações salvas com sucesso." +#define TRANSLATION_MESSAGE_TRYING_TO_LOAD_FILE "Tentando carregar as configurações do arquivo." +#define TRANSLATION_MESSAGE_NO_SETTINGS_FILE_TO_LOAD "Nenhum arquivo de configurações para carregar." +#define TRANSLATION_MESSAGE_FAILED_TO_OPEN_FOR_READING "Falha ao abrir o arquivo para leitura" +#define TRANSLATION_MESSAGE_LOADED_SETTINGS "Configurações carregadas com sucesso." +#define TRANSLATION_MESSAGE_NO_SETTINGS_FILE_TO_DELETE "Nenhum arquivo de configurações para excluir." +#define TRANSLATION_MESSAGE_TRYING_TO_DELETE_FILE "Tentando excluir o arquivo de configurações." +#define TRANSLATION_MESSAGE_FAILED_TO_DELETE_FILE "Falha ao excluir o arquivo" +#define TRANSLATION_MESSAGE_DELETED_SETTINGS "Arquivo de configurações excluído com sucesso." +#define TRANSLATION_MESSAGE_DELETED_DUPLICATE_PANEL "Objetos de painel duplicados excluídos com o prefixo" +#define TRANSLATION_MESSAGE_ENTRY_SL_DIFFERENT_NON_ZERO "Os níveis de Entrada e Stop Loss devem ser diferentes e diferentes de zero." +#define TRANSLATION_MESSAGE_ENTRY_SL_DIFFERENT "O Stop Loss deve ser diferente da Entrada." +#define TRANSLATION_MESSAGE_CANNOT_RETRIEVE_TICKSIZE "Não é possível obter o tamanho do tick para" +#define TRANSLATION_MESSAGE_LOOKS_LIKE "Parece que o instrumento não está mais disponível. O cálculo pode não ser preciso." +#define TRANSLATION_MESSAGE_MISCONFIGURED_SYMBOL "Símbolo mal configurado no servidor de trading - custo unitário zero." +#define TRANSLATION_MESSAGE_ALGO_TRADING_DISABLED "Algo Trading desativado! Por favor, ative o Algo Trading." +#define TRANSLATION_MESSAGE_STOPLOSS_PROBLEM "Problema com o Stop Loss" +#define TRANSLATION_MESSAGE_WRONG_POSITION_SIZE_VALUE "Valor de tamanho de ordem incorreto!" +#define TRANSLATION_MESSAGE_MULTIPLE_TP_VOLUME_SHARE_SUM "Soma de volume de múltiplos TP" +#define TRANSLATION_MESSAGE_INCORRECT_VOLUME_SUM "Soma de volume incorreta para múltiplos TPs - nenhuma ordem será executada." +#define TRANSLATION_MESSAGE_NOT_TAKING_A_TRADE "Não realizando uma ordem" +#define TRANSLATION_MESSAGE_NTAT_LINES "linhas estão ocultas e o painel está configurado para não operar quando estão ocultas." +#define TRANSLATION_MESSAGE_NTAT_SPREAD "spread atual" +#define TRANSLATION_MESSAGE_MAXIMUM_SPREAD "spread máximo" +#define TRANSLATION_MESSAGE_NTAT_ENTRY_SL_DISTANCE "distância atual de Entrada/SL" +#define TRANSLATION_MESSAGE_NTAT_TOTAL_NUMBER "número atual total de ordens" +#define TRANSLATION_MESSAGE_NUMBER_OF_TRADES_IN_EXECUTION "número de ordens em execução" +#define TRANSLATION_MESSAGE_MAXIMUM_TOTAL_NUMBER_OF_TRADES_ALLOWED "número máximo total de ordens permitido" +#define TRANSLATION_MESSAGE_NTAT_PER_SYMBOL_NUMBER "número atual de ordens por símbolo" +#define TRANSLATION_MESSAGE_MAXIMUM_PER_SYMBOL_NUMBER_OF_TRADES_ALLOWED "número máximo de ordens por símbolo permitido" +#define TRANSLATION_MESSAGE_TOTAL_POTENTIAL_RISK "risco total potencial" +#define TRANSLATION_MESSAGE_MAXIUMUM_TOTAL_RISK "risco total máximo permitido" +#define TRANSLATION_MESSAGE_INFINITE_TOTAL_POTENTIAL_RISK "risco total potencial infinito" +#define TRANSLATION_MESSAGE_PER_SYMBOL_POTENTIAL_RISK "risco potencial por símbolo" +#define TRANSLATION_MESSAGE_MAXIMUM_PER_SYMBOL_RISK "risco máximo por símbolo permitido" +#define TRANSLATION_MESSAGE_INFINITE_PER_SYMBOL_POTENTIAL_RISK "risco potencial por símbolo infinito" +#define TRANSLATION_MESSAGE_IGNORE_MARKET_EXECUTION_MODE_WARNING ", mas IgnoreMarketExecutionMode = true. Altere para falso se as ordens não estiverem sendo executadas." +#define TRANSLATION_MESSAGE_EXECUTION_MODE "Modo de Execução" +#define TRANSLATION_MESSAGE_FOUND_EXISTING_BUY_VOLUME "Encontrado volume de compra existente" +#define TRANSLATION_MESSAGE_FOUND_EXISTING_SELL_VOLUME "Encontrado volume de venda existente" +#define TRANSLATION_MESSAGE_ADJUSTED_POSITION_SIZE "Tamanho de ordem ajustado" +#define TRANSLATION_MESSAGE_ADJUSTED_POSITION_SIZE_LESS_THAN_ZERO "O tamanho de ordem ajustado é menor que zero. Nenhuma ordem será executada." +#define TRANSLATION_MESSAGE_NTAT_TOTAL_VOLUME "volume total atual" +#define TRANSLATION_MESSAGE_NTAT_NEW_POSITION_VOLUME "novo volume de ordem" +#define TRANSLATION_MESSAGE_NTAT_MAXIMUM_TOTAL_VOLUME "volume total máximo permitido" +#define TRANSLATION_MESSAGE_NTAT_PER_SYMBOL_VOLUME "volume atual por símbolo" +#define TRANSLATION_MESSAGE_NTAT_MAXIMUM_PER_SYMBOL_VOLUME "volume máximo permitido por símbolo" +#define TRANSLATION_MESSAGE_BROKER_MINIMUM "tamanho de ordem mínimo do broker. Nenhuma ordem será executada." +#define TRANSLATION_MESSAGE_BROKER_MAXIMUM "tamanho de ordem máximo do broker. Reduzindo-o." +#define TRANSLATION_MESSAGE_ERROR_SENDING_ORDER "Erro ao enviar a ordem" +#define TRANSLATION_MESSAGE_ORDER_EXECUTED "Ordem executada." +#define TRANSLATION_MESSAGE_TICKET "Ticket" +#define TRANSLATION_MESSAGE_ORDER "Ordem" +#define TRANSLATION_MESSAGE_EXECUTED "executado" +#define TRANSLATION_MESSAGE_ERROR_OPENING_POSITION "Erro ao abrir uma ordem" +#define TRANSLATION_MESSAGE_POSITION_SIZER_ON "Position Sizer em " +#define TRANSLATION_MESSAGE_EXECUTE_TRADE "Executar a ordem?" +#define TRANSLATION_MESSAGE_BUY "Compra" +#define TRANSLATION_MESSAGE_BUY_STOP "Compra Stop" +#define TRANSLATION_MESSAGE_BUY_LIMIT "Compra Limit" +#define TRANSLATION_MESSAGE_SELL "Venda" +#define TRANSLATION_MESSAGE_SELL_STOP "Venda Stop" +#define TRANSLATION_MESSAGE_SELL_LIMIT "Venda Limit" +#define TRANSLATION_MESSAGE_SIZE "Tamanho" +#define TRANSLATION_MESSAGE_MULTIPLE "múltiplo" +#define TRANSLATION_MESSAGE_TRADE_CANCELED "Ordem cancelada." +#define TRANSLATION_MESSAGE_TSL_APPLIED "Trailing stop foi aplicado à ordem" +#define TRANSLATION_MESSAGE_SL_WAS_MOVED_FROM "O Stop Loss foi movido de" +#define TRANSLATION_MESSAGE_SL_WAS_MOVED_TO "para" +#define TRANSLATION_MESSAGE_BE_APPLIED "Breakeven foi aplicado à ordem" +#define TRANSLATION_MESSAGE_BE_FOR "Breakeven para " +#define TRANSLATION_MESSAGE_ERROR_SETTING_TIMER "Erro ao configurar o temporizador" +#define TRANSLATION_MESSAGE_FAILED_DELETE_INI "Falha ao excluir o arquivo .ini do painel de PS" +#define TRANSLATION_MESSAGE_MINIMUM_EXPIRY "A duração mínima de expiração é de 2 minutos." +#define TRANSLATION_MESSAGE_DONOTAPPLLYSL_SET "'Não aplicar Stop Losss' está marcada." +#define TRANSLATION_MESSAGE_DONOTAPPLLYTP_SET "'Não aplicar Take Profit' está marcada." +#define TRANSLATION_MESSAGE_FAILED_TO_CREATE_OUTSIDE_BUTTON "Falha ao criar um botão externo." diff --git a/MQL4/Experts/Position Sizer/Translations/Russian.mqh b/MQL4/Experts/Position Sizer/Translations/Russian.mqh new file mode 100644 index 0000000..6e6fceb --- /dev/null +++ b/MQL4/Experts/Position Sizer/Translations/Russian.mqh @@ -0,0 +1,308 @@ +// Tabs +#define TRANSLATION_TAB_BUTTON_MAIN "Основн." +#define TRANSLATION_TAB_BUTTON_RISK "Риск" +#define TRANSLATION_TAB_BUTTON_MARGIN "Маржа" +#define TRANSLATION_TAB_BUTTON_SWAPS "Свопы" +#define TRANSLATION_TAB_BUTTON_TRADING "Торг" + +// Entry +#define TRANSLATION_LABEL_ENTRY "Вход" +#define TRANSLATION_BUTTON_LONG "Покупка" +#define TRANSLATION_BUTTON_SHORT "Продажа" + +#define TRANSLATION_TOOLTIP_BUTTON_LONG_SHORT "Переключение между Покупкой и Продажей" + +#define TRANSLATION_TOOLTIP_ENTRY_INCREASE "Увеличить Вход на 1 пункт" +#define TRANSLATION_TOOLTIP_ENTRY_DECREASE "Уменьшить Вход на 1 пункт" + +// Stop-loss +#define TRANSLATION_LABEL_STOPLOSS "Стоп-лосс" +#define TRANSLATION_BUTTON_SL "СЛ, пункты" + +#define TRANSLATION_TOOLTIP_STOPLOSS_INCREASE "Увеличить Стоп-лосс на 1 пункт" +#define TRANSLATION_TOOLTIP_STOPLOSS_DECREASE "Уменьшить Стоп-лосс на 1 пункт" + +// Take-profit +#define TRANSLATION_LABEL_TAKEPROFIT "Тейк-профит" +#define TRANSLATION_BUTTON_TP "ТП, пункты" + +#define TRANSLATION_TOOLTIP_TAKEPROFIT_ADD "Добавить уровень тейк-профита" +#define TRANSLATION_TOOLTIP_BUTTON_TP "Установить ТП на основе СЛ или включить режим слежения за уровнем СЛ" + +#define TRANSLATION_TOOLTIP_TAKEPROFIT_INCREASE "Увеличить Тейк-профит на 1 пункт" +#define TRANSLATION_TOOLTIP_TAKEPROFIT_DECREASE "Уменьшить Тейк-профит на 1 пункт" + +#define TRANSLATION_LABEL_TAKEPROFIT_MULTIPLE_DISTANCE "ТП" +#define TRANSLATION_LABEL_TAKEPROFIT_MULTIPLE_POINTS "пункты" + +#define TRANSLATION_TOOLTIP_TAKEPROFIT_REMOVE "Убрать Тейк-профит" + +#define TRANSLATION_TOOLTIP_TAKEPROFIT_INCREASE_MULTIPLE "Увеличить Тейк-профит" +#define TRANSLATION_TOOLTIP_TAKEPROFIT_DECREASE_MULTIPLE "Уменьшить Тейк-профит" +#define TRANSLATION_TOOLTIP_TAKEPROFIT_BY_ONE_POINT "на 1 пункт" + +// ATR options +#define TRANSLATION_LABEL_ATR_PERIOD "Период ATR" +#define TRANSLATION_BUTTON_ATR_PERIOD_CURRENT "ТЕКУЩИЙ" +#define TRANSLATION_LABEL_ATR_SL_MULTIPLIER "Множ. СЛ" +#define TRANSLATION_LABEL_ATR_TP_MULTIPLIER "Множ. ТП" + +#define TRANSLATION_CHECKBOX_ATR_SA "ПС" +#define TRANSLATION_TOOLTIP_ATR_SA_SL "Применять поправку по спреду к стоп-лоссу" +#define TRANSLATION_TOOLTIP_ATR_SA_TP "Применять поправку по спреду к тейк-профиту" + +#define TRANSLATION_LABEL_ATR_TIMEFRAME "Таймфрейм ATR" +#define TRANSLATION_LABEL_ATR_VALUE "ATR" + +// Order type +#define TRANSLATION_LABEL_ORDER_TYPE "Тип ордера" +#define TRANSLATION_BUTTON_ORDER_TYPE_INSTANT "Рыночный" +#define TRANSLATION_BUTTON_ORDER_TYPE_PENDING "Отложенный" +#define TRANSLATION_TOOLTIP_ORDER_TYPE "Переключение между Рыночным и Отложенным" + +// Hide/show lines +#define TRANSLATION_BUTTON_HIDE_LINES "Убрать линии" +#define TRANSLATION_BUTTON_SHOW_LINES "Показ. линии" + +// Commission +#define TRANSLATION_LABEL_COMMISSION "Комиссия (1-сторон.) за лот" +#define TRANSLATION_TOOLTIP_COMMISSION "В валюте счета или %, за 1 стандартный лот" +#define TRANSLATION_TOOLTIP_COMMISSION_TYPE "Кликните, чтобы поменять" + +// Account size +#define TRANSLATION_BUTTON_ACCOUNT_BALANCE "Баланс счета" +#define TRANSLATION_BUTTON_ACCOUNT_EQUITY "Средства счета" +#define TRANSLATION_BUTTON_BALANCE_MINUS_CPR "Баланс - ТРП" +#define TRANSLATION_TOOLTIP_ACCOUNT_SIZE "Переключайте между балансом, средствами и балансом минус текущий риск по портфолио" +#define TRANSLATION_TOOLTIP_ACCOUNT_SIZE_ASTERISK_CUSTOM "Задан пользовательский баланс" +#define TRANSLATION_TOOLTIP_ACCOUNT_SIZE_ASTERISK_ADD "дополнительные средства" +#define TRANSLATION_TOOLTIP_ACCOUNT_SIZE_ASTERISK_SUB "вычтенные средства" + +// Calculations +#define TRANSLATION_LABEL_INPUT "Вход. данные" +#define TRANSLATION_LABEL_RESULT "Результат" +#define TRANSLATION_LABEL_RISK "Риск" +#define TRANSLATION_LABEL_MONEY "деньги" +#define TRANSLATION_LABEL_REWARD "Прибыль" +#define TRANSLATION_LABEL_REWARD_RISK "Прибыль/риск" +#define TRANSLATION_LABEL_POSITION_SIZE "Размер позиции" +#define TRANSLATION_BUTTON_MAX_PS "Макс РП" +#define TRANSLATION_LABEL_POINT_VALUE "Цена пункта" +#define TRANSLATION_TOOLTIP_INPUTS "Поля в этом столбце рассчитываются на основе введенных данных" +#define TRANSLATION_TOOLTIP_RESULT "Поля в этом столбце принимают во внимание ограничения брокера" + + +// Risk tab +#define TRANSLATION_CHECKBOX_COUNT_PENDING_ORDERS "Считать отложенные ордеры" +#define TRANSLATION_CHECKBOX_IGNORE_ORDERS_WO_SL "Игнорировать ордеры без стоп-лосса" +#define TRANSLATION_CHECKBOX_IGNORE_ORDERS_WO_TP "Игнорировать ордеры без тейк-профита" +#define TRANSLATION_LABEL_IGNORE_TRADES_IN "Игнорировать" +#define TRANSLATION_BUTTON_SYMBOLS_NO "ничего" +#define TRANSLATION_BUTTON_SYMBOLS_OTHER "др. символы" +#define TRANSLATION_BUTTON_SYMBOLS_CURRENT "тек. символ" +#define TRANSLATION_BUTTON_SYMBOLS_TOOLTIP "Переключение между «ничего», «другими символами» и «текущим символом»." +#define TRANSLATION_LABEL_LOTS "Лоты" +#define TRANSLATION_LABEL_CURRENT_PORTFOLIO "Тек. портфолио" +#define TRANSLATION_TOOLTIP_CURRENT_PORTFOLIO "Сделки, которые сейчас открыты" +#define TRANSLATION_LABEL_POTENTIAL_PORTFOLIO "Потенц. портфол." +#define TRANSLATION_TOOLTIP_POTENTIAL_PORTFOLIO "Включая позицию в расчете" +#define TRANSLATION_LABEL_CRRR_TOOLTIP "Соотношение риска и прибыли текущего портфолио" +#define TRANSLATION_LABEL_PRRR_TOOLTIP "Соотношение риска и прибыли потенциального портфолио" + + +// Margin tab +#define TRANSLATION_LABEL_POSITION_MARGIN "Маржа позиции" +#define TRANSLATION_LABEL_FUTURE_USED_MARGIN "Будущ. использ. маржа" +#define TRANSLATION_LABEL_FUTURE_FREE_MARGIN "Будущ. свобод. маржа" +#define TRANSLATION_LABEL_CUSTOM_LEVERAGE "Свое плечо " +#define TRANSLATION_LABEL_DEFAULT "По умолчанию" +#define TRANSLATION_LABEL_SYMBOL "Символ" +#define TRANSLATION_LABEL_MAX_PS_BY_MARGIN "Макс размер позиции по марже" +#define TRANSLATION_TOOLTIP_MAX_PS_BY_MARGIN "В лотах" + + +// Swaps tab +#define TRANSLATION_LABEL_TYPE "Тип" +#define TRANSLATION_LABEL_UNKNOWN "Неизвестно" +#define TRANSLATION_LABEL_INTEREST "Процент" +#define TRANSLATION_LABEL_TRIPLE_SWAP "Своп × 3" +#define TRANSLATION_EDIT_WEEKDAY_SUNDAY "Воскресенье" +#define TRANSLATION_EDIT_WEEKDAY_MONDAY "Понедельник" +#define TRANSLATION_EDIT_WEEKDAY_TUESDAY "Вторник" +#define TRANSLATION_EDIT_WEEKDAY_WEDNESDAY "Среда" +#define TRANSLATION_EDIT_WEEKDAY_THURSDAY "Четверг" +#define TRANSLATION_EDIT_WEEKDAY_FRIDAY "Пятница" +#define TRANSLATION_EDIT_WEEKDAY_SATURDAY "Суббота" +#define TRANSLATION_LABEL_NOMINAL "Знач." +#define TRANSLATION_LABEL_DAILY "В день" +#define TRANSLATION_LABEL_YEARLY "В год" +#define TRANSLATION_LABEL_PER_LOT "за лот" +#define TRANSLATION_LABEL_PER_PS "за РП" +#define TRANSLATION_LABEL_BASE_CURRENCY "Базовая валюта" +#define TRANSLATION_LABEL_MARGIN_CURRENCY "Валюта маржи" + + +// Trading tab +#define TRANSLATION_BUTTON_TRADE "Откр." +#define TRANSLATION_LABEL_TRAILING_STOP "Трейлинг" +#define TRANSLATION_LABEL_BREAKEVEN "Безубыток" +#define TRANSLATION_LABEL_MAGIC_NUMBER "Мэджик" +#define TRANSLATION_LABEL_ORDER_COMMENTARY "Комментарий" +#define TRANSLATION_LABEL_ORDER_AUTOSUFFIX "Автосуф." +#define TRANSLATION_TOOLTIP_ORDER_AUTOSUFFIX "Добавлять автоматически инкрементируемое число к комментарию каждой следующей сделки?" +#define TRANSLATION_LABEL_MAX_NUMBER_OF_TRADES "Макс № сделок" +#define TRANSLATION_LABEL_TOTAL "Всего" +#define TRANSLATION_LABEL_PER_SYMBOL "На символ" +#define TRANSLATION_LABEL_MAX_VOLUME "Макс объем" +#define TRANSLATION_LABEL_MAX_RISK "Макс риск" +#define TRANSLATION_CHECKBOX_DISABLE_TRADING_LINES_HIDDEN "Не разрешать торговлю, когда линии спрятаны" +#define TRANSLATION_TOOLTIP_FILL_INWARD "Заполнить дополнительные ТП равномерно между Входом и основным ТП." +#define TRANSLATION_TOOLTIP_FILL_OUTWARD "Разместить дополнительные ТП за основным ТП, используя то же расстояние." +#define TRANSLATION_LABEL_SHARE "Доля" +#define TRANSLATION_TOOLTIP_SHARE "Автоматически заполнить доли объема" +#define TRANSLATION_LABEL_POINTS "Пункты" +#define TRANSLATION_LABEL_MAX_SLIPPAGE "Макс проскальз." +#define TRANSLATION_LABEL_MAX_SPREAD "Макс спред" +#define TRANSLATION_LABEL_MAX_ENTRY_SL_DISTANCE "Макс расст. Вход/СЛ" +#define TRANSLATION_LABEL_MIN_ENTRY_SL_DISTANCE "Мин расст. Вход/СЛ" +#define TRANSLATION_LABEL_MAX_RISK_PERCENTAGE "Макс риск %" +#define TRANSLATION_CHECKBOX_SUBTRACT_OPEN_POSITIONS_VOLUME "Выч. об. откр. позиций" +#define TRANSLATION_CHECKBOX_SUBTRACT_PENDING_ORDERS_VOLUME "Выч. об. отлож. ордеров" +#define TRANSLATION_CHECKBOX_DO_NOT_APPLY_STOPLOSS "Не примен. стоп-лосс" +#define TRANSLATION_CHECKBOX_DO_NOT_APPLY_TAKEPROFIT "Не примен. тейк-профит" +#define TRANSLATION_TOOLTIP_SUBTRACT_OPEN_POSITIONS_VOLUME "Советник вычтет текущий объем по открытым сделкам из рассчитанного размера позиции перед тем, как ее открыть." +#define TRANSLATION_TOOLTIP_SUBTRACT_PENDING_ORDERS_VOLUME "Советник вычтет текущий объем по отложенным ордерам из рассчитанного размера позиции перед тем, как ее открыть." +#define TRANSLATION_TOOLTIP_DO_NOT_APPLY_STOPLOSS "Советник откроет сделку без стоп-лосса." +#define TRANSLATION_TOOLTIP_DO_NOT_APPLY_TAKEPROFIT "Советник откроет сделку без тейк-профита." +#define TRANSLATION_CHECKBOX_ASK_FOR_CONFIRMATION "Спрашивать подтверждение" +#define TRANSLATION_TOOLTIP_ASK_FOR_CONFIRMATION "Советник будет спрашивать подтверждение перед открытием сделки." +#define TRANSLATION_LABEL_EXPIRY "Срок" +#define TRANSLATION_TOOLTIP_EXPIRY "Срок истечения в минутах для следующего созданного отложенного ордера. Минимум = 10." +#define TRANSLATION_LABEL_MINUTES "мин." +#define TRANSLATION_TOOLTIP_MINUTES "Минуты" + + +// Chart objects +#define TRANSLATION_TOOLTIP_SL_LABEL "Расстояние до СЛ, пункты" +#define TRANSLATION_TOOLTIP_TP_LABEL "Расстояние до ТП, пункты" +#define TRANSLATION_TOOLTIP_ENTRY_LABEL "Расстояние до Входа, пункты" +#define TRANSLATION_TOOLTIP_ENTRY_LABEL_ADDITIONAL "Размер позиции, лоты" +#define TRANSLATION_TOOLTIP_OUTSIDE_TRADE_BUTTON "Кликните, чтобы создать ордер/позицию." +#define TRANSLATION_CLOSE_BUTTON "Закрыть" + + +// Warnings +#define TRANSLATION_LABEL_WARNING_TOO_CLOSE "(Близко!)" +#define TRANSLATION_LABEL_WARNING_WRONG_VALUE "(Значение!)" +#define TRANSLATION_LABEL_WARNING_INVALID_TP "Неправ. ТП" +#define TRANSLATION_TOOLTIP_WARNING_PS "Больше, чем максимальный размер позиции по марже!" + +// Messages +#define TRANSLATION_MESSAGE_SL_SHOULD_BE_POSITIVE "Стоп-лосс должен быть положительным." +#define TRANSLATION_MESSAGE_TRYING_TO_SAVE_FILE "Попытка сохранения настроек в файл" +#define TRANSLATION_MESSAGE_FAILED_TO_OPEN_FOR_WRITING "Не удалось открыть файл для записи" +#define TRANSLATION_MESSAGE_ERROR "Ошибка" +#define TRANSLATION_MESSAGE_SAVED_SETTINGS "Настройки сохранены успешно." +#define TRANSLATION_MESSAGE_TRYING_TO_LOAD_FILE "Попытка загрузки настроек из файла." +#define TRANSLATION_MESSAGE_NO_SETTINGS_FILE_TO_LOAD "Нет файла для загрузки." +#define TRANSLATION_MESSAGE_FAILED_TO_OPEN_FOR_READING "Не удалось открыть файл для чтения" +#define TRANSLATION_MESSAGE_LOADED_SETTINGS "Настройки загружены успешно." +#define TRANSLATION_MESSAGE_NO_SETTINGS_FILE_TO_DELETE "Нет файла для удаления." +#define TRANSLATION_MESSAGE_TRYING_TO_DELETE_FILE "Попытка удаления файла с настройками." +#define TRANSLATION_MESSAGE_FAILED_TO_DELETE_FILE "Не удалось удалить файл" +#define TRANSLATION_MESSAGE_DELETED_SETTINGS "Файл с настройками удален успешно." +#define TRANSLATION_MESSAGE_DELETED_DUPLICATE_PANEL "Удалены объекты панели-дубликата с префиксом" +#define TRANSLATION_MESSAGE_ENTRY_SL_DIFFERENT_NON_ZERO "Вход и стоп-лосс должны отличаться и быть ненулевыми." +#define TRANSLATION_MESSAGE_ENTRY_SL_DIFFERENT "Стоп-лосс должен отличаться от Входа." +#define TRANSLATION_MESSAGE_CANNOT_RETRIEVE_TICKSIZE "Невозможно получить размер тика для " +#define TRANSLATION_MESSAGE_LOOKS_LIKE "Похоже, что инструмент более не доступен. Расчет может быть неточным." +#define TRANSLATION_MESSAGE_MISCONFIGURED_SYMBOL "Символ настроен неправильно на торговом сервере - нулевая цена единицы." +#define TRANSLATION_MESSAGE_ALGO_TRADING_DISABLED_1 "Автоматическая торговля отключена в настройках платформы! Пожалуйста, включите его через Сервис->Настройки->Советники." +#define TRANSLATION_MESSAGE_ALGO_TRADING_DISABLED_2 "Торговля отключена в настройках советника! Пожалуйста, разрешите ее на вкладке Общие." +#define TRANSLATION_MESSAGE_STOPLOSS_PROBLEM "Проблемный стоп-лосс" +#define TRANSLATION_MESSAGE_WRONG_POSITION_SIZE_VALUE "Неправильное значение размера позиции!" +#define TRANSLATION_MESSAGE_MULTIPLE_TP_VOLUME_SHARE_SUM "Сумма долей объема нескольких ТП" +#define TRANSLATION_MESSAGE_INCORRECT_VOLUME_SUM "Неправильная сумма объемов нескольких ТП - сделка не будет открыта." +#define TRANSLATION_MESSAGE_NOT_TAKING_A_TRADE "Сделка не будет открыта" +#define TRANSLATION_MESSAGE_NTAT_LINES "линии спрятаны и панель настроена так, чтобы не торговать при спрятанных линиях." +#define TRANSLATION_MESSAGE_NTAT_SPREAD "текущий спред" +#define TRANSLATION_MESSAGE_MAXIMUM_SPREAD "максимальный спред" +#define TRANSLATION_MESSAGE_NTAT_ENTRY_SL_DISTANCE "текущее расстояние Вход/СЛ" +#define TRANSLATION_MESSAGE_NTAT_CURRENT_RISK "текущий результат по риску" +#define TRANSLATION_MESSAGE_NTAT_MAX_RISK "максимальный риск" +#define TRANSLATION_MESSAGE_NTAT_TOTAL_NUMBER "текущее общее число сделок" +#define TRANSLATION_MESSAGE_NUMBER_OF_TRADES_IN_EXECUTION "число сделок на исполнении" +#define TRANSLATION_MESSAGE_MAXIMUM_TOTAL_NUMBER_OF_TRADES_ALLOWED "максимально допустимое общее число сделок" +#define TRANSLATION_MESSAGE_NTAT_PER_SYMBOL_NUMBER "текущее число сделок по символу" +#define TRANSLATION_MESSAGE_MAXIMUM_PER_SYMBOL_NUMBER_OF_TRADES_ALLOWED "максимально допустимое число сделок по символу" +#define TRANSLATION_MESSAGE_TOTAL_POTENTIAL_RISK "общий потенциальный риск" +#define TRANSLATION_MESSAGE_MAXIUMUM_TOTAL_RISK "максимально допустимый общий риск" +#define TRANSLATION_MESSAGE_INFINITE_TOTAL_POTENTIAL_RISK "бесконечный общий потенциальный риск" +#define TRANSLATION_MESSAGE_PER_SYMBOL_POTENTIAL_RISK "потенциальный риск по символу" +#define TRANSLATION_MESSAGE_MAXIMUM_PER_SYMBOL_RISK "максимально допустимый риск по символу" +#define TRANSLATION_MESSAGE_INFINITE_PER_SYMBOL_POTENTIAL_RISK "бесконечный потенциальный риск по символу" +#define TRANSLATION_MESSAGE_IGNORE_MARKET_EXECUTION_MODE_WARNING ", но IgnoreMarketExecutionMode = true. Переключите на false, если сделки не исполняются." +#define TRANSLATION_MESSAGE_EXECUTION_MODE "Режим исполнения" +#define TRANSLATION_MESSAGE_FOUND_EXISTING_BUY_VOLUME "Найденный текущий объем на покупку" +#define TRANSLATION_MESSAGE_FOUND_EXISTING_SELL_VOLUME "Найденный текущий объем на продажу" +#define TRANSLATION_MESSAGE_ADJUSTED_POSITION_SIZE "Исправленный размер позиции" +#define TRANSLATION_MESSAGE_ADJUSTED_POSITION_SIZE_LESS_THAN_ZERO "Исправленный размер позиции меньше или равен нулю. Сделка исполнена не будет." +#define TRANSLATION_MESSAGE_NTAT_TOTAL_VOLUME "текущий общий объем" +#define TRANSLATION_MESSAGE_NTAT_NEW_POSITION_VOLUME "объем новой позиции" +#define TRANSLATION_MESSAGE_NTAT_MAXIMUM_TOTAL_VOLUME "максимально допустимый общий объем" +#define TRANSLATION_MESSAGE_NTAT_PER_SYMBOL_VOLUME "текущий объем по символу" +#define TRANSLATION_MESSAGE_NTAT_MAXIMUM_PER_SYMBOL_VOLUME "максимально допустимый объем по символу" +#define TRANSLATION_MESSAGE_BROKER_MINIMUM "минимальный размер позиции у брокера. Сделка не будет исполнена." +#define TRANSLATION_MESSAGE_BROKER_MAXIMUM "максимальный размер позиции у брокера. Позиция будет уменьшена." +#define TRANSLATION_MESSAGE_ERROR_SENDING_ORDER "Ошибка отправки ордера" +#define TRANSLATION_MESSAGE_ORDER_EXECUTED "Ордер исполнен." +#define TRANSLATION_MESSAGE_TICKET "Тикет" +#define TRANSLATION_MESSAGE_ORDER "Ордер" +#define TRANSLATION_MESSAGE_EXECUTED "исполнен" +#define TRANSLATION_MESSAGE_ERROR_OPENING_POSITION "Ошибка открытия позиции" +#define TRANSLATION_MESSAGE_POSITION_SIZER_ON "Position Sizer на " +#define TRANSLATION_MESSAGE_EXECUTE_TRADE "Исполнить сделку?" +#define TRANSLATION_MESSAGE_BUY "Покупка" +#define TRANSLATION_MESSAGE_BUY_STOP "Стоп на покупку" +#define TRANSLATION_MESSAGE_BUY_LIMIT "Лимит на покупку" +#define TRANSLATION_MESSAGE_SELL "Продажа" +#define TRANSLATION_MESSAGE_SELL_STOP "Стоп на продажу" +#define TRANSLATION_MESSAGE_SELL_LIMIT "Лимит на продажу" +#define TRANSLATION_MESSAGE_SIZE "Размер" +#define TRANSLATION_MESSAGE_MULTIPLE "несколько" +#define TRANSLATION_MESSAGE_TRADE_CANCELED "Сделка отменена." +#define TRANSLATION_MESSAGE_TSL_APPLIED "Трейлинг-стоп добавлен к позиции" +#define TRANSLATION_MESSAGE_SL_WAS_MOVED_FROM "Стоп-лосс передвинут с" +#define TRANSLATION_MESSAGE_SL_WAS_MOVED_TO "на" +#define TRANSLATION_MESSAGE_BE_APPLIED "Безубыток применен к позиции" +#define TRANSLATION_MESSAGE_BE_FOR "Безубыток для " +#define TRANSLATION_MESSAGE_ERROR_SETTING_TIMER "Ошибка установки таймера" +#define TRANSLATION_MESSAGE_FAILED_DELETE_INI "Не удалось удалить ini-файл панели" +#define TRANSLATION_MESSAGE_MINIMUM_EXPIRY "Минимальный срок действия отложенного ордера - 2 минуты." +#define TRANSLATION_MESSAGE_DONOTAPPLLYSL_SET "Отмечен чекбокс 'Не примен. стоп-лосс'." +#define TRANSLATION_MESSAGE_DONOTAPPLLYTP_SET "Отмечен чекбокс 'Не примен. тейк-профит'." +#define TRANSLATION_MESSAGE_FAILED_TO_CREATE_OUTSIDE_BUTTON "Ошибка при создании внешней кнопки." +#define TRANSLATION_MESSAGE_FAILED_TO_CREATE_OUTSIDE_BUTTON "Ошибка при создании внешней кнопки." +#define TRANSLATION_MESSAGE_TAKING_SMALLER_TRADE "Открытие сделки меньшего размера" +#define TRANSLATION_MESSAGE_NEW_POSITION_SIZE "Новый размер позиции" +#define TRANSLATION_MESSAGE_CANNOT_TAKE_SMALLER_TRADE "Невозможно открыть меньшую сделку." +#define TRANSLATION_MESSAGE_ARE_YOU_SURE "Вы уверены, что хотите закрыть Position Sizer?" +#define TRANSLATION_MESSAGE_EXIT "Выйти?" +#define TRANSLATION_MESSAGE_COULDNT_DETECT "Невозможно определить правильную валютную пару для расчета поправки." +#define TRANSLATION_MESSAGE_ACCOUNT_CURRENCY "Валюта счета" +#define TRANSLATION_MESSAGE_TRYING_TO_FIND "Попытка найти возможную комбинацию из двух символов." +#define TRANSLATION_MESSAGE_CONVERTING_VIA "Конвертация через" +#define TRANSLATION_MESSAGE_ADJUSTMENT_CALCULATION_CRITICAL_FAILURE "Критическая ошибка расчета поправки. И простая конвертация и конвертация на двух парах не увенчались успехом." +#define TRANSLATION_MESSAGE_COULDNT_DETECT_PROPER_CURRENCY_PAIR "Ошибка. Не получилось определить правильную валютную пару для расчета поправки через на двух парах." +#define TRANSLATION_MESSAGE_CROSS_CURRENCY "Пересекающаяся валюта" +#define TRANSLATION_MESSAGE_CHARTS_PAIR_CURRENCY "Валюта пары с графика" +#define TRANSLATION_MESSAGE_INFINITY "Бесконечность" +#define TRANSLATION_MESSAGE_EXECUTION_FAILED "Исполнение не удалось." +#define TRANSLATION_MESSAGE_FAILED_TO_FIND_ORDER "Не получилось найти ордер для стоп-лосса и тейк-профита." +#define TRANSLATION_MESSAGE_ERROR_MODIFYING_ORDER "Ошибка изменения ордера" +#define TRANSLATION_MESSAGE_ORDERSELECT_FAILED "Вызов OrderSelect не удался" +#define TRANSLATION_MESSAGE_FAILED_TO_SET_TRAILING_STOP_FOR_BUY "Не удалось установить трейлинг-стоп на ордер на Покупку" +#define TRANSLATION_MESSAGE_FAILED_TO_SET_TRAILING_STOP_FOR_SELL "Не удалось установить трейлинг-стоп на ордер на Продажу" +#define TRANSLATION_MESSAGE_ORDERDELETE_FAILED "Функция OrderDelete вернула ошибку" +#define TRANSLATION_MESSAGE_ORDERCLOSE_FAILED "Функция OrderClose вернула ошибку" +#define TRANSLATION_MESSAGE_OBJECT_NOT_FOUND "Объект не найден" \ No newline at end of file diff --git a/MQL4/Experts/Position Sizer/Translations/Spanish.mqh b/MQL4/Experts/Position Sizer/Translations/Spanish.mqh new file mode 100644 index 0000000..68751da --- /dev/null +++ b/MQL4/Experts/Position Sizer/Translations/Spanish.mqh @@ -0,0 +1,268 @@ +#define TRANSLATION_TAB_BUTTON_MAIN "Inicio" +#define TRANSLATION_TAB_BUTTON_RISK "Riesgo" +#define TRANSLATION_TAB_BUTTON_MARGIN "Margen" +#define TRANSLATION_TAB_BUTTON_SWAPS "Swaps" +#define TRANSLATION_TAB_BUTTON_TRADING "Trading" + +#define TRANSLATION_LABEL_SPREAD "Spread" + +#define TRANSLATION_LABEL_ENTRY "Entrada" + +#define TRANSLATION_BUTTON_LONG "Largo" +#define TRANSLATION_BUTTON_SHORT "Corto" + +#define TRANSLATION_TOOLTIP_BUTTON_LONG_SHORT "Cambiar entre Largo y Corto" + +#define TRANSLATION_TOOLTIP_ENTRY_INCREASE "Aumentar Entrada 1 punto" +#define TRANSLATION_TOOLTIP_ENTRY_DECREASE "Disminuir Entrada 1 punto" + +#define TRANSLATION_LABEL_STOPLOSS "Stop-loss" +#define TRANSLATION_BUTTON_SL "SL, puntos" + +#define TRANSLATION_TOOLTIP_STOPLOSS_INCREASE "Aumentar Stop-loss 1 punto" +#define TRANSLATION_TOOLTIP_STOPLOSS_DECREASE "Disminuir Stop-loss 1 punto" + +#define TRANSLATION_LABEL_TAKEPROFIT "Take-profit" +#define TRANSLATION_BUTTON_TP "TP, puntos" + +#define TRANSLATION_TOOLTIP_TAKEPROFIT_ADD "Añadir nivel take-profit" +#define TRANSLATION_TOOLTIP_BUTTON_TP "Poner TP basado en SL o habilitar modo bloqueado de TP" + +#define TRANSLATION_TOOLTIP_TAKEPROFIT_INCREASE "Aumentar Take-profit 1 punto" +#define TRANSLATION_TOOLTIP_TAKEPROFIT_DECREASE "Disminuir Take-profit 1 punto" + +#define TRANSLATION_LABEL_TAKEPROFIT_MULTIPLE_DISTANCE "TP" +#define TRANSLATION_LABEL_TAKEPROFIT_MULTIPLE_POINTS "puntos" + +#define TRANSLATION_TOOLTIP_TAKEPROFIT_REMOVE "Quitar Take-profit" + +#define TRANSLATION_TOOLTIP_TAKEPROFIT_INCREASE_MULTIPLE "Aumentar Take-profit" +#define TRANSLATION_TOOLTIP_TAKEPROFIT_DECREASE_MULTIPLE "Disminuir Take-profit" +#define TRANSLATION_TOOLTIP_TAKEPROFIT_BY_ONE_POINT "1 punto" + +#define TRANSLATION_LABEL_ATR_PERIOD "Plazo ATR" +#define TRANSLATION_BUTTON_ATR_PERIOD_CURRENT "ACTUAL" +#define TRANSLATION_LABEL_ATR_SL_MULTIPLIER "Multiplic. SL" +#define TRANSLATION_LABEL_ATR_TP_MULTIPLIER "Multiplic. TP" + +#define TRANSLATION_CHECKBOX_ATR_SA "AS" +#define TRANSLATION_TOOLTIP_ATR_SA_SL "Aplicar ajuste de spread al stop-loss" +#define TRANSLATION_TOOLTIP_ATR_SA_TP "Aplicar ajuste de spread al take-profit" + +#define TRANSLATION_LABEL_ATR_TIMEFRAME "Período ATR" +#define TRANSLATION_LABEL_ATR_VALUE "ATR" + +#define TRANSLATION_LABEL_ORDER_TYPE "Tipo de orden" + +#define TRANSLATION_BUTTON_ORDER_TYPE_INSTANT "Instante" +#define TRANSLATION_BUTTON_ORDER_TYPE_PENDING "Pendiente" + +#define TRANSLATION_TOOLTIP_ORDER_TYPE "Cambiar entre Instante y Pendiente" + +#define TRANSLATION_BUTTON_HIDE_LINES "Ocultar líneas" +#define TRANSLATION_BUTTON_SHOW_LINES "Mostrar líneas" + +#define TRANSLATION_LABEL_COMMISSION "Comisión por lote" + +#define TRANSLATION_TOOLTIP_COMMISSION "En la divisa de la cuenta o en %, por entrada/salida y 1 lote estándar" +#define TRANSLATION_TOOLTIP_COMMISSION_TYPE "Pulse para cambiar" + +#define TRANSLATION_BUTTON_ACCOUNT_BALANCE "Balance cuenta" +#define TRANSLATION_BUTTON_ACCOUNT_EQUITY "Equidad cuenta" +#define TRANSLATION_BUTTON_BALANCE_MINUS_CPR "Balance - RCA" + +#define TRANSLATION_TOOLTIP_ACCOUNT_SIZE "Cambiar entre balance, equidad y balance menos riesgo de cartera actual" +#define TRANSLATION_TOOLTIP_ACCOUNT_SIZE_ASTERISK_CUSTOM "Establecer balance personalizado" +#define TRANSLATION_TOOLTIP_ACCOUNT_SIZE_ASTERISK_ADD "fondos adicionales" +#define TRANSLATION_TOOLTIP_ACCOUNT_SIZE_ASTERISK_SUB "fondos quitados" + +#define TRANSLATION_LABEL_INPUT "Entrada" +#define TRANSLATION_LABEL_RESULT "Resultado" +#define TRANSLATION_LABEL_RISK "Riesgo" +#define TRANSLATION_LABEL_MONEY "dinero" +#define TRANSLATION_LABEL_REWARD "Recomp." +#define TRANSLATION_LABEL_REWARD_RISK "Recompensa/riesgo" +#define TRANSLATION_LABEL_POSITION_SIZE "Tam. posición" +#define TRANSLATION_BUTTON_MAX_PS "TP máx" +#define TRANSLATION_LABEL_POINT_VALUE "Valor de punto" + +#define TRANSLATION_CHECKBOX_COUNT_PENDING_ORDERS "Contar órdenes pendientes" +#define TRANSLATION_CHECKBOX_IGNORE_ORDERS_WO_SL "Ignorar órdenes sin stop-loss" +#define TRANSLATION_CHECKBOX_IGNORE_ORDERS_WO_TP "Ignorar órdenes sin take-profit" +#define TRANSLATION_CHECKBOX_IGNORE_ORDERS_IN_OTHER_SYMBOLS "Ignorar órdenes en otros símbolos" +#define TRANSLATION_LABEL_LOTS "Lots" +#define TRANSLATION_LABEL_CURRENT_PORTFOLIO "Cartera actual" +#define TRANSLATION_TOOLTIP_CURRENT_PORTFOLIO "Operaciones abiertas actualmente" +#define TRANSLATION_LABEL_POTENTIAL_PORTFOLIO "Potencial cartera" +#define TRANSLATION_TOOLTIP_POTENTIAL_PORTFOLIO "Incluyendo la posición que se está calculando" +#define TRANSLATION_LABEL_CRRR_TOOLTIP "Relación riesgo-recompensa de la cartera actual" +#define TRANSLATION_LABEL_PRRR_TOOLTIP "Relación riesgo-recompensa de la cartera potencial" + +#define TRANSLATION_LABEL_POSITION_MARGIN "Margen posición" +#define TRANSLATION_LABEL_FUTURE_USED_MARGIN "Margen futuro usado" +#define TRANSLATION_LABEL_FUTURE_FREE_MARGIN "Margen futuro libre" +#define TRANSLATION_LABEL_CUSTOM_LEVERAGE "Apalanc. person." + +#define TRANSLATION_LABEL_DEFAULT "Por defecto" +#define TRANSLATION_LABEL_SYMBOL "Símbolo" +#define TRANSLATION_LABEL_MAX_PS_BY_MARGIN "Tamaño de posición máx. por margen" + +#define TRANSLATION_TOOLTIP_MAX_PS_BY_MARGIN "En lotes" + +#define TRANSLATION_LABEL_TYPE "Tipo" +#define TRANSLATION_LABEL_UNKNOWN "Desconocido" +#define TRANSLATION_LABEL_TRIPLE_SWAP "Triple swap" +#define TRANSLATION_EDIT_WEEKDAY_SUNDAY "Domingo" +#define TRANSLATION_EDIT_WEEKDAY_MONDAY "Lunes" +#define TRANSLATION_EDIT_WEEKDAY_TUESDAY "Martes" +#define TRANSLATION_EDIT_WEEKDAY_WEDNESDAY "Miércoles" +#define TRANSLATION_EDIT_WEEKDAY_THURSDAY "Jueves" +#define TRANSLATION_EDIT_WEEKDAY_FRIDAY "Viernes" +#define TRANSLATION_EDIT_WEEKDAY_SATURDAY "Sábado" + +#define TRANSLATION_LABEL_NOMINAL "Nominal" +#define TRANSLATION_LABEL_DAILY "Diario" +#define TRANSLATION_LABEL_YEARLY "Anual" +#define TRANSLATION_LABEL_PER_LOT "por lote" +#define TRANSLATION_LABEL_PER_PS "por TP" +#define TRANSLATION_LABEL_BASE_CURRENCY "Divisa base" +#define TRANSLATION_LABEL_MARGIN_CURRENCY "Divisa margen" + +#define TRANSLATION_BUTTON_TRADE "Operar" + +#define TRANSLATION_LABEL_TRAILING_STOP "Trailing stop" +#define TRANSLATION_LABEL_BREAKEVEN "Breakeven" + +#define TRANSLATION_LABEL_MAGIC_NUMBER "Número mágico" +#define TRANSLATION_LABEL_ORDER_COMMENTARY "Comentario orden" + +#define TRANSLATION_LABEL_ORDER_AUTOSUFFIX "Autosufijo" + +#define TRANSLATION_TOOLTIP_ORDER_AUTOSUFFIX "¿Agregar un número incrementado automáticamente a un comentario de cada nueva operación?" + +#define TRANSLATION_LABEL_MAX_NUMBER_OF_TRADES "Máx nº oper." +#define TRANSLATION_LABEL_TOTAL "Total" +#define TRANSLATION_LABEL_PER_SYMBOL "Por símbolo" +#define TRANSLATION_LABEL_MAX_VOLUME "Máx volumen" +#define TRANSLATION_LABEL_MAX_RISK "Máx riesgo" + +#define TRANSLATION_CHECKBOX_DISABLE_TRADING_LINES_HIDDEN "Desactivar trading con las líneas ocultas" +#define TRANSLATION_TOOLTIP_FILL_INWARD "Poner los TP extra de forma equidistante entre entrada y TP principal." +#define TRANSLATION_TOOLTIP_FILL_OUTWARD "Poner TP extra más allá del TP principal usando la misma distancia." +#define TRANSLATION_LABEL_SHARE "Cuota" +#define TRANSLATION_TOOLTIP_SHARE "Rellenar automáticamente las cuotas de volumen" +#define TRANSLATION_LABEL_POINTS "Puntos" +#define TRANSLATION_LABEL_MAX_SLIPPAGE "Deslizamiento máx" +#define TRANSLATION_LABEL_MAX_SPREAD "Spread máx" +#define TRANSLATION_LABEL_MAX_ENTRY_SL_DISTANCE "Máx dist. Entrada/SL" +#define TRANSLATION_LABEL_MIN_ENTRY_SL_DISTANCE "Mín dist. Entrada/SL" +#define TRANSLATION_CHECKBOX_SUBTRACT_OPEN_POSITIONS_VOLUME "Quitar vol. operaciones abiertas" +#define TRANSLATION_CHECKBOX_SUBTRACT_PENDING_ORDERS_VOLUME "Quitar vol. órdenes pendientes" +#define TRANSLATION_CHECKBOX_DO_NOT_APPLY_STOPLOSS "No aplicar stop-loss" +#define TRANSLATION_CHECKBOX_DO_NOT_APPLY_TAKEPROFIT "No aplicar take-profit" +#define TRANSLATION_TOOLTIP_SUBTRACT_OPEN_POSITIONS_VOLUME "El EA restará el volumen de las operaciones abiertas actualmente del tamaño de la posición calculada antes de abrir una operación." +#define TRANSLATION_TOOLTIP_SUBTRACT_PENDING_ORDERS_VOLUME "El EA restará el volumen de las órdenes pendientes del tamaño de la posición calculada antes de abrir una operación." +#define TRANSLATION_TOOLTIP_DO_NOT_APPLY_STOPLOSS "El EA no aplicará stop-loss a la operación que abra." +#define TRANSLATION_TOOLTIP_DO_NOT_APPLY_TAKEPROFIT "El EA no aplicará take-profit a la operación que abra." +#define TRANSLATION_CHECKBOX_ASK_FOR_CONFIRMATION "Pedir confirmación" +#define TRANSLATION_TOOLTIP_ASK_FOR_CONFIRMATION "El EA le pedirá confirmación antes de abrir una operación." +#define TRANSLATION_LABEL_EXPIRY "Expiración" +#define TRANSLATION_TOOLTIP_EXPIRY "Tiempo de expiración en minutos para la siguiente orden pendiente creada. Mínimo = 10." +#define TRANSLATION_LABEL_MINUTES "min." +#define TRANSLATION_TOOLTIP_MINUTES "Minutos" + + +#define TRANSLATION_TOOLTIP_SL_LABEL "Distancia SL, puntos" +#define TRANSLATION_TOOLTIP_TP_LABEL "Distancia TP, puntos" +#define TRANSLATION_TOOLTIP_ENTRY_LABEL "Distancia Entrada, puntos" +#define TRANSLATION_TOOLTIP_ENTRY_LABEL_ADDITIONAL "Tamaño de posición, lotes" +#define TRANSLATION_TOOLTIP_OUTSIDE_TRADE_BUTTON "Haga clic para abrir una orden/posición." + + +#define TRANSLATION_LABEL_WARNING_TOO_CLOSE "(¡Muy cerca!)" +#define TRANSLATION_LABEL_WARNING_WRONG_VALUE "(Valor incorrecto)" +#define TRANSLATION_LABEL_WARNING_INVALID_TP "TP no válido" + +#define TRANSLATION_TOOLTIP_WARNING_PS "¡Mayor que el tamaño de posición máximo por margen!" + +#define TRANSLATION_MESSAGE_SL_SHOULD_BE_POSITIVE "El stop-loss debe ser positivo" +#define TRANSLATION_MESSAGE_TRYING_TO_SAVE_FILE "Intentando guardar la configuración en un archivo" +#define TRANSLATION_MESSAGE_FAILED_TO_OPEN_FOR_WRITING "Error al abrir el archivo para escribir" +#define TRANSLATION_MESSAGE_ERROR "Error" +#define TRANSLATION_MESSAGE_SAVED_SETTINGS "Configuración guardada correctamente" +#define TRANSLATION_MESSAGE_TRYING_TO_LOAD_FILE "Intentando cargar la configuración desde el archivo" +#define TRANSLATION_MESSAGE_NO_SETTINGS_FILE_TO_LOAD "No hay archivo de configuración para cargar" +#define TRANSLATION_MESSAGE_FAILED_TO_OPEN_FOR_READING "Error al abrir el archivo para lectura" +#define TRANSLATION_MESSAGE_LOADED_SETTINGS "Configuración cargada correctamente" +#define TRANSLATION_MESSAGE_NO_SETTINGS_FILE_TO_DELETE "No hay archivo de configuración para eliminar" +#define TRANSLATION_MESSAGE_TRYING_TO_DELETE_FILE "Intentando eliminar el archivo de configuración" +#define TRANSLATION_MESSAGE_FAILED_TO_DELETE_FILE "Error al eliminar el archivo" +#define TRANSLATION_MESSAGE_DELETED_SETTINGS "Archivo de configuración eliminado correctamente" +#define TRANSLATION_MESSAGE_DELETED_DUPLICATE_PANEL "Objetos de panel duplicados eliminados con prefijo" +#define TRANSLATION_MESSAGE_ENTRY_SL_DIFFERENT_NON_ZERO "Los niveles de entrada y Stop-Loss deben ser diferentes y distintos de cero" +#define TRANSLATION_MESSAGE_ENTRY_SL_DIFFERENT "Stop-loss debe ser diferente de Entrada" +#define TRANSLATION_MESSAGE_CANNOT_RETRIEVE_TICKSIZE "No se puede recuperar el tamaño del tick para " +#define TRANSLATION_MESSAGE_LOOKS_LIKE "Parece que el instrumento ya no está disponible. Es posible que el cálculo no sea exacto" +#define TRANSLATION_MESSAGE_MISCONFIGURED_SYMBOL "Símbolo mal configurado en el servidor de trading - coste unitario cero" +#define TRANSLATION_MESSAGE_ALGO_TRADING_DISABLED "Trading automático desactivado. Habilite Trading automático" +#define TRANSLATION_MESSAGE_STOPLOSS_PROBLEM "Problema en stop-loss" +#define TRANSLATION_MESSAGE_WRONG_POSITION_SIZE_VALUE "¡Valor de tamaño de posición incorrecto!" +#define TRANSLATION_MESSAGE_MULTIPLE_TP_VOLUME_SHARE_SUM "Suma de múltiples cuotas de volumen" +#define TRANSLATION_MESSAGE_INCORRECT_VOLUME_SUM "Suma de volumen incorrecta para varios TP: no se realizan transacciones" +#define TRANSLATION_MESSAGE_NOT_TAKING_A_TRADE "No realizar operación" +#define TRANSLATION_MESSAGE_NTAT_LINES "las líneas están ocultas y el panel está configurado para no operar cuando están ocultas" +#define TRANSLATION_MESSAGE_NTAT_SPREAD "spread actual" +#define TRANSLATION_MESSAGE_MAXIMUM_SPREAD "spread máximo" +#define TRANSLATION_MESSAGE_NTAT_ENTRY_SL_DISTANCE "distancia actual Entrada/SL" +#define TRANSLATION_MESSAGE_NTAT_TOTAL_NUMBER "nº total actual de operaciones" +#define TRANSLATION_MESSAGE_NUMBER_OF_TRADES_IN_EXECUTION "nº de operaciones en ejecución" +#define TRANSLATION_MESSAGE_MAXIMUM_TOTAL_NUMBER_OF_TRADES_ALLOWED "nº total máximo de operaciones permitidas" +#define TRANSLATION_MESSAGE_NTAT_PER_SYMBOL_NUMBER "nº actual de operaciones por símbolo" +#define TRANSLATION_MESSAGE_MAXIMUM_PER_SYMBOL_NUMBER_OF_TRADES_ALLOWED "nº máximo de operaciones por símbolo permitidas" +#define TRANSLATION_MESSAGE_TOTAL_POTENTIAL_RISK "riesgo potencial total" +#define TRANSLATION_MESSAGE_MAXIUMUM_TOTAL_RISK "riesgo total máximo permitido" +#define TRANSLATION_MESSAGE_INFINITE_TOTAL_POTENTIAL_RISK "riesgo potencial total infinito" +#define TRANSLATION_MESSAGE_PER_SYMBOL_POTENTIAL_RISK "riesgo potencial por símbolo" +#define TRANSLATION_MESSAGE_MAXIMUM_PER_SYMBOL_RISK "riesgo máximo permitido por símbolo" +#define TRANSLATION_MESSAGE_INFINITE_PER_SYMBOL_POTENTIAL_RISK "riesgo potencial infinito por símbolo" +#define TRANSLATION_MESSAGE_IGNORE_MARKET_EXECUTION_MODE_WARNING ", pero IgnoreMarketExecutionMode = true. Cambie a false si las operaciones no se ejecutan." +#define TRANSLATION_MESSAGE_EXECUTION_MODE "Modo de ejecución" +#define TRANSLATION_MESSAGE_FOUND_EXISTING_BUY_VOLUME "Volumen de compra existente encontrado" +#define TRANSLATION_MESSAGE_FOUND_EXISTING_SELL_VOLUME "Volumen de venta existente encontrado" +#define TRANSLATION_MESSAGE_ADJUSTED_POSITION_SIZE "Tamaño de posición ajustado" +#define TRANSLATION_MESSAGE_ADJUSTED_POSITION_SIZE_LESS_THAN_ZERO "El tamaño de la posición ajustada es menor que cero. No se está ejecutando ninguna operación" +#define TRANSLATION_MESSAGE_NTAT_TOTAL_VOLUME "volumen total actual" +#define TRANSLATION_MESSAGE_NTAT_NEW_POSITION_VOLUME "volumen de nueva posición" +#define TRANSLATION_MESSAGE_NTAT_MAXIMUM_TOTAL_VOLUME "volumen total máximo permitido" +#define TRANSLATION_MESSAGE_NTAT_PER_SYMBOL_VOLUME "volumen actual por símbolo" +#define TRANSLATION_MESSAGE_NTAT_MAXIMUM_PER_SYMBOL_VOLUME "volumen máximo permitido por símbolo" +#define TRANSLATION_MESSAGE_BROKER_MINIMUM "tamaño mínimo de la posición del bróker. No se ejecuta la operación" +#define TRANSLATION_MESSAGE_BROKER_MAXIMUM "tamaño máximo de la posición del bróker. Reduciéndolo" +#define TRANSLATION_MESSAGE_ERROR_SENDING_ORDER "Error al enviar la orden" +#define TRANSLATION_MESSAGE_ORDER_EXECUTED "Orden ejecutada" +#define TRANSLATION_MESSAGE_TICKET "Ticket" +#define TRANSLATION_MESSAGE_ORDER "Orden" +#define TRANSLATION_MESSAGE_EXECUTED "ejecutada" +#define TRANSLATION_MESSAGE_ERROR_OPENING_POSITION "Error al abrir una posición" +#define TRANSLATION_MESSAGE_POSITION_SIZER_ON "Tamaño de posición en " +#define TRANSLATION_MESSAGE_EXECUTE_TRADE "¿Ejecutar la operación?" +#define TRANSLATION_MESSAGE_BUY "Comprar" +#define TRANSLATION_MESSAGE_BUY_STOP "Buy Stop" +#define TRANSLATION_MESSAGE_BUY_LIMIT "Buy Limit" +#define TRANSLATION_MESSAGE_SELL "Vender" +#define TRANSLATION_MESSAGE_SELL_STOP "Sell Stop" +#define TRANSLATION_MESSAGE_SELL_LIMIT "Sell Limit" +#define TRANSLATION_MESSAGE_SIZE "Tamaño" +#define TRANSLATION_MESSAGE_MULTIPLE "múltiple" +#define TRANSLATION_MESSAGE_TRADE_CANCELED "Operación cancelada." +#define TRANSLATION_MESSAGE_TSL_APPLIED "Se ha aplicado un trailing stop a la posición" +#define TRANSLATION_MESSAGE_SL_WAS_MOVED_FROM "Se movió el stop-Loss de" +#define TRANSLATION_MESSAGE_SL_WAS_MOVED_TO "a" +#define TRANSLATION_MESSAGE_BE_APPLIED "Se ha aplicado un breakeven a la posición" +#define TRANSLATION_MESSAGE_BE_FOR "Breakeven para " +#define TRANSLATION_MESSAGE_ERROR_SETTING_TIMER "Error configurando temporizador" +#define TRANSLATION_MESSAGE_FAILED_DELETE_INI "Fallo al eliminar el archivo .ini del panel de PS" +#define TRANSLATION_MESSAGE_MINIMUM_EXPIRY "La duración mínima de expiración es de 2 minutos." +#define TRANSLATION_MESSAGE_DONOTAPPLLYSL_SET "No aplicar casilla stop-loss está marcada." +#define TRANSLATION_MESSAGE_DONOTAPPLLYTP_SET "No aplicar casilla take-profit' está marcada." +#define TRANSLATION_MESSAGE_FAILED_TO_CREATE_OUTSIDE_BUTTON "Error al crear un botón externo." \ No newline at end of file diff --git a/MQL4/Experts/Position Sizer/Translations/Ukrainian.mqh b/MQL4/Experts/Position Sizer/Translations/Ukrainian.mqh new file mode 100644 index 0000000..175bec0 --- /dev/null +++ b/MQL4/Experts/Position Sizer/Translations/Ukrainian.mqh @@ -0,0 +1,308 @@ +// Tabs +#define TRANSLATION_TAB_BUTTON_MAIN "Основн." +#define TRANSLATION_TAB_BUTTON_RISK "Ризик" +#define TRANSLATION_TAB_BUTTON_MARGIN "Маржа" +#define TRANSLATION_TAB_BUTTON_SWAPS "Свопи" +#define TRANSLATION_TAB_BUTTON_TRADING "Торг" + +// Entry +#define TRANSLATION_LABEL_ENTRY "Вхід" +#define TRANSLATION_BUTTON_LONG "Купівля" +#define TRANSLATION_BUTTON_SHORT "Продаж" + +#define TRANSLATION_TOOLTIP_BUTTON_LONG_SHORT "Перемикання між Купівлею та Продажом" + +#define TRANSLATION_TOOLTIP_ENTRY_INCREASE "Збільшити Вхід на 1 пункт" +#define TRANSLATION_TOOLTIP_ENTRY_DECREASE "Зменшити Вхід на 1 пункт" + +// Stop-loss +#define TRANSLATION_LABEL_STOPLOSS "Стоп-лос" +#define TRANSLATION_BUTTON_SL "СЛ, пункти" + +#define TRANSLATION_TOOLTIP_STOPLOSS_INCREASE "Збільшити Стоп-лос на 1 пункт" +#define TRANSLATION_TOOLTIP_STOPLOSS_DECREASE "Зменшити Стоп-лос на 1 пункт" + +// Take-profit +#define TRANSLATION_LABEL_TAKEPROFIT "Тейк-профіт" +#define TRANSLATION_BUTTON_TP "ТП, пункти" + +#define TRANSLATION_TOOLTIP_TAKEPROFIT_ADD "Додати рівень тейк-профіту" +#define TRANSLATION_TOOLTIP_BUTTON_TP "Встановити ТП на основі СЛ або увімкнути режим стеження за рівнем СЛ" + +#define TRANSLATION_TOOLTIP_TAKEPROFIT_INCREASE "Збільшити Тейк-профіт на 1 пункт" +#define TRANSLATION_TOOLTIP_TAKEPROFIT_DECREASE "Зменшити Тейк-профіт на 1 пункт" + +#define TRANSLATION_LABEL_TAKEPROFIT_MULTIPLE_DISTANCE "ТП" +#define TRANSLATION_LABEL_TAKEPROFIT_MULTIPLE_POINTS "пункти" + +#define TRANSLATION_TOOLTIP_TAKEPROFIT_REMOVE "Прибрати Тейк-профіт" + +#define TRANSLATION_TOOLTIP_TAKEPROFIT_INCREASE_MULTIPLE "Збільшити Тейк-профіт" +#define TRANSLATION_TOOLTIP_TAKEPROFIT_DECREASE_MULTIPLE "Зменшити Тейк-профіт" +#define TRANSLATION_TOOLTIP_TAKEPROFIT_BY_ONE_POINT "на 1 пункт" + +// ATR options +#define TRANSLATION_LABEL_ATR_PERIOD "Період ATR" +#define TRANSLATION_BUTTON_ATR_PERIOD_CURRENT "ПОТОЧНИЙ" +#define TRANSLATION_LABEL_ATR_SL_MULTIPLIER "Множник СЛ" +#define TRANSLATION_LABEL_ATR_TP_MULTIPLIER "Множник ТП" + +#define TRANSLATION_CHECKBOX_ATR_SA "ПС" +#define TRANSLATION_TOOLTIP_ATR_SA_SL "Застосовувати поправку по спреду до стоп-лосу" +#define TRANSLATION_TOOLTIP_ATR_SA_TP "Застосовувати поправку по спреду до тейк-профіту" + +#define TRANSLATION_LABEL_ATR_TIMEFRAME "Таймфрейм ATR" +#define TRANSLATION_LABEL_ATR_VALUE "ATR" + +// Order type +#define TRANSLATION_LABEL_ORDER_TYPE "Тип ордеру" +#define TRANSLATION_BUTTON_ORDER_TYPE_INSTANT "Ринковий" +#define TRANSLATION_BUTTON_ORDER_TYPE_PENDING "Відкладений" +#define TRANSLATION_TOOLTIP_ORDER_TYPE "Перемикання між Ринковим і Відкладеним" + +// Hide/show lines +#define TRANSLATION_BUTTON_HIDE_LINES "Схов. лінії" +#define TRANSLATION_BUTTON_SHOW_LINES "Показ. лінії" + +// Commission +#define TRANSLATION_LABEL_COMMISSION "Комісія (1-сторон.) за лот" +#define TRANSLATION_TOOLTIP_COMMISSION "У валюті рахунку або %, за 1 стандартний лот" +#define TRANSLATION_TOOLTIP_COMMISSION_TYPE "Клікніть, щоб змінити" + +// Account size +#define TRANSLATION_BUTTON_ACCOUNT_BALANCE "Баланс рахунку" +#define TRANSLATION_BUTTON_ACCOUNT_EQUITY "Кошти рахунку" +#define TRANSLATION_BUTTON_BALANCE_MINUS_CPR "Баланс - ПРП" +#define TRANSLATION_TOOLTIP_ACCOUNT_SIZE "Перемикайте між балансом, коштами та балансом мінус поточний ризик по портфоліо" +#define TRANSLATION_TOOLTIP_ACCOUNT_SIZE_ASTERISK_CUSTOM "Задано власне значення балансу" +#define TRANSLATION_TOOLTIP_ACCOUNT_SIZE_ASTERISK_ADD "додаткові кошти" +#define TRANSLATION_TOOLTIP_ACCOUNT_SIZE_ASTERISK_SUB "віднімані кошти" + +// Calculations +#define TRANSLATION_LABEL_INPUT "Вхідні дані" +#define TRANSLATION_LABEL_RESULT "Результат" +#define TRANSLATION_LABEL_RISK "Ризик" +#define TRANSLATION_LABEL_MONEY "гроші" +#define TRANSLATION_LABEL_REWARD "Прибуток" +#define TRANSLATION_LABEL_REWARD_RISK "Прибуток/ризик" +#define TRANSLATION_LABEL_POSITION_SIZE "Розмір позиції" +#define TRANSLATION_BUTTON_MAX_PS "Макс РП" +#define TRANSLATION_LABEL_POINT_VALUE "Ціна пункту" +#define TRANSLATION_TOOLTIP_INPUTS "Поля в этом столбце рассчитываются на основе введенных данных" +#define TRANSLATION_TOOLTIP_RESULT "Поля в этом столбце принимают во внимание ограничения брокера" + + +// Risk tab +#define TRANSLATION_CHECKBOX_COUNT_PENDING_ORDERS "Рахувати відкладені ордери" +#define TRANSLATION_CHECKBOX_IGNORE_ORDERS_WO_SL "Ігнорувати ордери без стоп-лосу" +#define TRANSLATION_CHECKBOX_IGNORE_ORDERS_WO_TP "Ігнорувати ордери без тейк-профіта" +#define TRANSLATION_LABEL_IGNORE_TRADES_IN "Ігнорувати" +#define TRANSLATION_BUTTON_SYMBOLS_NO "нічого" +#define TRANSLATION_BUTTON_SYMBOLS_OTHER "інш. символи" +#define TRANSLATION_BUTTON_SYMBOLS_CURRENT "пот. символ" +#define TRANSLATION_BUTTON_SYMBOLS_TOOLTIP "Перемикайте поміж «нічого», «іншими символами» та «поточним символом»." +#define TRANSLATION_LABEL_LOTS "Лоти" +#define TRANSLATION_LABEL_CURRENT_PORTFOLIO "Поточ. портфоліо" +#define TRANSLATION_TOOLTIP_CURRENT_PORTFOLIO "Угоди, що зараз є відкритими" +#define TRANSLATION_LABEL_POTENTIAL_PORTFOLIO "Потенц. портфол." +#define TRANSLATION_TOOLTIP_POTENTIAL_PORTFOLIO "Включно з позицією у розрахунку" +#define TRANSLATION_LABEL_CRRR_TOOLTIP "Співвідношення ризику та прибутку для поточного портфоліо" +#define TRANSLATION_LABEL_PRRR_TOOLTIP "Співвідношення ризику та прибутку для потенційного портфоліо" + + +// Margin tab +#define TRANSLATION_LABEL_POSITION_MARGIN "Маржа позиції" +#define TRANSLATION_LABEL_FUTURE_USED_MARGIN "Майб. викор. маржа" +#define TRANSLATION_LABEL_FUTURE_FREE_MARGIN "Майб. вільна маржа" +#define TRANSLATION_LABEL_CUSTOM_LEVERAGE "Власне плече " +#define TRANSLATION_LABEL_DEFAULT "За замовч." +#define TRANSLATION_LABEL_SYMBOL "Символ" +#define TRANSLATION_LABEL_MAX_PS_BY_MARGIN "Макс розмір позиції по маржі" +#define TRANSLATION_TOOLTIP_MAX_PS_BY_MARGIN "У лотах" + + +// Swaps tab +#define TRANSLATION_LABEL_TYPE "Тип" +#define TRANSLATION_LABEL_UNKNOWN "Невідомо" +#define TRANSLATION_LABEL_INTEREST "Процент" +#define TRANSLATION_LABEL_TRIPLE_SWAP "Своп × 3" +#define TRANSLATION_EDIT_WEEKDAY_SUNDAY "Неділя" +#define TRANSLATION_EDIT_WEEKDAY_MONDAY "Понеділок" +#define TRANSLATION_EDIT_WEEKDAY_TUESDAY "Вівторок" +#define TRANSLATION_EDIT_WEEKDAY_WEDNESDAY "Середа" +#define TRANSLATION_EDIT_WEEKDAY_THURSDAY "Четвер" +#define TRANSLATION_EDIT_WEEKDAY_FRIDAY "П'ятниця" +#define TRANSLATION_EDIT_WEEKDAY_SATURDAY "Субота" +#define TRANSLATION_LABEL_NOMINAL "Знач." +#define TRANSLATION_LABEL_DAILY "На день" +#define TRANSLATION_LABEL_YEARLY "На рік" +#define TRANSLATION_LABEL_PER_LOT "за лот" +#define TRANSLATION_LABEL_PER_PS "за РП" +#define TRANSLATION_LABEL_BASE_CURRENCY "Базова валюта" +#define TRANSLATION_LABEL_MARGIN_CURRENCY "Валюта маржі" + + +// Trading tab +#define TRANSLATION_BUTTON_TRADE "Відкр." +#define TRANSLATION_LABEL_TRAILING_STOP "Трейлінг" +#define TRANSLATION_LABEL_BREAKEVEN "Беззбиток" +#define TRANSLATION_LABEL_MAGIC_NUMBER "Меджик" +#define TRANSLATION_LABEL_ORDER_COMMENTARY "Коментар" +#define TRANSLATION_LABEL_ORDER_AUTOSUFFIX "Автосуф." +#define TRANSLATION_TOOLTIP_ORDER_AUTOSUFFIX "Додавати число, що автоматично інкрементується, до коментаря кожної наступної угоди?" +#define TRANSLATION_LABEL_MAX_NUMBER_OF_TRADES "Макс № угод" +#define TRANSLATION_LABEL_TOTAL "Усього" +#define TRANSLATION_LABEL_PER_SYMBOL "По символу" +#define TRANSLATION_LABEL_MAX_VOLUME "Макс об'єм" +#define TRANSLATION_LABEL_MAX_RISK "Макс ризик" +#define TRANSLATION_CHECKBOX_DISABLE_TRADING_LINES_HIDDEN "Не дозволяти торгівлю, коли лінії сховано" +#define TRANSLATION_TOOLTIP_FILL_INWARD "Заповнити додаткові ТП рівномірно між Входом й основним ТП." +#define TRANSLATION_TOOLTIP_FILL_OUTWARD "Розмістити додаткові ТП за основним ТП, використовуючи ту саму відстань." +#define TRANSLATION_LABEL_SHARE "Частка" +#define TRANSLATION_TOOLTIP_SHARE "Автоматично заповнити частки об'єму" +#define TRANSLATION_LABEL_POINTS "Пункти" +#define TRANSLATION_LABEL_MAX_SLIPPAGE "Макс прослизання" +#define TRANSLATION_LABEL_MAX_SPREAD "Макс спред" +#define TRANSLATION_LABEL_MAX_ENTRY_SL_DISTANCE "Макс відстань Вхід/СЛ" +#define TRANSLATION_LABEL_MIN_ENTRY_SL_DISTANCE "Мін відстань Вхід/СЛ" +#define TRANSLATION_LABEL_MAX_RISK_PERCENTAGE "Макс ризик %" +#define TRANSLATION_CHECKBOX_SUBTRACT_OPEN_POSITIONS_VOLUME "Відн. об. відкр. позицій" +#define TRANSLATION_CHECKBOX_SUBTRACT_PENDING_ORDERS_VOLUME "Відн. об. відкл. ордерів" +#define TRANSLATION_CHECKBOX_DO_NOT_APPLY_STOPLOSS "Не застосовувати СЛ" +#define TRANSLATION_CHECKBOX_DO_NOT_APPLY_TAKEPROFIT "Не застосовувати ТП" +#define TRANSLATION_TOOLTIP_SUBTRACT_OPEN_POSITIONS_VOLUME "Експерт відніме поточний об'єм по відкритим угодам від розрахованого розміру позиції перед тим, як відкрити її." +#define TRANSLATION_TOOLTIP_SUBTRACT_PENDING_ORDERS_VOLUME "Експерт відніме поточний об'єм по відкладеним ордерам від розрахованого розміру позиції перед тим, як відкрити її." +#define TRANSLATION_TOOLTIP_DO_NOT_APPLY_STOPLOSS "Експерт відкриє угоду без стоп-лосу." +#define TRANSLATION_TOOLTIP_DO_NOT_APPLY_TAKEPROFIT "Експерт відкриє угоду без тейк-профіту." +#define TRANSLATION_CHECKBOX_ASK_FOR_CONFIRMATION "Запитувати підтвердження" +#define TRANSLATION_TOOLTIP_ASK_FOR_CONFIRMATION "Експерт буде запитувати підтвердження перед відкриттям угоди." +#define TRANSLATION_LABEL_EXPIRY "Термін" +#define TRANSLATION_TOOLTIP_EXPIRY "Термін дії у хвилинах для наступного створеного відкладеного ордеру. Мінімум = 10." +#define TRANSLATION_LABEL_MINUTES "хв." +#define TRANSLATION_TOOLTIP_MINUTES "Хвилини" + + +// Chart objects +#define TRANSLATION_TOOLTIP_SL_LABEL "Відстань до СЛ, пункти" +#define TRANSLATION_TOOLTIP_TP_LABEL "Відстань до ТП, пункти" +#define TRANSLATION_TOOLTIP_ENTRY_LABEL "Відстань до Входу, пункти" +#define TRANSLATION_TOOLTIP_ENTRY_LABEL_ADDITIONAL "Розмір позиції, лоти" +#define TRANSLATION_TOOLTIP_OUTSIDE_TRADE_BUTTON "Клікніть, щоб створити ордер/позицію." +#define TRANSLATION_CLOSE_BUTTON "Закрити" + + +// Warnings +#define TRANSLATION_LABEL_WARNING_TOO_CLOSE "(Близько!)" +#define TRANSLATION_LABEL_WARNING_WRONG_VALUE "(Значення!)" +#define TRANSLATION_LABEL_WARNING_INVALID_TP "Невірний ТП" +#define TRANSLATION_TOOLTIP_WARNING_PS "Більше, ніж максимальний розмір позиції по маржі!" + + +// Messages +#define TRANSLATION_MESSAGE_SL_SHOULD_BE_POSITIVE "Стоп-лос повинен бути позитивним." +#define TRANSLATION_MESSAGE_TRYING_TO_SAVE_FILE "Спроба збереження налаштувань до файлу" +#define TRANSLATION_MESSAGE_FAILED_TO_OPEN_FOR_WRITING "Не вдалося відкрити файл для запису" +#define TRANSLATION_MESSAGE_ERROR "Помилка" +#define TRANSLATION_MESSAGE_SAVED_SETTINGS "Налаштування збережені успішно." +#define TRANSLATION_MESSAGE_TRYING_TO_LOAD_FILE "Спроба завантаження налаштувань з файлу." +#define TRANSLATION_MESSAGE_NO_SETTINGS_FILE_TO_LOAD "Немає файлу для завантаження." +#define TRANSLATION_MESSAGE_FAILED_TO_OPEN_FOR_READING "Не вдалося відкрити файл для читання" +#define TRANSLATION_MESSAGE_LOADED_SETTINGS "Налаштування завантажені успішно." +#define TRANSLATION_MESSAGE_NO_SETTINGS_FILE_TO_DELETE "Немає файлу для видалення." +#define TRANSLATION_MESSAGE_TRYING_TO_DELETE_FILE "Спроба видалення файлу з налаштуваннями." +#define TRANSLATION_MESSAGE_FAILED_TO_DELETE_FILE "Не вдалося видалити файл" +#define TRANSLATION_MESSAGE_DELETED_SETTINGS "Файл з налаштуваннями видалено успішно." +#define TRANSLATION_MESSAGE_DELETED_DUPLICATE_PANEL "Видалено об'єкти панелі-дублікату з префіксом" +#define TRANSLATION_MESSAGE_ENTRY_SL_DIFFERENT_NON_ZERO "Вхід і стоп-лос повинні відрізнятися та бути ненульовими." +#define TRANSLATION_MESSAGE_ENTRY_SL_DIFFERENT "Стоп-лос повинен відрізнятися від Входу." +#define TRANSLATION_MESSAGE_CANNOT_RETRIEVE_TICKSIZE "Неможливо отримати розмір тіку для " +#define TRANSLATION_MESSAGE_LOOKS_LIKE "Схоже, що інструмент більш не доступний. Розрахунок може бути неточним." +#define TRANSLATION_MESSAGE_MISCONFIGURED_SYMBOL "Символ налаштований невірно на торговому сервері - нульова ціна одиниці." +#define TRANSLATION_MESSAGE_ALGO_TRADING_DISABLED_1 "Автоматична торгівля відключена в налаштуваннях платформи! Будь ласка, увікмніть його в меню Сервіс->Установки->Експерти." +#define TRANSLATION_MESSAGE_ALGO_TRADING_DISABLED_2 "Торгівля відключена в налаштунках експерту! Будь ласка, дозвольте її на вкладці Загальні." +#define TRANSLATION_MESSAGE_STOPLOSS_PROBLEM "Проблемний стоп-лос" +#define TRANSLATION_MESSAGE_WRONG_POSITION_SIZE_VALUE "Невірне значення розміру позиції!" +#define TRANSLATION_MESSAGE_MULTIPLE_TP_VOLUME_SHARE_SUM "Сума часток об'єму декількох ТП" +#define TRANSLATION_MESSAGE_INCORRECT_VOLUME_SUM "Невірна сума об'ємів декількох ТП - угода не буде відкрита." +#define TRANSLATION_MESSAGE_NOT_TAKING_A_TRADE "Угода не буде відкрита" +#define TRANSLATION_MESSAGE_NTAT_LINES "лінії сховано й панель налаштована так, щоб не торгувати при схованих лініях." +#define TRANSLATION_MESSAGE_NTAT_SPREAD "поточний спред" +#define TRANSLATION_MESSAGE_MAXIMUM_SPREAD "максимальний спред" +#define TRANSLATION_MESSAGE_NTAT_ENTRY_SL_DISTANCE "поточна відстань Вхід/СЛ" +#define TRANSLATION_MESSAGE_NTAT_CURRENT_RISK "поточний результат по ризику" +#define TRANSLATION_MESSAGE_NTAT_MAX_RISK "максимальний ризик" +#define TRANSLATION_MESSAGE_NTAT_TOTAL_NUMBER "поточна загальна кількість угод" +#define TRANSLATION_MESSAGE_NUMBER_OF_TRADES_IN_EXECUTION "кількість угод на виконанні" +#define TRANSLATION_MESSAGE_MAXIMUM_TOTAL_NUMBER_OF_TRADES_ALLOWED "максимально припустима загальна кількість угод" +#define TRANSLATION_MESSAGE_NTAT_PER_SYMBOL_NUMBER "поточна кількість угод по символу" +#define TRANSLATION_MESSAGE_MAXIMUM_PER_SYMBOL_NUMBER_OF_TRADES_ALLOWED "максимально припустима кількість угод по символу" +#define TRANSLATION_MESSAGE_TOTAL_POTENTIAL_RISK "загальний потенційний ризик" +#define TRANSLATION_MESSAGE_MAXIUMUM_TOTAL_RISK "максимально припустимий загальний ризик" +#define TRANSLATION_MESSAGE_INFINITE_TOTAL_POTENTIAL_RISK "нескінченний загальний потенційний ризик" +#define TRANSLATION_MESSAGE_PER_SYMBOL_POTENTIAL_RISK "потенційний ризик по символу" +#define TRANSLATION_MESSAGE_MAXIMUM_PER_SYMBOL_RISK "максимально припустимий ризик по символу" +#define TRANSLATION_MESSAGE_INFINITE_PER_SYMBOL_POTENTIAL_RISK "нескінченний потенційний ризик по символу" +#define TRANSLATION_MESSAGE_IGNORE_MARKET_EXECUTION_MODE_WARNING ", але IgnoreMarketExecutionMode = true. Перемикніть на false, якщо угоди не виконуються." +#define TRANSLATION_MESSAGE_EXECUTION_MODE "Режим виконання" +#define TRANSLATION_MESSAGE_FOUND_EXISTING_BUY_VOLUME "Знайдений поточний об'єм на купівлю" +#define TRANSLATION_MESSAGE_FOUND_EXISTING_SELL_VOLUME "Знайдений поточний об'єм на продаж" +#define TRANSLATION_MESSAGE_ADJUSTED_POSITION_SIZE "Виправлений розмір позиції" +#define TRANSLATION_MESSAGE_ADJUSTED_POSITION_SIZE_LESS_THAN_ZERO "Виправлений розмір позиції менше або дорівнює нулю. Угода не буде виконана." +#define TRANSLATION_MESSAGE_NTAT_TOTAL_VOLUME "поточний загальний об'єм" +#define TRANSLATION_MESSAGE_NTAT_NEW_POSITION_VOLUME "об'єм нової позиції" +#define TRANSLATION_MESSAGE_NTAT_MAXIMUM_TOTAL_VOLUME "максимально припустимий загальний об'єм" +#define TRANSLATION_MESSAGE_NTAT_PER_SYMBOL_VOLUME "поточний об'єм по символу" +#define TRANSLATION_MESSAGE_NTAT_MAXIMUM_PER_SYMBOL_VOLUME "максимально припустимий об'єм по символу" +#define TRANSLATION_MESSAGE_BROKER_MINIMUM "мінімальний розмір позиції в брокера. Угода не буде виконана." +#define TRANSLATION_MESSAGE_BROKER_MAXIMUM "максимальний розмір позиції в брокера. Позиція буде зменшена." +#define TRANSLATION_MESSAGE_ERROR_SENDING_ORDER "Помилка відправки ордеру" +#define TRANSLATION_MESSAGE_ORDER_EXECUTED "Ордер виконано." +#define TRANSLATION_MESSAGE_TICKET "Тікет" +#define TRANSLATION_MESSAGE_ORDER "Ордер" +#define TRANSLATION_MESSAGE_EXECUTED "виконано" +#define TRANSLATION_MESSAGE_ERROR_OPENING_POSITION "Помилка відкриття позиції" +#define TRANSLATION_MESSAGE_POSITION_SIZER_ON "Position Sizer на " +#define TRANSLATION_MESSAGE_EXECUTE_TRADE "Виконати угоду?" +#define TRANSLATION_MESSAGE_BUY "Купівля" +#define TRANSLATION_MESSAGE_BUY_STOP "Стоп на купівлю" +#define TRANSLATION_MESSAGE_BUY_LIMIT "Ліміт на купівлю" +#define TRANSLATION_MESSAGE_SELL "Продаж" +#define TRANSLATION_MESSAGE_SELL_STOP "Стоп на продаж" +#define TRANSLATION_MESSAGE_SELL_LIMIT "Ліміт на продаж" +#define TRANSLATION_MESSAGE_SIZE "Розмір" +#define TRANSLATION_MESSAGE_MULTIPLE "кілька" +#define TRANSLATION_MESSAGE_TRADE_CANCELED "Угоду відмінено." +#define TRANSLATION_MESSAGE_TSL_APPLIED "Трейлінг-стоп застосовано до позиції" +#define TRANSLATION_MESSAGE_SL_WAS_MOVED_FROM "Стоп-лос зсунуто з" +#define TRANSLATION_MESSAGE_SL_WAS_MOVED_TO "на" +#define TRANSLATION_MESSAGE_BE_APPLIED "Беззбиток застосовано до позиції" +#define TRANSLATION_MESSAGE_BE_FOR "Беззбиток для " +#define TRANSLATION_MESSAGE_ERROR_SETTING_TIMER "Помилка встановлення таймеру" +#define TRANSLATION_MESSAGE_FAILED_DELETE_INI "Не вдалося видалити ini-файл панелі" +#define TRANSLATION_MESSAGE_MINIMUM_EXPIRY "Мінімальний термін дії відкладеного ордеру - 2 хвилини." +#define TRANSLATION_MESSAGE_DONOTAPPLLYSL_SET "Відмічено чекбокс 'Не застосовувати СЛ'." +#define TRANSLATION_MESSAGE_DONOTAPPLLYTP_SET "Відмічено чекбокс 'Не застосовувати ТП'." +#define TRANSLATION_MESSAGE_FAILED_TO_CREATE_OUTSIDE_BUTTON "Помилка при створенні зовнішньої кнопки." +#define TRANSLATION_MESSAGE_TAKING_SMALLER_TRADE "Відкриття угоди меншого розміру" +#define TRANSLATION_MESSAGE_NEW_POSITION_SIZE "Новий розмір позиції" +#define TRANSLATION_MESSAGE_CANNOT_TAKE_SMALLER_TRADE "Меншу угоду неможливо відкрити." +#define TRANSLATION_MESSAGE_ARE_YOU_SURE "Ви впевнені, що хочете закрити Position Sizer?" +#define TRANSLATION_MESSAGE_EXIT "Вийти?" +#define TRANSLATION_MESSAGE_COULDNT_DETECT "Не вдалося знайти вірну валютну пару для розрахунку поправки." +#define TRANSLATION_MESSAGE_ACCOUNT_CURRENCY "Валюта рахунку" +#define TRANSLATION_MESSAGE_TRYING_TO_FIND "Спроба знайти можливу комбінації з двох символів." +#define TRANSLATION_MESSAGE_CONVERTING_VIA "Конвертація через" +#define TRANSLATION_MESSAGE_ADJUSTMENT_CALCULATION_CRITICAL_FAILURE "Критична помилка розрахунку поправки. Не вдалося розрахувати ні за допомогою простого ні за допомогою двухпарного методів." +#define TRANSLATION_MESSAGE_COULDNT_DETECT_PROPER_CURRENCY_PAIR "Помилка. Не вдалося виявити підхожу валютну пару для розрахунку поправку методом двох пар." +#define TRANSLATION_MESSAGE_CROSS_CURRENCY "Перехресна валюта" +#define TRANSLATION_MESSAGE_CHARTS_PAIR_CURRENCY "Валюта з пари графіку" +#define TRANSLATION_MESSAGE_INFINITY "Нескінченність" +#define TRANSLATION_MESSAGE_EXECUTION_FAILED "Невдача виконання." +#define TRANSLATION_MESSAGE_FAILED_TO_FIND_ORDER "Не вдалося знайти ордер для застосування стоп-лоссу/тейк-профіту." +#define TRANSLATION_MESSAGE_ERROR_MODIFYING_ORDER "Помилка зміни ордеру" +#define TRANSLATION_MESSAGE_ORDERSELECT_FAILED "Виклик OrderSelect не вдався" +#define TRANSLATION_MESSAGE_FAILED_TO_SET_TRAILING_STOP_FOR_BUY "Не вдалося встановити трейлінг-стоп на ордер на Купівлю" +#define TRANSLATION_MESSAGE_FAILED_TO_SET_TRAILING_STOP_FOR_SELL "Не вдалося встановити трейлінг-стоп на ордер на Продаж" +#define TRANSLATION_MESSAGE_ORDERDELETE_FAILED "Функція OrderDelete повернула помилку" +#define TRANSLATION_MESSAGE_ORDERCLOSE_FAILED "Функція OrderClose повернула помилку" +#define TRANSLATION_MESSAGE_OBJECT_NOT_FOUND "Об'єкт не знайдено" \ No newline at end of file diff --git a/MQL5/Experts/Position Sizer/Defines.mqh b/MQL5/Experts/Position Sizer/Defines.mqh index d25651c..11e5333 100644 --- a/MQL5/Experts/Position Sizer/Defines.mqh +++ b/MQL5/Experts/Position Sizer/Defines.mqh @@ -8,6 +8,7 @@ #include #include #include +#include color CONTROLS_EDIT_COLOR_ENABLE = C'255,255,255'; color CONTROLS_EDIT_COLOR_DISABLE = C'221,221,211'; @@ -118,6 +119,13 @@ enum ADDITIONAL_TRADE_BUTTONS ADDITIONAL_TRADE_BUTTONS_BOTH // Both }; +enum IGNORE_SYMBOLS +{ + IGNORE_SYMBOLS_NONE, // No symbols + IGNORE_SYMBOLS_OTHER, // Other symbols + IGNORE_SYMBOLS_CURRENT, // Current symbol +}; + struct Settings { ENTRY_TYPE EntryType; @@ -139,7 +147,7 @@ struct Settings bool CountPendingOrders; bool IgnoreOrdersWithoutSL; bool IgnoreOrdersWithoutTP; - bool IgnoreOtherSymbols; + IGNORE_SYMBOLS IgnoreSymbols; bool HideAccSize; bool ShowLines; TABS SelectedTab; @@ -153,6 +161,7 @@ struct Settings int MaxSpread; int MaxEntrySLDistance; int MinEntrySLDistance; + double MaxRiskPercentage; // For SL/TP distance modes: bool SLDistanceInPoints; bool TPDistanceInPoints; diff --git a/MQL5/Experts/Position Sizer/Position Sizer Trading.mqh b/MQL5/Experts/Position Sizer/Position Sizer Trading.mqh index 48d3a96..bf8ea29 100644 Binary files a/MQL5/Experts/Position Sizer/Position Sizer Trading.mqh and b/MQL5/Experts/Position Sizer/Position Sizer Trading.mqh differ diff --git a/MQL5/Experts/Position Sizer/Position Sizer.mq5 b/MQL5/Experts/Position Sizer/Position Sizer.mq5 index 3765f82..e21185a 100644 --- a/MQL5/Experts/Position Sizer/Position Sizer.mq5 +++ b/MQL5/Experts/Position Sizer/Position Sizer.mq5 @@ -6,12 +6,13 @@ #property copyright "EarnForex.com" #property link "https://www.earnforex.com/metatrader-expert-advisors/Position-Sizer/" #property icon "EF-Icon-64x64px.ico" -#property version "3.09" -string Version = "3.09"; +#property version "3.10" +string Version = "3.10"; #include "Translations\English.mqh" //#include "Translations\Arabic.mqh" //#include "Translations\Chinese.mqh" +//#include "Translations\ChineseTraditional.mqh" // Contributed by fxchess. //#include "Translations\Portuguese.mqh" // Contributed by Matheus Sevaroli. //#include "Translations\Russian.mqh" //#include "Translations\Spanish.mqh" @@ -87,7 +88,7 @@ input ENUM_TIMEFRAMES DefaultATRTimeframe = PERIOD_CURRENT; // ATRTimeframe: Def input bool DefaultSpreadAdjustmentSL = false; // SpreadAdjustmentSL: Adjust SL by Spread value in ATR mode. input bool DefaultSpreadAdjustmentTP = false; // SpreadAdjustmentTP: Adjust TP by Spread value in ATR mode. input double DefaultCommission = 0; // Commission: Default one-way commission per 1 lot. -input COMMISSION_TYPE DefaultCommissionType = COMMISSION_CURRENCY; // CommossionType: Default commission type. +input COMMISSION_TYPE DefaultCommissionType = COMMISSION_CURRENCY; // CommissionType: Default commission type. input ACCOUNT_BUTTON DefaultAccountButton = Balance; // AccountButton: Balance/Equity/Balance-CPR input double DefaultRisk = 1; // Risk: Initial risk tolerance in percentage points input double DefaultMoneyRisk = 0; // MoneyRisk: If > 0, money risk tolerance in currency. @@ -95,16 +96,17 @@ input double DefaultPositionSize = 0; // PositionSize: If > 0, position size in input bool DefaultCountPendingOrders = false; // CountPendingOrders: Count pending orders for portfolio risk. input bool DefaultIgnoreOrdersWithoutSL = false; // IgnoreOrdersWithoutSL: Ignore orders w/o SL in portfolio risk. input bool DefaultIgnoreOrdersWithoutTP = false; // IgnoreOrdersWithoutTP: Ignore orders w/o TP in portfolio risk. -input bool DefaultIgnoreOtherSymbols = false; // IgnoreOtherSymbols: Ignore other symbols' orders in portfolio risk. +input IGNORE_SYMBOLS DefaultIgnoreSymbols = IGNORE_SYMBOLS_NONE; // IgnoreSymbols: Ignore trades in some symbols for portfolio risk? input double DefaultCustomLeverage = 0; // CustomLeverage: Default custom leverage for Margin tab. input int DefaultMagicNumber = 2022052714; // MagicNumber: Default magic number for Trading tab. input string DefaultCommentary = ""; // Commentary: Default order comment for Trading tab. -input bool DefaultCommentAutoSuffix = false; // AutoSuffix: Automatic suffix for order commentary in Trading tab. +input bool DefaultCommentAutoSuffix = false; // AutoSuffix: Automatic suffix for order comment in Trading tab. input bool DefaultDisableTradingWhenLinesAreHidden = false; // DisableTradingWhenLinesAreHidden: for Trading tab. input int DefaultMaxSlippage = 0; // MaxSlippage: Maximum slippage for Trading tab. input int DefaultMaxSpread = 0; // MaxSpread: Maximum spread for Trading tab. input int DefaultMaxEntrySLDistance = 0; // MaxEntrySLDistance: Maximum entry/SL distance for Trading tab. input int DefaultMinEntrySLDistance = 0; // MinEntrySLDistance: Minimum entry/SL distance for Trading tab. +input double DefaultMaxRiskPercentage = 0; // MaxRiskPercentage: Maximum risk % for Trading tab. input double DefaultMaxPositionSizeTotal = 0; // Maximum position size total for Trading tab. input double DefaultMaxPositionSizePerSymbol = 0; // Maximum position size per symbol for Trading tab. input bool DefaultSubtractOPV = false; // SubtractOPV: Subtract open positions volume (Trading tab). @@ -155,11 +157,13 @@ input bool DisableStopLimit = false; // DisableStopLimit: If true, Stop Limit wi input string TradeSymbol = ""; // TradeSymbol: If non-empty, this symbol will be traded. input bool DisableTradingSounds = false; // DisableTradingSounds: If true, no sound for trading actions. input bool IgnoreMarketExecutionMode = true; // IgnoreMarketExecutionMode: If true, ignore Market execution. -input bool MarketModeApplySLTPAfterAllTradesExecuted = false; // Market Mode - Apply SL/TP After All Trades Executed +input bool MarketModeApplySLTPAfterAllTradesExecuted = false; // Market Mode: Apply SL/TP after all trades executed. input bool DarkMode = false; // DarkMode: Enable dark mode for a less bright panel. -input string SettingsFile = ""; // SettingsFile: Load custom panel settings from \Files\ folder. +input string SettingsFile = ""; // SettingsFile: Custom settings file from \Files\PS_Settings\ input bool PrefillAdditionalTPsBasedOnMain = true; // Prefill additional TPs based on Main? input bool AskBeforeClosing = false; // Ask for confirmation before closing the panel? +input bool CapMaxPositionSizeBasedOnMargin = false; // Cap position size based on avaiable margin? +input bool LessRestrictiveMaxLimits = false; // Allow smaller trades when trading limits are exceeded? CPositionSizeCalculator* ExtDialog; @@ -283,7 +287,7 @@ int OnInit() sets.CountPendingOrders = DefaultCountPendingOrders; // If true, portfolio risk calculation will also involve pending orders. sets.IgnoreOrdersWithoutSL = DefaultIgnoreOrdersWithoutSL; // If true, portfolio risk calculation will skip orders without stop-loss. sets.IgnoreOrdersWithoutTP = DefaultIgnoreOrdersWithoutTP; // If true, portfolio risk calculation will skip orders without take-profit. - sets.IgnoreOtherSymbols = DefaultIgnoreOtherSymbols; // If true, portfolio risk calculation will skip orders in other symbols. + sets.IgnoreSymbols = DefaultIgnoreSymbols; // Skip trades in other/current/no symbols for portfolio risk calculation. sets.HideAccSize = HideAccSize; // If true, account size line will not be shown. sets.ShowLines = DefaultShowLines; sets.SelectedTab = MainTab; @@ -304,6 +308,7 @@ int OnInit() sets.MaxSpread = DefaultMaxSpread; sets.MaxEntrySLDistance = DefaultMaxEntrySLDistance; sets.MinEntrySLDistance = DefaultMinEntrySLDistance; + sets.MaxRiskPercentage = DefaultMaxRiskPercentage; sets.MaxPositionSizeTotal = DefaultMaxPositionSizeTotal; sets.MaxPositionSizePerSymbol = DefaultMaxPositionSizePerSymbol; if ((sets.MaxPositionSizeTotal < sets.MaxPositionSizePerSymbol) && (sets.MaxPositionSizeTotal != 0)) sets.MaxPositionSizeTotal = sets.MaxPositionSizePerSymbol; @@ -480,7 +485,7 @@ int OnInit() } if (!EventSetTimer(1)) Print(TRANSLATION_MESSAGE_ERROR_SETTING_TIMER + ": ", GetLastError()); - + if (ShowATROptions) ExtDialog.InitATR(); if (TradeSymbol != "") SymbolForTrading = TradeSymbol; @@ -646,11 +651,53 @@ void OnChartEvent(const int id, } } - // This cannot be done using the panel's event handler because the outside trade button isn't added to its list of controls. - if ((id == CHARTEVENT_OBJECT_CLICK) && (sparam == ExtDialog.Name() + "m_OutsideTradeButton")) + // Clicks on objects that cannot be processed via the class Event Map. + if (id == CHARTEVENT_OBJECT_CLICK) { - ExtDialog.m_OutsideTradeButton.Pressed(false); - Trade(); + // This cannot be done using the panel's event handler because the outside trade button isn't added to its list of controls. + if (sparam == ExtDialog.Name() + "m_OutsideTradeButton") + { + ExtDialog.m_OutsideTradeButton.Pressed(false); + Trade(); + } + // Setting flags to mark Edit controls as being edited to avoid changing their values during that process: + else if (sparam == ExtDialog.Name() + "m_EdtPosSize") + { + ExtDialog.OnClickEdtPosSize(); + } + else if (sparam == ExtDialog.Name() + "m_EdtEntryLevel") + { + ExtDialog.OnClickEdtEntryLevel(); + } + else if (sparam == ExtDialog.Name() + "m_EdtSL") + { + ExtDialog.OnClickEdtSL(); + } + else if (sparam == ExtDialog.Name() + "m_EdtTP") + { + ExtDialog.OnClickEdtTP(); + } + else if (sparam == ExtDialog.Name() + "m_EdtAccount") + { + ExtDialog.OnClickEdtAccount(); + } + else if (sparam == ExtDialog.Name() + "m_EdtRiskPIn") + { + ExtDialog.OnClickEdtRiskPIn(); + } + else if (sparam == ExtDialog.Name() + "m_EdtRiskMIn") + { + ExtDialog.OnClickEdtRiskMIn(); + } + else if (StringSubstr(sparam, 0, StringLen(ExtDialog.Name() + "m_EdtAdditionalTPEdits")) == ExtDialog.Name() + "m_EdtAdditionalTPEdits") + { + int i = (int)StringToInteger(StringSubstr(sparam, StringLen(ExtDialog.Name() + "m_EdtAdditionalTPEdits"))) - 1; + ExtDialog.OnClickAdditionalTPEdit(i); + } + else if (sparam == ExtDialog.Name() + "m_EdtTradingTPEdit1") // Needed only for the main TP as others aren't updated unless their lines are being moved, which means that the Edits aren't in focus at that time. + { + ExtDialog.OnClickEdtTradingTPEdit1(); + } } if (id == CHARTEVENT_CLICK) // Avoid "sticking" of xxxLineIsBeingMoved variables. @@ -856,7 +903,7 @@ void OnChartEvent(const int id, else { sets.TPDistanceInPoints = true; // If was in level, set to points. - sets.TakeProfit = (int)MathRound(MathAbs(sets.TakeProfitLevel - sets.EntryLevel) / _Point); + if (sets.TakeProfitLevel != 0) sets.TakeProfit = (int)MathRound(MathAbs(sets.TakeProfitLevel - sets.EntryLevel) / _Point); // Additional take-profits. if (sets.TakeProfitsNumber > 1) { @@ -864,7 +911,7 @@ void OnChartEvent(const int id, { if (sets.TP[i] != 0) // With zero points TP, keep the TP lines at zero level - as with the main TP level. { - ExtDialog.AdditionalTPEdits[i - 1].Text(DoubleToString(MathAbs(MathRound((sets.TP[i] - sets.EntryLevel) / _Point)), 0)); + if (sets.TP[i] != 0) ExtDialog.AdditionalTPEdits[i - 1].Text(DoubleToString(MathAbs(MathRound((sets.TP[i] - sets.EntryLevel) / _Point)), 0)); } } } diff --git a/MQL5/Experts/Position Sizer/Position Sizer.mqh b/MQL5/Experts/Position Sizer/Position Sizer.mqh index b259797..2780d6b 100644 --- a/MQL5/Experts/Position Sizer/Position Sizer.mqh +++ b/MQL5/Experts/Position Sizer/Position Sizer.mqh @@ -4,14 +4,15 @@ //| https://www.earnforex.com/ | //+------------------------------------------------------------------+ #include "Defines.mqh" +#include class CPositionSizeCalculator : public CAppDialog { private: - CButton m_BtnTabMain, m_BtnTabRisk, m_BtnTabMargin, m_BtnTabSwaps, m_BtnTabTrading, m_BtnOrderType, m_BtnAccount, m_BtnLines, m_BtnStopLoss, m_BtnTakeProfit, m_BtnEntry, m_BtnATRTimeframe, m_BtnCommissionType, m_BtnMaxPS, m_BtnTrade, m_BtnTPsInward, m_BtnTPsOutward, m_BtnTradingTPShare, m_BtnQuickRisk1, m_BtnQuickRisk2, m_BtnEntryIncrease, m_BtnEntryDecrease, m_BtnStopLossIncrease, m_BtnStopLossDecrease, m_BtnTakeProfitIncrease, m_BtnTakeProfitDecrease, m_BtnStopPriceIncrease, m_BtnStopPriceDecrease, m_BtnTakeProfitsNumberAdd, m_BtnTakeProfitsNumberRemove, m_BtnMainTrade; - CCheckBox m_ChkSpreadAdjustmentSL, m_ChkSpreadAdjustmentTP, m_ChkCountPendings, m_ChkIgnoreOrdersWithoutSL, m_ChkIgnoreOrdersWithoutTP, m_ChkIgnoreOtherSymbols, m_ChkDisableTradingWhenLinesAreHidden, m_ChkSubtractPositions, m_ChkSubtractPendingOrders, m_ChkDoNotApplyStopLoss, m_ChkDoNotApplyTakeProfit, m_ChkAskForConfirmation, m_ChkCommentAutoSuffix; - CEdit m_EdtEntryLevel, m_EdtSL, m_EdtTP, m_EdtStopPrice, m_EdtAccount, m_EdtCommissionSize, m_EdtRiskPIn, m_EdtRiskPRes, m_EdtRiskMIn, m_EdtRiskMRes, m_EdtReward1, m_EdtReward2, m_EdtRR1, m_EdtRR2, m_EdtPosSize, m_EdtPointValue, m_EdtATRPeriod, m_EdtATRMultiplierSL, m_EdtATRMultiplierTP, m_EdtCurRiskM, m_EdtCurRiskP, m_EdtPotRiskM, m_EdtPotRiskP, m_EdtCurProfitM, m_EdtCurProfitP, m_EdtPotProfitM, m_EdtPotProfitP, m_EdtCurL, m_EdtPotL, m_EdtCurrentRRR, m_EdtPotentialRRR, m_EdtPosMargin, m_EdtUsedMargin, m_EdtFreeMargin, m_EdtCustomLeverage, m_EdtMaxPositionSizeByMargin, m_EdtSwapsType, m_EdtSwapsTripleDay, m_EdtSwapsNominalLong, m_EdtSwapsNominalShort, m_EdtSwapsDailyLongLot, m_EdtSwapsDailyShortLot, m_EdtSwapsDailyLongPS, m_EdtSwapsDailyShortPS, m_EdtSwapsYearlyLongLot, m_EdtSwapsYearlyShortLot, m_EdtSwapsYearlyLongPS, m_EdtSwapsYearlyShortPS, m_EdtMagicNumber, m_EdtExpiry, m_EdtCommentary, m_EdtMaxSlippage, m_EdtMaxSpread, m_EdtMaxEntrySLDistance, m_EdtMinEntrySLDistance, m_EdtMaxPositionSize, m_EdtTrailingStopPoints, m_EdtBreakEvenPoints, m_EdtMaxNumberOfTradesTotal, m_EdtMaxNumberOfTradesPerSymbol, m_EdtMaxPositionSizeTotal, m_EdtMaxPositionSizePerSymbol, m_EdtMaxRiskTotal, m_EdtMaxRiskPerSymbol; - CLabel m_LblEntryLevel, m_LblEntryWarning, m_LblSL, m_LblSLWarning, m_LblTPWarning, m_LblStopPrice, m_LblStopPriceWarning, m_LblOrderType, m_LblCommissionSize, m_LblAdditionalFundsAsterisk, m_LblInput, m_LblResult, m_LblRisk, m_LblRiskM, m_LblReward, m_LblRR, m_LblPosSize, m_LblPointValue, m_LblATRPeriod, m_LblATRMultiplierSL, m_LblATRMultiplierTP, m_LblATRValue, m_LblATRTimeframe, m_LblCurrentRiskMoney, m_LblCurrentRiskPerc, m_LblCurrentProfitMoney, m_LblCurrentProfitPerc, m_LblPotentialRiskMoney, m_LblPotentialRiskPerc, m_LblPotentialProfitMoney, m_LblPotentialProfitPerc, m_LblCurrentLots, m_LblCurrentRRR, m_LblPotentialLots, m_LblPotentialRRR, m_LblCurrentPortfolio, m_LblPotentialPortfolio, m_LblPosMargin, m_LblUsedMargin, m_LblFreeMargin, m_LblCustomLeverage, m_LblAccLeverage, m_LblSymbolLeverage, m_LblMaxPositionSizeByMargin, m_LblSwapsType, m_LblSwapsTripleDay, m_LblSwapsLong, m_LblSwapsShort, m_LblSwapsNominal, m_LblSwapsDaily, m_LblSwapsYearly, m_LblSwapsPerLotDaily, m_LblSwapsPerPSDaily, m_LblSwapsPerLotYearly, m_LblSwapsPerPSYearly, m_LblMagicNumber, m_LblExpiry, m_LblMinutes, m_LblCommentary, m_LblTradingPoints, m_LblMaxSlippage, m_LblMaxSpread, m_LblMaxEntrySLDistance, m_LblMinEntrySLDistance, m_LblTradingLots, m_LblURL, m_LblTradingTP, m_LblTrailingStop, m_LblBreakEven, m_LblMaxNumberOfTrades, m_LblMaxNumberOfTradesTotal, m_LblMaxNumberOfTradesPerSymbol, m_LblMaxPositionSize, m_LblMaxPositionSizeTotal, m_LblMaxPositionSizePerSymbol, m_LblMaxRisk, m_LblMaxRiskTotal, m_LblMaxRiskPerSymbol;; + CButton m_BtnTabMain, m_BtnTabRisk, m_BtnTabMargin, m_BtnTabSwaps, m_BtnTabTrading, m_BtnOrderType, m_BtnAccount, m_BtnLines, m_BtnStopLoss, m_BtnTakeProfit, m_BtnEntry, m_BtnATRTimeframe, m_BtnCommissionType, m_BtnMaxPS, m_BtnTrade, m_BtnTPsInward, m_BtnTPsOutward, m_BtnTradingTPShare, m_BtnQuickRisk1, m_BtnQuickRisk2, m_BtnEntryIncrease, m_BtnEntryDecrease, m_BtnStopLossIncrease, m_BtnStopLossDecrease, m_BtnTakeProfitIncrease, m_BtnTakeProfitDecrease, m_BtnStopPriceIncrease, m_BtnStopPriceDecrease, m_BtnTakeProfitsNumberAdd, m_BtnTakeProfitsNumberRemove, m_BtnMainTrade, m_BtnIgnoreSymbols; + CCheckBox m_ChkSpreadAdjustmentSL, m_ChkSpreadAdjustmentTP, m_ChkCountPendings, m_ChkIgnoreOrdersWithoutSL, m_ChkIgnoreOrdersWithoutTP, m_ChkDisableTradingWhenLinesAreHidden, m_ChkSubtractPositions, m_ChkSubtractPendingOrders, m_ChkDoNotApplyStopLoss, m_ChkDoNotApplyTakeProfit, m_ChkAskForConfirmation, m_ChkCommentAutoSuffix; + CEdit m_EdtEntryLevel, m_EdtSL, m_EdtTP, m_EdtStopPrice, m_EdtAccount, m_EdtCommissionSize, m_EdtRiskPIn, m_EdtRiskPRes, m_EdtRiskMIn, m_EdtRiskMRes, m_EdtReward1, m_EdtReward2, m_EdtRR1, m_EdtRR2, m_EdtPosSize, m_EdtPointValue, m_EdtATRPeriod, m_EdtATRMultiplierSL, m_EdtATRMultiplierTP, m_EdtCurRiskM, m_EdtCurRiskP, m_EdtPotRiskM, m_EdtPotRiskP, m_EdtCurProfitM, m_EdtCurProfitP, m_EdtPotProfitM, m_EdtPotProfitP, m_EdtCurL, m_EdtPotL, m_EdtCurrentRRR, m_EdtPotentialRRR, m_EdtPosMargin, m_EdtUsedMargin, m_EdtFreeMargin, m_EdtCustomLeverage, m_EdtMaxPositionSizeByMargin, m_EdtSwapsType, m_EdtSwapsTripleDay, m_EdtSwapsNominalLong, m_EdtSwapsNominalShort, m_EdtSwapsDailyLongLot, m_EdtSwapsDailyShortLot, m_EdtSwapsDailyLongPS, m_EdtSwapsDailyShortPS, m_EdtSwapsYearlyLongLot, m_EdtSwapsYearlyShortLot, m_EdtSwapsYearlyLongPS, m_EdtSwapsYearlyShortPS, m_EdtMagicNumber, m_EdtExpiry, m_EdtCommentary, m_EdtMaxSlippage, m_EdtMaxSpread, m_EdtMaxEntrySLDistance, m_EdtMinEntrySLDistance, m_EdtTrailingStopPoints, m_EdtBreakEvenPoints, m_EdtMaxNumberOfTradesTotal, m_EdtMaxNumberOfTradesPerSymbol, m_EdtMaxPositionSizeTotal, m_EdtMaxPositionSizePerSymbol, m_EdtMaxRiskTotal, m_EdtMaxRiskPerSymbol, m_EdtMaxRiskPercentage; + CLabel m_LblEntryLevel, m_LblEntryWarning, m_LblSL, m_LblSLWarning, m_LblTPWarning, m_LblStopPrice, m_LblStopPriceWarning, m_LblOrderType, m_LblCommissionSize, m_LblAdditionalFundsAsterisk, m_LblInput, m_LblResult, m_LblRisk, m_LblRiskM, m_LblReward, m_LblRR, m_LblPosSize, m_LblPointValue, m_LblATRPeriod, m_LblATRMultiplierSL, m_LblATRMultiplierTP, m_LblATRValue, m_LblATRTimeframe, m_LblCurrentRiskMoney, m_LblCurrentRiskPerc, m_LblCurrentProfitMoney, m_LblCurrentProfitPerc, m_LblPotentialRiskMoney, m_LblPotentialRiskPerc, m_LblPotentialProfitMoney, m_LblPotentialProfitPerc, m_LblCurrentLots, m_LblCurrentRRR, m_LblPotentialLots, m_LblPotentialRRR, m_LblCurrentPortfolio, m_LblPotentialPortfolio, m_LblPosMargin, m_LblUsedMargin, m_LblFreeMargin, m_LblCustomLeverage, m_LblAccLeverage, m_LblSymbolLeverage, m_LblMaxPositionSizeByMargin, m_LblSwapsType, m_LblSwapsTripleDay, m_LblSwapsLong, m_LblSwapsShort, m_LblSwapsNominal, m_LblSwapsDaily, m_LblSwapsYearly, m_LblSwapsPerLotDaily, m_LblSwapsPerPSDaily, m_LblSwapsPerLotYearly, m_LblSwapsPerPSYearly, m_LblMagicNumber, m_LblExpiry, m_LblMinutes, m_LblCommentary, m_LblTradingPoints, m_LblMaxSlippage, m_LblMaxSpread, m_LblMaxEntrySLDistance, m_LblMinEntrySLDistance, m_LblTradingLots, m_LblURL, m_LblTradingTP, m_LblTrailingStop, m_LblBreakEven, m_LblMaxNumberOfTrades, m_LblMaxNumberOfTradesTotal, m_LblMaxNumberOfTradesPerSymbol, m_LblMaxPositionSize, m_LblMaxPositionSizeTotal, m_LblMaxPositionSizePerSymbol, m_LblMaxRisk, m_LblMaxRiskTotal, m_LblMaxRiskPerSymbol, m_LblMaxRiskPercentage, m_LblIgnoreSymbols; string m_FileName; double m_DPIScale; @@ -27,7 +28,7 @@ private: CLabel AdditionalTPLabels[], AdditionalTPWarnings[]; CButton AdditionalTPButtonsIncrease[], AdditionalTPButtonsDecrease[]; // Store ordered and named panel objects arranged by tabs. - CPanelList *MainTabList, *RiskTabList, *MarginTabList, *SwapsTabList, *TradingTabList; + CPanelList *MainTabList, *RiskTabList, *MarginTabList, *SwapsTabList, *TradingTabList, *PersistentList; // PersisntentList can be potentially used for Strategy Tester event tracking in the future. // Some of the panel measurement parameters are used by more than one method: int first_column_start, normal_label_width, normal_edit_width, second_column_start, element_height, third_column_start, narrow_label_width, v_spacing, multi_tp_column_start, @@ -72,7 +73,7 @@ public: virtual void CheckAndRestoreLines(); virtual void DummyObjectSelect(string dummy_name); virtual bool IsMinimized() {return m_minimized;} - virtual void IniFileLoad() {CAppDialog::IniFileLoad(); InitObjects();} // Need to init objects after ini file load. + virtual void IniFileLoad() {if (FileIsExist(ExtDialog.IniFileName() + ExtDialog.IniFileExt())) CAppDialog::IniFileLoad(); InitObjects();} // Need to init objects after ini file load. virtual void EmulateMinMaxClick(); void OnClickBtnTakeProfitsNumberAdd(); void OnClickBtnTakeProfitsNumberRemove(); @@ -82,6 +83,15 @@ public: void OnClickBtnOrderType(); void OnClickBtnLines(); virtual void OnClickButtonClose(); + void OnClickEdtPosSize(); + void OnClickEdtEntryLevel(); + void OnClickEdtSL(); + void OnClickEdtTP(); + void OnClickEdtAccount(); + void OnClickEdtRiskPIn(); + void OnClickEdtRiskMIn(); + void OnClickAdditionalTPEdit(int); + void OnClickEdtTradingTPEdit1(); int MaxTakeProfitsNumber; virtual void UpdateAdditionalTradingPanelTP(int i); @@ -91,6 +101,7 @@ public: virtual void Maximize(); virtual void Minimize(); void SetTPButtonBackGroundColor(color); + virtual void ProcessTPChange(const bool tp_button_click); CEdit AdditionalTPEdits[]; CButton m_OutsideTradeButton; void MoveOutsideTradeButton(); @@ -112,7 +123,6 @@ private: virtual bool CreateObjects(); virtual bool InitObjects(); virtual bool DisplayValues(); // Updates values in the panel. - virtual void ProcessTPChange(const bool tp_button_click); virtual bool ButtonCreate (CList* list, CButton& Btn, int X1, int Y1, int X2, int Y2, string Name, string Text, string Tooltip = "\n"); virtual bool CheckBoxCreate (CList* list, CCheckBox& Chk, int X1, int Y1, int X2, int Y2, string Name, string Text, string Tooltip = "\n"); @@ -151,7 +161,7 @@ private: void OnChangeChkCountPendings(); void OnChangeChkIgnoreOrdersWithoutSL(); void OnChangeChkIgnoreOrdersWithoutTP(); - void OnChangeChkIgnoreOtherSymbols(); + void OnClickBtnIgnoreSymbols(); void OnEndEditEdtCustomLeverage(); void OnEndEditEdtMagicNumber(); void OnEndEditEdtCommentary(); @@ -160,6 +170,7 @@ private: void OnEndEditEdtMaxSpread(); void OnEndEditEdtMaxEntrySLDistance(); void OnEndEditEdtMinEntrySLDistance(); + void OnEndEditEdtMaxRiskPercentage(); void OnEndEditEdtMaxPositionSizeTotal(); void OnEndEditEdtMaxPositionSizePerSymbol(); void OnEndEditEdtTrailingStopPoints(); @@ -222,23 +233,30 @@ ON_EVENT(ON_CHANGE, m_ChkSpreadAdjustmentTP, OnChangeChkSpreadAdjustmentTP) ON_EVENT(ON_CHANGE, m_ChkCountPendings, OnChangeChkCountPendings) ON_EVENT(ON_CHANGE, m_ChkIgnoreOrdersWithoutSL, OnChangeChkIgnoreOrdersWithoutSL) ON_EVENT(ON_CHANGE, m_ChkIgnoreOrdersWithoutTP, OnChangeChkIgnoreOrdersWithoutTP) -ON_EVENT(ON_CHANGE, m_ChkIgnoreOtherSymbols, OnChangeChkIgnoreOtherSymbols) +ON_EVENT(ON_CLICK, m_BtnIgnoreSymbols, OnClickBtnIgnoreSymbols) ON_EVENT(ON_END_EDIT, m_EdtCustomLeverage, OnEndEditEdtCustomLeverage) ON_EVENT(ON_END_EDIT, m_EdtMagicNumber, OnEndEditEdtMagicNumber) ON_EVENT(ON_END_EDIT, m_EdtCommentary, OnEndEditEdtCommentary) ON_EVENT(ON_CHANGE, m_ChkDisableTradingWhenLinesAreHidden, OnChangeChkDisableTradingWhenLinesAreHidden) +ON_EVENT(ON_END_EDIT, m_EdtTrailingStopPoints, OnEndEditEdtTrailingStopPoints) +ON_EVENT(ON_END_EDIT, m_EdtBreakEvenPoints, OnEndEditEdtBreakEvenPoints) +if (ShowFusesOnTrading) +{ ON_EVENT(ON_END_EDIT, m_EdtMaxSlippage, OnEndEditEdtMaxSlippage) ON_EVENT(ON_END_EDIT, m_EdtMaxSpread, OnEndEditEdtMaxSpread) ON_EVENT(ON_END_EDIT, m_EdtMaxEntrySLDistance, OnEndEditEdtMaxEntrySLDistance) ON_EVENT(ON_END_EDIT, m_EdtMinEntrySLDistance, OnEndEditEdtMinEntrySLDistance) +ON_EVENT(ON_END_EDIT, m_EdtMaxRiskPercentage, OnEndEditEdtMaxRiskPercentage) +} +if (ShowMaxParametersOnTrading) +{ ON_EVENT(ON_END_EDIT, m_EdtMaxPositionSizeTotal, OnEndEditEdtMaxPositionSizeTotal) ON_EVENT(ON_END_EDIT, m_EdtMaxPositionSizePerSymbol, OnEndEditEdtMaxPositionSizePerSymbol) -ON_EVENT(ON_END_EDIT, m_EdtTrailingStopPoints, OnEndEditEdtTrailingStopPoints) -ON_EVENT(ON_END_EDIT, m_EdtBreakEvenPoints, OnEndEditEdtBreakEvenPoints) ON_EVENT(ON_END_EDIT, m_EdtMaxNumberOfTradesTotal, OnEndEditEdtMaxNumberOfTradesTotal) ON_EVENT(ON_END_EDIT, m_EdtMaxNumberOfTradesPerSymbol, OnEndEditEdtMaxNumberOfTradesPerSymbol) ON_EVENT(ON_END_EDIT, m_EdtMaxRiskTotal, OnEndEditEdtMaxRiskTotal) ON_EVENT(ON_END_EDIT, m_EdtMaxRiskPerSymbol, OnEndEditEdtMaxRiskPerSymbol) +} ON_EVENT(ON_END_EDIT, m_EdtExpiry, OnEndEditEdtExpiry) ON_EVENT(ON_CHANGE, m_ChkSubtractPositions, OnChangeChkSubtractPositions) ON_EVENT(ON_CHANGE, m_ChkSubtractPendingOrders, OnChangeChkSubtractPendingOrders) @@ -280,6 +298,7 @@ CPositionSizeCalculator::~CPositionSizeCalculator(void) delete MarginTabList; delete SwapsTabList; delete TradingTabList; + delete PersistentList; } // Updates filename used for settings storage. @@ -403,7 +422,7 @@ bool CPositionSizeCalculator::CreateObjects() int row_start, h_spacing, tab_button_start, tab_button_width, tab_button_spacing, narrow_edit_width, risk_perc_edit_width, narrowest_label_width, risk_lot_edit, wide_edit_width, wide_label_width, swap_last_label_width, swap_type_edit_width, swap_size_edit_width, atr_period_label_width, atr_period_edit_width, quick_risk_button_width, quick_risk_button_offset, second_risk_column_start, second_margin_column_start, second_swaps_column_start, third_risk_column_start, third_swaps_column_start, fourth_risk_column_start, fourth_swaps_column_start, max_psc_column_start, - panel_end; + panel_end, ignore_symbols_button_width; // Same for both modes - narrow and wide. row_start = (int)MathRound(10 * m_DPIScale); @@ -425,6 +444,7 @@ bool CPositionSizeCalculator::CreateObjects() second_swaps_column_start = first_column_start + narrowest_label_width + h_spacing; multi_tp_column_start = first_column_start + normal_label_width; multi_tp_label_width = (int)MathRound(70 * m_DPIScale); + ignore_symbols_button_width = (int)MathRound(95 * m_DPIScale); // Wide mode. if (PanelWidth > 350) // Wide panel required. @@ -492,15 +512,16 @@ bool CPositionSizeCalculator::CreateObjects() // Tabs - if (!ButtonCreate(NULL, m_BtnTabMain, tab_button_start, y, tab_button_start + tab_button_width, y + element_height, "m_BtnTabMain", TRANSLATION_TAB_BUTTON_MAIN)) return false; + PersistentList = new CPanelList; + if (!ButtonCreate(PersistentList, m_BtnTabMain, tab_button_start, y, tab_button_start + tab_button_width, y + element_height, "m_BtnTabMain", TRANSLATION_TAB_BUTTON_MAIN)) return false; MainTabList = new CPanelList; - if (!ButtonCreate(NULL, m_BtnTabRisk, tab_button_start + tab_button_width + tab_button_spacing, y, tab_button_start + tab_button_width * 2 + tab_button_spacing, y + element_height, "m_BtnTabRisk", TRANSLATION_TAB_BUTTON_RISK)) return false; + if (!ButtonCreate(PersistentList, m_BtnTabRisk, tab_button_start + tab_button_width + tab_button_spacing, y, tab_button_start + tab_button_width * 2 + tab_button_spacing, y + element_height, "m_BtnTabRisk", TRANSLATION_TAB_BUTTON_RISK)) return false; RiskTabList = new CPanelList; - if (!ButtonCreate(NULL, m_BtnTabMargin, tab_button_start + tab_button_width * 2 + tab_button_spacing * 2, y, tab_button_start + tab_button_width * 3 + tab_button_spacing * 2, y + element_height, "m_BtnTabMargin", TRANSLATION_TAB_BUTTON_MARGIN)) return false; + if (!ButtonCreate(PersistentList, m_BtnTabMargin, tab_button_start + tab_button_width * 2 + tab_button_spacing * 2, y, tab_button_start + tab_button_width * 3 + tab_button_spacing * 2, y + element_height, "m_BtnTabMargin", TRANSLATION_TAB_BUTTON_MARGIN)) return false; MarginTabList = new CPanelList; - if (!ButtonCreate(NULL, m_BtnTabSwaps, tab_button_start + tab_button_width * 3 + tab_button_spacing * 3, y, tab_button_start + tab_button_width * 4 + tab_button_spacing * 3, y + element_height, "m_BtnTabSwaps", TRANSLATION_TAB_BUTTON_SWAPS)) return false; + if (!ButtonCreate(PersistentList, m_BtnTabSwaps, tab_button_start + tab_button_width * 3 + tab_button_spacing * 3, y, tab_button_start + tab_button_width * 4 + tab_button_spacing * 3, y + element_height, "m_BtnTabSwaps", TRANSLATION_TAB_BUTTON_SWAPS)) return false; SwapsTabList = new CPanelList; - if (!ButtonCreate(NULL, m_BtnTabTrading, tab_button_start + tab_button_width * 4 + tab_button_spacing * 4, y, tab_button_start + tab_button_width * 5 + tab_button_spacing * 4, y + element_height, "m_BtnTabTrading", TRANSLATION_TAB_BUTTON_TRADING)) return false; + if (!ButtonCreate(PersistentList, m_BtnTabTrading, tab_button_start + tab_button_width * 4 + tab_button_spacing * 4, y, tab_button_start + tab_button_width * 5 + tab_button_spacing * 4, y + element_height, "m_BtnTabTrading", TRANSLATION_TAB_BUTTON_TRADING)) return false; TradingTabList = new CPanelList; // Main @@ -667,8 +688,8 @@ bool CPositionSizeCalculator::CreateObjects() y += element_height + v_spacing; } - if (!LabelCreate(MainTabList, m_LblInput, second_column_start, y, second_column_start + normal_edit_width, y + element_height, "m_LblInput", TRANSLATION_LABEL_INPUT)) return false; - if (!LabelCreate(MainTabList, m_LblResult, third_column_start, y, third_column_start + normal_edit_width, y + element_height, "m_LblResult", TRANSLATION_LABEL_RESULT)) return false; + if (!LabelCreate(MainTabList, m_LblInput, second_column_start, y, second_column_start + normal_edit_width, y + element_height, "m_LblInput", TRANSLATION_LABEL_INPUT, TRANSLATION_TOOLTIP_INPUTS)) return false; + if (!LabelCreate(MainTabList, m_LblResult, third_column_start, y, third_column_start + normal_edit_width, y + element_height, "m_LblResult", TRANSLATION_LABEL_RESULT, TRANSLATION_TOOLTIP_RESULT)) return false; y += element_height + v_spacing; @@ -714,7 +735,7 @@ bool CPositionSizeCalculator::CreateObjects() if (!LabelCreate(MainTabList, m_LblPosSize, first_column_start, y, first_column_start + normal_label_width, y + element_height, "m_LblPosSize", TRANSLATION_LABEL_POSITION_SIZE + ":")) return false; if (ShowMaxPSButton) if (!ButtonCreate(MainTabList, m_BtnMaxPS, second_column_start, y, second_column_start + normal_edit_width, y + element_height, "m_BtnMaxPS", TRANSLATION_BUTTON_MAX_PS)) return false; - if (!EditCreate(MainTabList, m_EdtPosSize, third_column_start, y, third_column_start + normal_edit_width, y + element_height, "m_EdtPosSize", "")) return false; + if (!EditCreate(MainTabList, m_EdtPosSize, third_column_start, y, third_column_start + normal_edit_width, y + element_height, "m_EdtPosSize", "", TRANSLATION_TOOLTIP_MAX_PS_BY_MARGIN)) return false; if (ShowPointValue) { @@ -750,7 +771,8 @@ bool CPositionSizeCalculator::CreateObjects() y += element_height + v_spacing; - if (!CheckBoxCreate(RiskTabList, m_ChkIgnoreOtherSymbols, first_column_start, y, panel_end, y + element_height, "m_ChkIgnoreOtherSymbols", TRANSLATION_CHECKBOX_IGNORE_ORDERS_IN_OTHER_SYMBOLS)) return false; + if (!LabelCreate(RiskTabList, m_LblIgnoreSymbols, first_column_start, y, first_column_start + ignore_symbols_button_width, y + element_height, "m_LblIgnoreSymbols", TRANSLATION_LABEL_IGNORE_TRADES_IN)) return false; + if (!ButtonCreate(RiskTabList, m_BtnIgnoreSymbols, first_column_start + ignore_symbols_button_width + v_spacing, y, second_column_start + narrow_edit_width, y + element_height, "m_BtnIgnoreSymbols", TRANSLATION_BUTTON_SYMBOLS_NO, TRANSLATION_BUTTON_SYMBOLS_TOOLTIP)) return false; y += element_height + v_spacing; @@ -956,9 +978,6 @@ bool CPositionSizeCalculator::CreateObjects() y += element_height + v_spacing; -// if (!LabelCreate(TradingTabList, m_LblMagicNumber, first_column_start, y, first_column_start + normal_label_width, y + element_height, "m_LblMagicNumber", TRANSLATION_LABEL_MAGIC_NUMBER + ":")) return false; - //if (!EditCreate(TradingTabList, m_EdtMagicNumber, second_trading_column_start, y, second_trading_column_start + normal_edit_width, y + element_height, "m_EdtMagicNumber", "")) return false; - if (!LabelCreate(TradingTabList, m_LblMagicNumber, first_column_start, y, first_column_start + normal_label_width, y + element_height, "m_LblMagicNumber", TRANSLATION_LABEL_MAGIC_NUMBER + ":")) return false; if (!EditCreate(TradingTabList, m_EdtMagicNumber, first_column_start + normal_label_width, y, first_column_start + normal_label_width + normal_edit_width, y + element_height, "m_EdtMagicNumber", "")) return false; if (!LabelCreate(TradingTabList, m_LblExpiry, first_column_start + normal_label_width + normal_edit_width + v_spacing, y, first_column_start + normal_label_width + normal_edit_width + narrowest_label_width, y + element_height, "m_LblExpiry", TRANSLATION_LABEL_EXPIRY + ":", TRANSLATION_TOOLTIP_EXPIRY)) return false; @@ -1051,6 +1070,11 @@ bool CPositionSizeCalculator::CreateObjects() if (!EditCreate(TradingTabList, m_EdtMinEntrySLDistance, second_trading_column_start, y, second_trading_column_start + normal_edit_width, y + element_height, "m_EdtMinEntrySLDistance", "")) return false; y += element_height + v_spacing; + + if (!LabelCreate(TradingTabList, m_LblMaxRiskPercentage, first_column_start, y, first_column_start + normal_label_width, y + element_height, "m_LblMaxRiskPercentage", TRANSLATION_LABEL_MAX_RISK_PERCENTAGE + ":")) return false; + if (!EditCreate(TradingTabList, m_EdtMaxRiskPercentage, second_trading_column_start, y, second_trading_column_start + normal_edit_width, y + element_height, "m_EdtMaxRiskPercentage", "")) return false; + + y += element_height + v_spacing; } if (ShowCheckboxesOnTrading) @@ -1174,6 +1198,7 @@ bool CPositionSizeCalculator::InitObjects() if (!m_EdtMaxSpread.TextAlign(align)) return false; if (!m_EdtMaxEntrySLDistance.TextAlign(align)) return false; if (!m_EdtMinEntrySLDistance.TextAlign(align)) return false; + if (!m_EdtMaxRiskPercentage.TextAlign(align)) return false; } if (!m_EdtTrailingStopPoints.TextAlign(align)) return false; if (!m_EdtBreakEvenPoints.TextAlign(align)) return false; @@ -1216,6 +1241,7 @@ bool CPositionSizeCalculator::InitObjects() TradingTPEdits[i].Text(DoubleToString(sets.TP[i], _Digits)); } } + return true; } @@ -1304,6 +1330,7 @@ void CPositionSizeCalculator::InitControlsValues() CommissionDecimals = (int)AccountInfoInteger(ACCOUNT_CURRENCY_DIGITS); m_BtnCommissionType.Text(AccountInfoString(ACCOUNT_CURRENCY)); } + /* Commission size*/ m_EdtCommissionSize.Text(DoubleToString(sets.CommissionPerLot, CommissionDecimals)); if (QuickRisk1 > 0) { @@ -1337,7 +1364,19 @@ void CPositionSizeCalculator::InitControlsValues() m_ChkCountPendings.Checked(sets.CountPendingOrders); m_ChkIgnoreOrdersWithoutSL.Checked(sets.IgnoreOrdersWithoutSL); m_ChkIgnoreOrdersWithoutTP.Checked(sets.IgnoreOrdersWithoutTP); - m_ChkIgnoreOtherSymbols.Checked(sets.IgnoreOtherSymbols); + switch(sets.IgnoreSymbols) + { + default: + case IGNORE_SYMBOLS_NONE: + m_BtnIgnoreSymbols.Text(TRANSLATION_BUTTON_SYMBOLS_NO); + break; + case IGNORE_SYMBOLS_OTHER: + m_BtnIgnoreSymbols.Text(TRANSLATION_BUTTON_SYMBOLS_OTHER); + break; + case IGNORE_SYMBOLS_CURRENT: + m_BtnIgnoreSymbols.Text(TRANSLATION_BUTTON_SYMBOLS_CURRENT); + break; + } // Show/hide RiskReward if (sets.TakeProfitLevel == 0) @@ -1352,6 +1391,7 @@ void CPositionSizeCalculator::InitControlsValues() CustomLeverage = sets.CustomLeverage; CustomLeverageDecimals = CountDecimalPlaces(CustomLeverage); + /* Custom Leverage */ m_EdtCustomLeverage.Text(DoubleToString(sets.CustomLeverage, CustomLeverageDecimals)); // Trading m_EdtTrailingStopPoints.Text(IntegerToString(sets.TrailingStopPoints)); @@ -1376,6 +1416,7 @@ void CPositionSizeCalculator::InitControlsValues() m_EdtMaxSpread.Text(IntegerToString(sets.MaxSpread)); m_EdtMaxEntrySLDistance.Text(IntegerToString(sets.MaxEntrySLDistance)); m_EdtMinEntrySLDistance.Text(IntegerToString(sets.MinEntrySLDistance)); + m_EdtMaxRiskPercentage.Text(DoubleToString(sets.MaxRiskPercentage, 2)); } if (ShowCheckboxesOnTrading) { @@ -1527,36 +1568,42 @@ bool CPositionSizeCalculator::DisplayValues() //=== Spread if (ShowSpread == Points) { - if (!Caption(PanelCaption + " " + TRANSLATION_LABEL_SPREAD + ": " + IntegerToString(SymbolInfoInteger(Symbol(), SYMBOL_SPREAD)))) return false; + if (!Caption(PanelCaption + " " + TRANSLATION_LABEL_SPREAD + ": " + IntegerToString(SymbolInfoInteger(SymbolForTrading, SYMBOL_SPREAD)))) return false; } else if (ShowSpread == Ratio) // Spread / SL ratio in percentage. { double SL; if (sets.SLDistanceInPoints) SL = sets.StopLoss * _Point; else SL = MathAbs(sets.StopLossLevel - sets.EntryLevel); - if (SL != 0) if (!Caption(PanelCaption + " " + TRANSLATION_LABEL_SPREAD + ": " + DoubleToString((SymbolInfoInteger(Symbol(), SYMBOL_SPREAD) * _Point / SL) * 100, 2) + "%")) return false; + if (SL != 0) if (!Caption(PanelCaption + " " + TRANSLATION_LABEL_SPREAD + ": " + DoubleToString((SymbolInfoInteger(SymbolForTrading, SYMBOL_SPREAD) * _Point / SL) * 100, 2) + "%")) return false; } else if (!Caption(PanelCaption)) return false; //=== Levels - /* Entry Level */ if (!m_EdtEntryLevel.Text(DoubleToString(sets.EntryLevel, _Digits))) return false; + /* Entry Level */ if (!m_EdtEntryLevel.PropFlags()) m_EdtEntryLevel.Text(DoubleToString(sets.EntryLevel, _Digits)); if (sets.TradeDirection == Long) m_BtnEntry.Text(TRANSLATION_BUTTON_LONG); else if (sets.TradeDirection == Short) m_BtnEntry.Text(TRANSLATION_BUTTON_SHORT); /* Entry Warning */ if (!m_LblEntryWarning.Text(WarningEntry)) return false; - /* Stop-Loss */ if (!sets.SLDistanceInPoints) + if (!m_EdtSL.PropFlags()) { - if (!m_EdtSL.Text(DoubleToString(sets.StopLossLevel, _Digits))) return false; + /* Stop-Loss */ if (!sets.SLDistanceInPoints) + { + if (!m_EdtSL.Text(DoubleToString(sets.StopLossLevel, _Digits))) return false; + } + else if (!m_EdtSL.Text(IntegerToString(sets.StopLoss))) return false; } - else if (!m_EdtSL.Text(IntegerToString(sets.StopLoss))) return false; /* SL Warning */ if (!m_LblSLWarning.Text(WarningSL)) return false; - /* Take Profit */ if (!sets.TPDistanceInPoints) + if (!m_EdtTP.PropFlags()) { - if (!m_EdtTP.Text(DoubleToString(sets.TakeProfitLevel, _Digits))) return false; + /* Take Profit */ if (!sets.TPDistanceInPoints) + { + if (!m_EdtTP.Text(DoubleToString(sets.TakeProfitLevel, _Digits))) return false; + } + else if (!m_EdtTP.Text(IntegerToString(sets.TakeProfit))) return false; } - else if (!m_EdtTP.Text(IntegerToString(sets.TakeProfit))) return false; for (int i = 1; i < sets.TakeProfitsNumber; i++) { if (!sets.TPDistanceInPoints) @@ -1570,7 +1617,7 @@ bool CPositionSizeCalculator::DisplayValues() string tp_text = "0"; // If line's value was zero, then points distance should be also zero. if (sets.TP[i] != 0) tp_text = IntegerToString((int)MathRound(MathAbs(sets.TP[i] - sets.EntryLevel) / _Point)); - if (!AdditionalTPEdits[i - 1].Text(tp_text)) return false; + if (!AdditionalTPEdits[i - 1].PropFlags()) AdditionalTPEdits[i - 1].Text(tp_text); } } @@ -1604,7 +1651,7 @@ bool CPositionSizeCalculator::DisplayValues() m_EdtEntryLevel.ReadOnly(false); m_EdtEntryLevel.ColorBackground(CONTROLS_EDIT_COLOR_ENABLE); } - /* Account Value */ if (!HideAccSize) if (!m_EdtAccount.Text(FormatDouble(DoubleToString(AccSize, AccountCurrencyDigits), AccountCurrencyDigits))) return false; + /* Account Value */ if (!HideAccSize) if (!m_EdtAccount.PropFlags()) m_EdtAccount.Text(FormatDouble(DoubleToString(AccSize, AccountCurrencyDigits), AccountCurrencyDigits)); /* Account Asterisk */ if (sets.SelectedTab == MainTab) @@ -1660,9 +1707,9 @@ bool CPositionSizeCalculator::DisplayValues() m_LblATRValue.Text(TRANSLATION_LABEL_ATR_VALUE + " = " + DoubleToString(atr, _Digits)); } //=== Commission, risk, position size - /* Commission size*/ m_EdtCommissionSize.Text(DoubleToString(sets.CommissionPerLot, CommissionDecimals)); - /* Risk In */ if (!m_EdtRiskPIn.Text(FormatDouble(DoubleToString(DisplayRisk, 2)))) return false; - /* Risk currency */ if (StringLen(AccountCurrency) > 0) if (!m_LblRiskM.Text(TRANSLATION_LABEL_RISK + ", " + AccountCurrency + ":")) return false; + + /* Risk In */ if (!m_EdtRiskPIn.PropFlags()) m_EdtRiskPIn.Text(FormatDouble(DoubleToString(DisplayRisk, 2))); + /* Risk currency */ if (StringLen(AccountCurrency) > 0) if (!m_LblRiskM.PropFlags()) m_LblRiskM.Text(TRANSLATION_LABEL_RISK + ", " + AccountCurrency + ":"); /* Risk Money In */ if (!m_EdtRiskMIn.Text(FormatDouble(DoubleToString(RiskMoney, AccountCurrencyDigits), AccountCurrencyDigits))) return false; /* Risk Money Out */ if (!m_EdtRiskMRes.Text(FormatDouble(DoubleToString(OutputRiskMoney), AccountCurrencyDigits))) return false; if (OutputRiskMoney != 0) @@ -1688,7 +1735,8 @@ bool CPositionSizeCalculator::DisplayValues() /* Risk/Reward 2 */ if (!m_EdtRR2.Text(OutputRR)) return false; if (OutputRR == TRANSLATION_LABEL_WARNING_INVALID_TP) m_EdtRR2.Color(clrRed); else m_EdtRR2.Color(m_EdtTP.Color()); - /* Position size */ if (!m_EdtPosSize.Text(FormatDouble(DoubleToString(OutputPositionSize, LotStep_digits), LotStep_digits))) return false; + + /* Position size */ if (!m_EdtPosSize.PropFlags()) m_EdtPosSize.Text(FormatDouble(DoubleToString(OutputPositionSize, LotStep_digits), LotStep_digits)); if (OutputPositionSize > OutputMaxPositionSize) { m_EdtPosSize.Color(clrRed); // Calculated position size is greater than maximum position size by margin. @@ -1740,7 +1788,7 @@ bool CPositionSizeCalculator::DisplayValues() /* Future Used Margin */ if (!m_EdtUsedMargin.Text(FormatDouble(DoubleToString(UsedMargin, AccountCurrencyDigits), AccountCurrencyDigits))) return false; /* Future Free Margin */ if (!m_EdtFreeMargin.Text(FormatDouble(DoubleToString(FutureMargin, AccountCurrencyDigits), AccountCurrencyDigits))) return false; } - /* Custom Leverage */ if (!m_EdtCustomLeverage.Text(DoubleToString(sets.CustomLeverage, CustomLeverageDecimals))) return false; + string acc_lev = IntegerToString(AccountInfoInteger(ACCOUNT_LEVERAGE)); /* Account Leverage */ if (StringLen(acc_lev) > 0) if (!m_LblAccLeverage.Text("(" + TRANSLATION_LABEL_DEFAULT + " = 1:" + acc_lev + ")")) return false; /* Symbol Leverage */ if (SymbolLeverage) if (!m_LblSymbolLeverage.Text("(" + TRANSLATION_LABEL_SYMBOL + " = 1:" + DoubleToString(SymbolLeverage, SymbolLeverageDecimals) + ")")) return false; @@ -1760,10 +1808,10 @@ bool CPositionSizeCalculator::DisplayValues() //=== Swaps /* Swaps Type */ if (!m_EdtSwapsType.Text(OutputSwapsType)) return false; /* Swaps Triple Day */ if (!m_EdtSwapsTripleDay.Text(SwapsTripleDay)) return false; - double swap_long = SymbolInfoDouble(Symbol(), SYMBOL_SWAP_LONG); - int swap_long_decimal_places = CountDecimalPlaces(swap_long); - double swap_short = SymbolInfoDouble(Symbol(), SYMBOL_SWAP_SHORT); - int swap_short_decimal_places = CountDecimalPlaces(swap_short); + double swap_long = SymbolInfoDouble(SymbolForTrading, SYMBOL_SWAP_LONG); + int swap_long_decimal_places = (int)MathMin(4, CountDecimalPlaces(swap_long)); + double swap_short = SymbolInfoDouble(SymbolForTrading, SYMBOL_SWAP_SHORT); + int swap_short_decimal_places = (int)MathMin(4, CountDecimalPlaces(swap_short)); /* Swaps Nominal Long */ if (!m_EdtSwapsNominalLong.Text(DoubleToString(swap_long, swap_long_decimal_places))) return false; /* Swaps Nominal Short */ if (!m_EdtSwapsNominalShort.Text(DoubleToString(swap_short, swap_short_decimal_places))) return false; /* Swaps Daily Long Lot */ if (!m_EdtSwapsDailyLongLot.Text(OutputSwapsDailyLongLot)) return false; @@ -1784,7 +1832,7 @@ bool CPositionSizeCalculator::DisplayValues() if (sets.TakeProfitsNumber > 1) { sets.TP[0] = sets.TakeProfitLevel; // Always the main TP. - TradingTPEdits[0].Text(DoubleToString(sets.TP[0], _Digits)); + if (!TradingTPEdits[0].PropFlags()) TradingTPEdits[0].Text(DoubleToString(sets.TP[0], _Digits)); if (AdditionalTPLineMoved) { for (int i = 1; i < sets.TakeProfitsNumber; i++) @@ -1858,12 +1906,12 @@ void CPositionSizeCalculator::CalculateSettingsBasedOnLines() if (sets.TradeDirection == Long) { sets.StopLossLevel = sets.EntryLevel - sl; - if (sets.SpreadAdjustmentSL) sets.StopLossLevel -= (SymbolInfoDouble(Symbol(), SYMBOL_ASK) - SymbolInfoDouble(Symbol(), SYMBOL_BID)); // Adjust for spread to preserve probabilities. + if (sets.SpreadAdjustmentSL) sets.StopLossLevel -= (SymbolInfoDouble(SymbolForTrading, SYMBOL_ASK) - SymbolInfoDouble(SymbolForTrading, SYMBOL_BID)); // Adjust for spread to preserve probabilities. } else { sets.StopLossLevel = sets.EntryLevel + sl; - if (sets.SpreadAdjustmentSL) sets.StopLossLevel += (SymbolInfoDouble(Symbol(), SYMBOL_ASK) - SymbolInfoDouble(Symbol(), SYMBOL_BID)); // Adjust for spread to preserve probabilities. + if (sets.SpreadAdjustmentSL) sets.StopLossLevel += (SymbolInfoDouble(SymbolForTrading, SYMBOL_ASK) - SymbolInfoDouble(SymbolForTrading, SYMBOL_BID)); // Adjust for spread to preserve probabilities. } sets.StopLoss = (int)MathRound(MathAbs(sets.StopLossLevel - sets.EntryLevel) / _Point); } @@ -1874,12 +1922,12 @@ void CPositionSizeCalculator::CalculateSettingsBasedOnLines() if (sets.StopLossLevel < sets.EntryLevel) { sets.TakeProfitLevel = sets.EntryLevel + tp; - if (sets.SpreadAdjustmentTP) sets.TakeProfitLevel -= (SymbolInfoDouble(Symbol(), SYMBOL_ASK) - SymbolInfoDouble(Symbol(), SYMBOL_BID)); // Adjust for spread to preserve probabilities. + if (sets.SpreadAdjustmentTP) sets.TakeProfitLevel -= (SymbolInfoDouble(SymbolForTrading, SYMBOL_ASK) - SymbolInfoDouble(SymbolForTrading, SYMBOL_BID)); // Adjust for spread to preserve probabilities. } else { sets.TakeProfitLevel = sets.EntryLevel - tp; - if (sets.SpreadAdjustmentTP) sets.TakeProfitLevel += (SymbolInfoDouble(Symbol(), SYMBOL_ASK) - SymbolInfoDouble(Symbol(), SYMBOL_BID)); // Adjust for spread to preserve probabilities. + if (sets.SpreadAdjustmentTP) sets.TakeProfitLevel += (SymbolInfoDouble(SymbolForTrading, SYMBOL_ASK) - SymbolInfoDouble(SymbolForTrading, SYMBOL_BID)); // Adjust for spread to preserve probabilities. } sets.TakeProfit = (int)MathRound(MathAbs(sets.TakeProfitLevel - sets.EntryLevel) / _Point); } @@ -1921,18 +1969,18 @@ void CPositionSizeCalculator::CalculateSettingsBasedOnLines() double read_tStopLossLevel; if (!ObjectGetDouble(ChartID(), ObjectPrefix + "StopLossLine", OBJPROP_PRICE, 0, read_tStopLossLevel)) return; // Line was deleted, waiting for automatic restoration. tStopLossLevel = Round(read_tStopLossLevel, _Digits); - if ((SymbolInfoDouble(_Symbol, SYMBOL_ASK) > 0) && (SymbolInfoDouble(_Symbol, SYMBOL_BID) > 0)) + if ((SymbolInfoDouble(SymbolForTrading, SYMBOL_ASK) > 0) && (SymbolInfoDouble(SymbolForTrading, SYMBOL_BID) > 0)) { // Long entry - if (tStopLossLevel < SymbolInfoDouble(_Symbol, SYMBOL_BID)) tEntryLevel = SymbolInfoDouble(_Symbol, SYMBOL_ASK); + if (tStopLossLevel < SymbolInfoDouble(SymbolForTrading, SYMBOL_BID)) tEntryLevel = SymbolInfoDouble(SymbolForTrading, SYMBOL_ASK); // Short entry - else if (tStopLossLevel > SymbolInfoDouble(_Symbol, SYMBOL_ASK)) tEntryLevel = SymbolInfoDouble(_Symbol, SYMBOL_BID); + else if (tStopLossLevel > SymbolInfoDouble(SymbolForTrading, SYMBOL_ASK)) tEntryLevel = SymbolInfoDouble(SymbolForTrading, SYMBOL_BID); // Undefined entry else { // Move tEntryLevel to the nearest line. - if ((tEntryLevel - SymbolInfoDouble(_Symbol, SYMBOL_BID)) < (tEntryLevel - SymbolInfoDouble(_Symbol, SYMBOL_ASK))) tEntryLevel = SymbolInfoDouble(_Symbol, SYMBOL_BID); - else tEntryLevel = SymbolInfoDouble(_Symbol, SYMBOL_ASK); + if ((tEntryLevel - SymbolInfoDouble(SymbolForTrading, SYMBOL_BID)) < (tEntryLevel - SymbolInfoDouble(SymbolForTrading, SYMBOL_ASK))) tEntryLevel = SymbolInfoDouble(SymbolForTrading, SYMBOL_BID); + else tEntryLevel = SymbolInfoDouble(SymbolForTrading, SYMBOL_ASK); } ObjectSetDouble(0, ObjectPrefix + "EntryLine", OBJPROP_PRICE, tEntryLevel); sets.EntryLevel = tEntryLevel; @@ -1993,14 +2041,6 @@ void CPositionSizeCalculator::CalculateSettingsBasedOnLines() if (sets.EntryLevel < sets.StopLossLevel) sets.TradeDirection = Short; else if (sets.EntryLevel > sets.StopLossLevel) sets.TradeDirection = Long; - if (sets.TPLockedOnSL) - { - tEntryLevel = sets.EntryLevel; - tStopLossLevel = sets.StopLossLevel; - if (sets.TakeProfitLevel == 0) ProcessTPChange(true); // When TPLockedOnSL has been enabled via an input parameter. - else ProcessTPChange(false); - } - if (sets.TradeDirection == Short) PanelCaption = "\x25BC " + PanelCaptionBase; else PanelCaption = "\x25B2 " + PanelCaptionBase; } @@ -2011,6 +2051,12 @@ bool CPositionSizeCalculator::CreateOutsideButton(CButton &Btn, int X1, int Y1, if (!Btn.Text(Text)) return false; ObjectSetString(ChartID(), m_name + Name, OBJPROP_TOOLTIP, Tooltip); + // Used in the Strategy Tester visual mode to find this button's ID. + CStringForList *obj = new CStringForList; + obj.Name = Name; + obj.Obj = GetPointer(Btn); + PersistentList.Add(obj); + return true; } @@ -2078,6 +2124,11 @@ void CPositionSizeCalculator::MoveOutsideTradeButton() void CPositionSizeCalculator::RefreshValues() { if (sets.StopLossLevel < 0) Initialization(); // Helps with 'Waiting for data'. MT5 only solution. MT4 handles this differently. + if (ShowATROptions) // Make sure ATR SL and TP multipliers get initialzied with non-zero values if default ones were zero. + { + if (sets.ATRMultiplierSL == 0) UpdateFixedSL(); + if ((sets.ATRMultiplierTP == 0) && (sets.TakeProfitLevel != 0)) UpdateFixedTP(); + } CalculateSettingsBasedOnLines(); RecalculatePositionSize(); @@ -2318,7 +2369,8 @@ void CPositionSizeCalculator::ProcessTPChange(const bool tp_button_click) // Profit = Risk * N + Commission * 2. // TP distance = (Risk * N + Commission * 2) / Point_value. if ((UnitCost_reward != 0) && (OutputPositionSize != 0) && (TickSize != 0)) - tp_distance = (RiskMoney * TP_Multiplier + OutputPositionSize * commission * 2) / (OutputPositionSize * UnitCost_reward / TickSize); + //tp_distance = (RiskMoney * TP_Multiplier + OutputPositionSize * commission * 2) / (OutputPositionSize * UnitCost_reward / TickSize); + tp_distance = (OutputRiskMoney * TP_Multiplier + OutputPositionSize * commission * 2) / (OutputPositionSize * UnitCost_reward / TickSize); if (tEntryLevel < tStopLossLevel) tp_distance = -tp_distance; } else tp_distance = (tEntryLevel - tStopLossLevel) * TP_Multiplier; @@ -2363,7 +2415,7 @@ void CPositionSizeCalculator::ProcessTPChange(const bool tp_button_click) ObjectSetInteger(ChartID(), ObjectPrefix + "TakeProfitLine", OBJPROP_COLOR, takeprofit_line_color); ObjectSetInteger(ChartID(), ObjectPrefix + "TakeProfitLine", OBJPROP_WIDTH, takeprofit_line_width); ObjectSetInteger(ChartID(), ObjectPrefix + "TakeProfitLine", OBJPROP_HIDDEN, false); - ObjectSetString(ChartID(), ObjectPrefix + "TakeProfitLine", OBJPROP_TOOLTIP, "Take-Profit"); + ObjectSetString(ChartID(), ObjectPrefix + "TakeProfitLine", OBJPROP_TOOLTIP, TRANSLATION_LABEL_TAKEPROFIT); // Create multiple TP lines. for (int i = 1; i < sets.TakeProfitsNumber; i++) @@ -2373,7 +2425,7 @@ void CPositionSizeCalculator::ProcessTPChange(const bool tp_button_click) ObjectSetInteger(ChartID(), ObjectPrefix + "TakeProfitLine" + IntegerToString(i), OBJPROP_COLOR, takeprofit_line_color); ObjectSetInteger(ChartID(), ObjectPrefix + "TakeProfitLine" + IntegerToString(i), OBJPROP_WIDTH, takeprofit_line_width); ObjectSetInteger(ChartID(), ObjectPrefix + "TakeProfitLine" + IntegerToString(i), OBJPROP_HIDDEN, false); - ObjectSetString(ChartID(), ObjectPrefix + "TakeProfitLine" + IntegerToString(i), OBJPROP_TOOLTIP, "Take-Profit #" + IntegerToString(i + 1)); + ObjectSetString(ChartID(), ObjectPrefix + "TakeProfitLine" + IntegerToString(i), OBJPROP_TOOLTIP, TRANSLATION_LABEL_TAKEPROFIT + " #" + IntegerToString(i + 1)); } } else @@ -2385,8 +2437,11 @@ void CPositionSizeCalculator::ProcessTPChange(const bool tp_button_click) ObjectSetDouble(ChartID(), ObjectPrefix + "TakeProfitLine" + IntegerToString(i), OBJPROP_PRICE, sets.TP[i]); } } - ObjectSetInteger(ChartID(), ObjectPrefix + "TakeProfitLine", OBJPROP_SELECTABLE, true); - if (DefaultLinesSelected) ObjectSetInteger(ChartID(), ObjectPrefix + "TakeProfitLine", OBJPROP_SELECTED, true); + if (!sets.TPLockedOnSL) + { + ObjectSetInteger(ChartID(), ObjectPrefix + "TakeProfitLine", OBJPROP_SELECTABLE, true); + if (DefaultLinesSelected) ObjectSetInteger(ChartID(), ObjectPrefix + "TakeProfitLine", OBJPROP_SELECTED, true); + } for (int i = 1; i < sets.TakeProfitsNumber; i++) { ObjectSetInteger(ChartID(), ObjectPrefix + "TakeProfitLine" + IntegerToString(i), OBJPROP_SELECTABLE, true); @@ -2453,7 +2508,7 @@ void CPositionSizeCalculator::ProcessTPChange(const bool tp_button_click) if (tp_button_click) { HideShowMaximize(); - MoveAndResize(); + //MoveAndResize(); } } // Need to call RefreshValues() only if this function is invoked from TP Button click event handler. In all other cases it is called from within RefreshValues() itself. @@ -2586,7 +2641,11 @@ void CPositionSizeCalculator::OnClickBtnOrderType() m_BtnStopPriceIncrease.Hide(); m_BtnStopPriceDecrease.Hide(); ObjectSetInteger(ChartID(), ObjectPrefix + "StopPriceLabel", OBJPROP_TIMEFRAMES, OBJ_NO_PERIODS); - if ((sets.ShowLines) && (ShowLineLabels)) ObjectSetInteger(ChartID(), ObjectPrefix + "EntryLabel", OBJPROP_TIMEFRAMES, OBJ_ALL_PERIODS); + if (sets.ShowLines) + { + ObjectSetInteger(ChartID(), ObjectPrefix + "EntryLine", OBJPROP_TIMEFRAMES, OBJ_ALL_PERIODS); + if (ShowLineLabels) ObjectSetInteger(ChartID(), ObjectPrefix + "EntryLabel", OBJPROP_TIMEFRAMES, OBJ_ALL_PERIODS); + } } else if (sets.EntryType == StopLimit) { @@ -2615,7 +2674,11 @@ void CPositionSizeCalculator::OnClickBtnOrderType() m_BtnStopPriceIncrease.Show(); m_BtnStopPriceDecrease.Show(); } - if ((sets.ShowLines) && (ShowLineLabels)) ObjectSetInteger(ChartID(), ObjectPrefix + "EntryLabel", OBJPROP_TIMEFRAMES, OBJ_ALL_PERIODS); + if (sets.ShowLines) + { + ObjectSetInteger(ChartID(), ObjectPrefix + "EntryLine", OBJPROP_TIMEFRAMES, OBJ_ALL_PERIODS); + if (ShowLineLabels) ObjectSetInteger(ChartID(), ObjectPrefix + "EntryLabel", OBJPROP_TIMEFRAMES, OBJ_ALL_PERIODS); + } } RefreshValues(); } @@ -2768,7 +2831,7 @@ void CPositionSizeCalculator::OnClickBtnLines() void CPositionSizeCalculator::OnClickButtonClose() { - if ((!AskBeforeClosing) || (MessageBox("Are you sure you want to close the Position Sizer?", "Exit?", MB_YESNO) == IDYES)) + if ((!AskBeforeClosing) || (MessageBox(TRANSLATION_MESSAGE_ARE_YOU_SURE, TRANSLATION_MESSAGE_EXIT, MB_YESNO) == IDYES)) { CAppDialog::OnClickButtonClose(); } @@ -2802,6 +2865,8 @@ void CPositionSizeCalculator::OnClickBtnTakeProfit() { m_BtnTakeProfit.ColorBackground(CONTROLS_BUTTON_COLOR_TP_UNLOCKED); sets.TPLockedOnSL = false; + ObjectSetInteger(ChartID(), ObjectPrefix + "TakeProfitLine", OBJPROP_SELECTABLE, true); + ObjectSetInteger(ChartID(), ObjectPrefix + "TakeProfitLine", OBJPROP_SELECTED, sets.WasSelectedTakeProfitLine); return; } // If already have some take-profit, switch to a locked mode - TP always follows SL when Entry-SL difference changes. @@ -2809,6 +2874,9 @@ void CPositionSizeCalculator::OnClickBtnTakeProfit() { sets.TPLockedOnSL = true; m_BtnTakeProfit.ColorBackground(CONTROLS_BUTTON_COLOR_TP_LOCKED); + sets.WasSelectedTakeProfitLine = ObjectGetInteger(ChartID(), ObjectPrefix + "TakeProfitLine", OBJPROP_SELECTED); + ObjectSetInteger(ChartID(), ObjectPrefix + "TakeProfitLine", OBJPROP_SELECTED, false); + ObjectSetInteger(ChartID(), ObjectPrefix + "TakeProfitLine", OBJPROP_SELECTABLE, false); } ProcessTPChange(true); @@ -2843,7 +2911,7 @@ void SwitchEntryDirection() // Remember old SL: double old_sl_distance = sets.EntryLevel - sets.StopLossLevel; - if (sets.EntryType == Instant) sets.EntryLevel = SymbolInfoDouble(Symbol(), SYMBOL_BID); + if (sets.EntryType == Instant) sets.EntryLevel = SymbolInfoDouble(SymbolForTrading, SYMBOL_BID); if ((ShowATROptions) && (sets.ATRMultiplierSL > 0)) { @@ -2900,7 +2968,7 @@ void SwitchEntryDirection() // Remember old SL: double old_sl_distance = sets.StopLossLevel - sets.EntryLevel; - if (sets.EntryType == Instant) sets.EntryLevel = SymbolInfoDouble(Symbol(), SYMBOL_ASK); + if (sets.EntryType == Instant) sets.EntryLevel = SymbolInfoDouble(SymbolForTrading, SYMBOL_ASK); if ((ShowATROptions) && (sets.ATRMultiplierSL > 0)) { @@ -3036,6 +3104,8 @@ void CPositionSizeCalculator::OnClickBtnCommissionType() CommissionDecimals = AccountCurrencyDigits; m_BtnCommissionType.Text(AccountCurrency); } + + m_EdtCommissionSize.Text(DoubleToString(sets.CommissionPerLot, CommissionDecimals)); CalculateRiskAndPositionSize(); DisplayValues(); } @@ -3567,7 +3637,7 @@ void CPositionSizeCalculator::OnClickBtnTakeProfitsNumberAdd() // And it is added for the first time, create the Remove button: if (MaxTakeProfitsNumber == 1) { - ButtonCreate(MainTabList, m_BtnTakeProfitsNumberRemove, first_column_start, y, first_column_start + v_spacing * 4 - 1, y + element_height, name, "x", "Remove Take-profit"); + ButtonCreate(MainTabList, m_BtnTakeProfitsNumberRemove, first_column_start, y, first_column_start + v_spacing * 4 - 1, y + element_height, name, "x", TRANSLATION_TOOLTIP_TAKEPROFIT_REMOVE); if (DarkMode) { m_BtnTakeProfitsNumberRemove.ColorBackground(DARKMODE_BUTTON_BG_COLOR); @@ -3965,6 +4035,7 @@ void CPositionSizeCalculator::OnClickBtnTakeProfitsNumberRemove() void CPositionSizeCalculator::OnEndEditEdtEntryLevel() { string s = m_EdtEntryLevel.Text(); + m_EdtEntryLevel.PropFlags(0); // Reset the 'being edited' flag. StringReplace(s, ",", "."); // Replace comma with period for normal double conversion. sets.EntryLevel = StringToDouble(s); if (tEntryLevel != sets.EntryLevel) @@ -3982,6 +4053,7 @@ void CPositionSizeCalculator::OnEndEditEdtSL() if (!sets.SLDistanceInPoints) { string s = m_EdtSL.Text(); + m_EdtSL.PropFlags(0); // Reset the 'being edited' flag. StringReplace(s, ",", "."); // Replace comma with period for normal double conversion. double new_value = StringToDouble(s); if (new_value == 0) // Not allowed. @@ -4031,6 +4103,7 @@ void CPositionSizeCalculator::OnEndEditEdtSL() void CPositionSizeCalculator::OnEndEditEdtTP() { string s = m_EdtTP.Text(); + m_EdtTP.PropFlags(0); // Reset the 'being edited' flag. StringReplace(s, ",", "."); // Replace comma with period for normal double conversion. if (!sets.TPDistanceInPoints) { @@ -4165,10 +4238,14 @@ void CPositionSizeCalculator::OnEndEditEdtTP() } if (ShowATROptions) // Update ATR multiplier after the line was moved by the user. { - double buf[1] = {0}; - if (ATR_handle != INVALID_HANDLE) CopyBuffer(ATR_handle, 0, (int)ATRCandle, 1, buf); - double atr = buf[0]; - if (atr != 0) sets.ATRMultiplierTP = MathAbs(sets.TakeProfitLevel - sets.EntryLevel) / atr; + if (sets.TakeProfitLevel == 0) sets.ATRMultiplierTP = 0; + else + { + double buf[1] = {0}; + if (ATR_handle != INVALID_HANDLE) CopyBuffer(ATR_handle, 0, (int)ATRCandle, 1, buf); + double atr = buf[0]; + if (atr != 0) sets.ATRMultiplierTP = MathAbs(sets.TakeProfitLevel - sets.EntryLevel) / atr; + } m_EdtATRMultiplierTP.Text(DoubleToString(sets.ATRMultiplierTP, 2)); // Untick spread adjustment checkbox as TP was set explicitly: m_ChkSpreadAdjustmentTP.Checked(false); @@ -4227,6 +4304,7 @@ void CPositionSizeCalculator::OnEndEditEdtCommissionSize() { sets.CommissionPerLot = StringToDouble(s); if (sets.CommissionType == COMMISSION_PERCENT) CommissionDecimals = CountDecimalPlaces(sets.CommissionPerLot); + m_EdtCommissionSize.Text(DoubleToString(sets.CommissionPerLot, CommissionDecimals)); CalculateRiskAndPositionSize(); DisplayValues(); } @@ -4235,6 +4313,7 @@ void CPositionSizeCalculator::OnEndEditEdtCommissionSize() void CPositionSizeCalculator::OnEndEditEdtAccount() { string text = m_EdtAccount.Text(); + m_EdtAccount.PropFlags(0); // Reset the 'being edited' flag. // Try to swap , for . in the "normal" decimal separator positions only. Other commas will be simply removed. if (StringGetCharacter(text, StringLen(text) - 2) == ',') StringSetCharacter(text, StringLen(text) - 2, '.'); if (StringGetCharacter(text, StringLen(text) - 3) == ',') StringSetCharacter(text, StringLen(text) - 3, '.'); @@ -4251,6 +4330,7 @@ void CPositionSizeCalculator::OnEndEditEdtAccount() void CPositionSizeCalculator::OnEndEditEdtRiskPIn() { string text = m_EdtRiskPIn.Text(); + m_EdtRiskPIn.PropFlags(0); // Reset the 'being edited' flag. StringReplace(text, ",", "."); // Replace comma with period for normal double conversion. double field_value = StringToDouble(text); sets.UseMoneyInsteadOfPercentage = false; @@ -4266,6 +4346,7 @@ void CPositionSizeCalculator::OnEndEditEdtRiskPIn() void CPositionSizeCalculator::OnEndEditEdtRiskMIn() { string text = m_EdtRiskMIn.Text(); + m_EdtRiskMIn.PropFlags(0); // Reset the 'being edited' flag. // Try to swap , for . in the "normal" decimal separator positions only. Other commas will be simply removed. if (StringGetCharacter(text, StringLen(text) - 2) == ',') StringSetCharacter(text, StringLen(text) - 2, '.'); if (StringGetCharacter(text, StringLen(text) - 3) == ',') StringSetCharacter(text, StringLen(text) - 3, '.'); @@ -4284,6 +4365,7 @@ void CPositionSizeCalculator::OnEndEditEdtRiskMIn() void CPositionSizeCalculator::OnEndEditEdtPosSize() { string text = m_EdtPosSize.Text(); + m_EdtPosSize.PropFlags(0); // Reset the 'being edited' flag. // Try to swap , for . in the "normal" decimal separator positions only. Other commas will be simply removed. if (StringGetCharacter(text, StringLen(text) - 2) == ',') StringSetCharacter(text, StringLen(text) - 2, '.'); if (StringGetCharacter(text, StringLen(text) - 3) == ',') StringSetCharacter(text, StringLen(text) - 3, '.'); @@ -4434,14 +4516,27 @@ void CPositionSizeCalculator::OnChangeChkIgnoreOrdersWithoutTP() } } -void CPositionSizeCalculator::OnChangeChkIgnoreOtherSymbols() +void CPositionSizeCalculator::OnClickBtnIgnoreSymbols() { - if (sets.IgnoreOtherSymbols != m_ChkIgnoreOtherSymbols.Checked()) + // Switch to the next value. + switch(sets.IgnoreSymbols) { - sets.IgnoreOtherSymbols = m_ChkIgnoreOtherSymbols.Checked(); - CalculatePortfolioRisk(); - DisplayValues(); + default: + case IGNORE_SYMBOLS_NONE: + sets.IgnoreSymbols = IGNORE_SYMBOLS_OTHER; + m_BtnIgnoreSymbols.Text(TRANSLATION_BUTTON_SYMBOLS_OTHER); + break; + case IGNORE_SYMBOLS_OTHER: + sets.IgnoreSymbols = IGNORE_SYMBOLS_CURRENT; + m_BtnIgnoreSymbols.Text(TRANSLATION_BUTTON_SYMBOLS_CURRENT); + break; + case IGNORE_SYMBOLS_CURRENT: + sets.IgnoreSymbols = IGNORE_SYMBOLS_NONE; + m_BtnIgnoreSymbols.Text(TRANSLATION_BUTTON_SYMBOLS_NO); + break; } + CalculatePortfolioRisk(); + DisplayValues(); } void CPositionSizeCalculator::OnEndEditEdtCustomLeverage() @@ -4453,6 +4548,7 @@ void CPositionSizeCalculator::OnEndEditEdtCustomLeverage() { CustomLeverage = sets.CustomLeverage; CustomLeverageDecimals = CountDecimalPlaces(CustomLeverage); + m_EdtCustomLeverage.Text(DoubleToString(sets.CustomLeverage, CustomLeverageDecimals)); RefreshValues(); } } @@ -4497,6 +4593,11 @@ void CPositionSizeCalculator::OnEndEditEdtMinEntrySLDistance() sets.MinEntrySLDistance = (int)StringToInteger(m_EdtMinEntrySLDistance.Text()); } +void CPositionSizeCalculator::OnEndEditEdtMaxRiskPercentage() +{ + sets.MaxRiskPercentage = (double)StringToDouble(m_EdtMaxRiskPercentage.Text()); +} + void CPositionSizeCalculator::OnEndEditEdtMaxPositionSizeTotal() { string s = m_EdtMaxPositionSizeTotal.Text(); @@ -4606,6 +4707,54 @@ void CPositionSizeCalculator::OnEndEditEdtExpiry() m_EdtExpiry.Text(IntegerToString(sets.ExpiryMinutes)); } +void CPositionSizeCalculator::OnClickEdtPosSize() // Clicking on an edit starts its editing process. +{ + m_EdtPosSize.PropFlags(1); // Edit is being edited, do not modify it anywhere else. +} + +void CPositionSizeCalculator::OnClickEdtEntryLevel() // Clicking on an edit starts its editing process. +{ + if (m_EdtEntryLevel.ReadOnly()) return; // Skip if the Edit is read-only. + m_EdtEntryLevel.PropFlags(1); // Edit is being edited, do not modify it anywhere else. +} + +void CPositionSizeCalculator::OnClickEdtSL() // Clicking on an edit starts its editing process. +{ + m_EdtSL.PropFlags(1); // Edit is being edited, do not modify it anywhere else. +} + +void CPositionSizeCalculator::OnClickEdtTP() // Clicking on an edit starts its editing process. +{ + m_EdtTP.PropFlags(1); // Edit is being edited, do not modify it anywhere else. +} + +void CPositionSizeCalculator::OnClickEdtAccount() // Clicking on an edit starts its editing process. +{ + if (m_EdtAccount.ReadOnly()) return; // Skip if the Edit is read-only. + m_EdtAccount.PropFlags(1); // Edit is being edited, do not modify it anywhere else. +} + +void CPositionSizeCalculator::OnClickEdtRiskPIn() // Clicking on an edit starts its editing process. +{ + m_EdtRiskPIn.PropFlags(1); // Edit is being edited, do not modify it anywhere else. +} + +void CPositionSizeCalculator::OnClickEdtRiskMIn() // Clicking on an edit starts its editing process. +{ + m_EdtRiskMIn.PropFlags(1); // Edit is being edited, do not modify it anywhere else. +} + +void CPositionSizeCalculator::OnClickAdditionalTPEdit(int i) // Clicking on an edit starts its editing process. +{ + AdditionalTPEdits[i - 1].PropFlags(1); // Edit is being edited, do not modify it anywhere else. +} + +void CPositionSizeCalculator::OnClickEdtTradingTPEdit1() // Clicking on an edit starts its editing process. +{ + // Only for the main TP: + TradingTPEdits[0].PropFlags(1); // Edit is being edited, do not modify it anywhere else. +} + //+-----------------------+ //| Working with settings | //|+----------------------+ @@ -4668,8 +4817,8 @@ bool CPositionSizeCalculator::SaveSettingsOnDisk(string symbol = "") FileWrite(fh, IntegerToString(sets.IgnoreOrdersWithoutSL)); FileWrite(fh, "IgnoreOrdersWithoutTP"); FileWrite(fh, IntegerToString(sets.IgnoreOrdersWithoutTP)); - FileWrite(fh, "IgnoreOtherSymbols"); - FileWrite(fh, IntegerToString(sets.IgnoreOtherSymbols)); + FileWrite(fh, "IgnoreSymbols"); + FileWrite(fh, IntegerToString(sets.IgnoreSymbols)); FileWrite(fh, "ShowLines"); FileWrite(fh, IntegerToString(sets.ShowLines)); FileWrite(fh, "SelectedTab"); @@ -4701,6 +4850,8 @@ bool CPositionSizeCalculator::SaveSettingsOnDisk(string symbol = "") FileWrite(fh, IntegerToString(sets.MaxEntrySLDistance)); FileWrite(fh, "MinEntrySLDistance"); FileWrite(fh, IntegerToString(sets.MinEntrySLDistance)); + FileWrite(fh, "MaxRiskPercentage"); + FileWrite(fh, DoubleToString(sets.MaxRiskPercentage)); FileWrite(fh, "SLDistanceInPoints"); FileWrite(fh, IntegerToString(sets.SLDistanceInPoints)); FileWrite(fh, "TPDistanceInPoints"); @@ -4827,8 +4978,8 @@ bool CPositionSizeCalculator::SaveSettingsOnDisk(string symbol = "") FileWrite(fh, IntegerToString(DefaultIgnoreOrdersWithoutSL)); FileWrite(fh, "Parameter_DefaultIgnoreOrdersWithoutTP"); FileWrite(fh, IntegerToString(DefaultIgnoreOrdersWithoutTP)); - FileWrite(fh, "Parameter_DefaultIgnoreOtherSymbols"); - FileWrite(fh, IntegerToString(DefaultIgnoreOtherSymbols)); + FileWrite(fh, "Parameter_DefaultIgnoreSymbols"); + FileWrite(fh, IntegerToString(DefaultIgnoreSymbols)); FileWrite(fh, "Parameter_DefaultCustomLeverage"); FileWrite(fh, DoubleToString(DefaultCustomLeverage)); FileWrite(fh, "Parameter_DefaultMagicNumber"); @@ -4847,6 +4998,8 @@ bool CPositionSizeCalculator::SaveSettingsOnDisk(string symbol = "") FileWrite(fh, IntegerToString(DefaultMaxEntrySLDistance)); FileWrite(fh, "Parameter_DefaultMinEntrySLDistance"); FileWrite(fh, IntegerToString(DefaultMinEntrySLDistance)); + FileWrite(fh, "Parameter_DefaultMaxRiskPercentage"); + FileWrite(fh, DoubleToString(DefaultMaxRiskPercentage)); FileWrite(fh, "Parameter_DefaultMaxPositionSizeTotal"); FileWrite(fh, DoubleToString(DefaultMaxPositionSizeTotal, LotStep_digits)); FileWrite(fh, "Parameter_DefaultMaxPositionSizePerSymbol"); @@ -4988,8 +5141,8 @@ bool CPositionSizeCalculator::LoadSettingsFromDisk() sets.IgnoreOrdersWithoutSL = (bool)StringToInteger(var_content); else if (var_name == "IgnoreOrdersWithoutTP") sets.IgnoreOrdersWithoutTP = (bool)StringToInteger(var_content); - else if (var_name == "IgnoreOtherSymbols") - sets.IgnoreOtherSymbols = (bool)StringToInteger(var_content); + else if (var_name == "IgnoreSymbols") + sets.IgnoreSymbols = (IGNORE_SYMBOLS)StringToInteger(var_content); else if (var_name == "ShowLines") sets.ShowLines = (bool)StringToInteger(var_content); else if (var_name == "SelectedTab") @@ -5046,6 +5199,8 @@ bool CPositionSizeCalculator::LoadSettingsFromDisk() sets.MaxEntrySLDistance = (int)StringToInteger(var_content); else if (var_name == "MinEntrySLDistance") sets.MinEntrySLDistance = (int)StringToInteger(var_content); + else if (var_name == "MaxRiskPercentage") + sets.MaxRiskPercentage = StringToDouble(var_content); else if (var_name == "TradeDirection") sets.TradeDirection = (TRADE_DIRECTION)StringToInteger(var_content); else if (var_name == "SLDistanceInPoints") @@ -5220,9 +5375,9 @@ bool CPositionSizeCalculator::LoadSettingsFromDisk() { if ((bool)StringToInteger(var_content) != DefaultIgnoreOrdersWithoutTP) sets.IgnoreOrdersWithoutTP = DefaultIgnoreOrdersWithoutTP; } - else if (var_name == "Parameter_DefaultIgnoreOtherSymbols") + else if (var_name == "Parameter_DefaultIgnoreSymbols") { - if ((bool)StringToInteger(var_content) != DefaultIgnoreOtherSymbols) sets.IgnoreOtherSymbols = DefaultIgnoreOtherSymbols; + if ((IGNORE_SYMBOLS)StringToInteger(var_content) != DefaultIgnoreSymbols) sets.IgnoreSymbols = DefaultIgnoreSymbols; } else if (var_name == "Parameter_DefaultCustomLeverage") { @@ -5260,6 +5415,10 @@ bool CPositionSizeCalculator::LoadSettingsFromDisk() { if (StringToInteger(var_content) != DefaultMinEntrySLDistance) sets.MinEntrySLDistance = DefaultMinEntrySLDistance; } + else if (var_name == "Parameter_DefaultMaxRiskPercentage") + { + if (StringToDouble(var_content) != DefaultMaxRiskPercentage) sets.MaxRiskPercentage = DefaultMaxRiskPercentage; + } else if (var_name == "Parameter_DefaultMaxPositionSizeTotal") { if (StringToDouble(var_content) != DefaultMaxPositionSizeTotal) sets.MaxPositionSizeTotal = DefaultMaxPositionSizeTotal; @@ -5423,7 +5582,10 @@ void CPositionSizeCalculator::HideShowMaximize() remember_left = Left(); remember_top = Top(); +// A weird fix for a weird bug. The TP line will get deselected by CWndContainer::Hide(). +bool tp_line_selected = ObjectGetInteger(ChartID(), ObjectPrefix + "TakeProfitLine", OBJPROP_SELECTED); Hide(); +ObjectSetInteger(ChartID(), ObjectPrefix + "TakeProfitLine", OBJPROP_SELECTED, tp_line_selected); Show(); NoPanelMaximization = true; Maximize(); @@ -5537,6 +5699,7 @@ void CPositionSizeCalculator::UpdateAdditionalFixedTP(int i) void CPositionSizeCalculator::UpdateTradingTPEdit(int i) { string s = TradingTPEdits[i].Text(); + if (i == 0) TradingTPEdits[0].PropFlags(0); // Reset the 'being edited' flag. StringReplace(s, ",", "."); // Replace comma with period for normal double conversion. // First, do the formatting. double new_value = StringToDouble(s); @@ -5587,6 +5750,7 @@ void CPositionSizeCalculator::UpdateTradingTPEdit(int i) void CPositionSizeCalculator::UpdateAdditionalTPEdit(int i) { string s = AdditionalTPEdits[i - 1].Text(); + AdditionalTPEdits[i - 1].PropFlags(0); // Reset the 'being edited' flag. StringReplace(s, ",", "."); // Replace comma with period for normal double conversion. // First, do the formatting. double new_value = StringToDouble(s); @@ -5741,7 +5905,7 @@ void CPositionSizeCalculator::CheckAndRestoreLines() ObjectSetInteger(ChartID(), ObjectPrefix + "EntryLine", OBJPROP_STYLE, entry_line_style); ObjectSetInteger(ChartID(), ObjectPrefix + "EntryLine", OBJPROP_COLOR, entry_line_color); ObjectSetInteger(ChartID(), ObjectPrefix + "EntryLine", OBJPROP_WIDTH, entry_line_width); - ObjectSetString(ChartID(), ObjectPrefix + "EntryLine", OBJPROP_TOOLTIP, "Entry"); + ObjectSetString(ChartID(), ObjectPrefix + "EntryLine", OBJPROP_TOOLTIP, TRANSLATION_LABEL_ENTRY); if (sets.EntryType == Instant) { ObjectSetInteger(ChartID(), ObjectPrefix + "EntryLine", OBJPROP_SELECTABLE, false); @@ -5929,7 +6093,7 @@ void Initialization() { if (sets.TradeDirection == Long) { - if (sets.EntryLevel == 0) sets.EntryLevel = SymbolInfoDouble(Symbol(), SYMBOL_ASK); + if (sets.EntryLevel == 0) sets.EntryLevel = SymbolInfoDouble(SymbolForTrading, SYMBOL_ASK); if (DefaultSL > 0) sets.StopLossLevel = sets.EntryLevel - DefaultSL * _Point; else sets.StopLossLevel = iLow(Symbol(), Period(), 0); if (sets.StopLossLevel == 0) sets.StopLossLevel = sets.EntryLevel - _Point; @@ -5943,7 +6107,7 @@ void Initialization() } else { - if (sets.EntryLevel == 0) sets.EntryLevel = SymbolInfoDouble(Symbol(), SYMBOL_BID); + if (sets.EntryLevel == 0) sets.EntryLevel = SymbolInfoDouble(SymbolForTrading, SYMBOL_BID); if (DefaultSL > 0) sets.StopLossLevel = sets.EntryLevel + DefaultSL * _Point; else sets.StopLossLevel = iHigh(Symbol(), Period(), 0); if (sets.StopLossLevel == 0) sets.StopLossLevel = sets.EntryLevel + _Point; @@ -5980,13 +6144,12 @@ void Initialization() if (sets.EntryLevel - sets.StopLossLevel == 0) { Print(TRANSLATION_MESSAGE_ENTRY_SL_DIFFERENT_NON_ZERO); -// return; } if (sets.EntryType == Instant) { - double Ask = SymbolInfoDouble(_Symbol, SYMBOL_ASK); - double Bid = SymbolInfoDouble(_Symbol, SYMBOL_BID); + double Ask = SymbolInfoDouble(SymbolForTrading, SYMBOL_ASK); + double Bid = SymbolInfoDouble(SymbolForTrading, SYMBOL_BID); if ((Ask > 0) && (Bid > 0)) { // SL got inside Ask/Bid range. @@ -6332,7 +6495,6 @@ void Initialization() } sets.TemplateChanged = false; } - ChartRedraw(); } @@ -6347,31 +6509,28 @@ void RecalculatePositionSize() double Ask, Bid; // If could not find account currency, probably not connected. Also check for symbol availability. - if ((AccountInfoString(ACCOUNT_CURRENCY) == "") || (!TerminalInfoInteger(TERMINAL_CONNECTED) || (!SymbolInfoInteger(Symbol(), SYMBOL_SELECT)))) return; + if ((AccountInfoString(ACCOUNT_CURRENCY) == "") || (!TerminalInfoInteger(TERMINAL_CONNECTED)) || (!SymbolInfoInteger(Symbol(), SYMBOL_SELECT)) || (!SymbolInfoInteger(SymbolForTrading, SYMBOL_SELECT))) return; else if ((TickSize == -1) || (TickValue == 0)) { GetSymbolAndAccountData(); } - Bid = SymbolInfoDouble(_Symbol, SYMBOL_BID); - Ask = SymbolInfoDouble(_Symbol, SYMBOL_ASK); + Bid = SymbolInfoDouble(SymbolForTrading, SYMBOL_BID); + Ask = SymbolInfoDouble(SymbolForTrading, SYMBOL_ASK); - double read_tEntryLevel, read_tStopLossLevel, read_tTakeProfitLevel, read_tStopPriceLevel; + double read_tEntryLevel, read_tStopLossLevel, /*read_tTakeProfitLevel,*/ read_tStopPriceLevel; if (!ObjectGetDouble(ChartID(), ObjectPrefix + "EntryLine", OBJPROP_PRICE, 0, read_tEntryLevel)) return; // Line was deleted, waiting for automatic restoration. tEntryLevel = Round(read_tEntryLevel, _Digits); if (!ObjectGetDouble(ChartID(), ObjectPrefix + "StopLossLine", OBJPROP_PRICE, 0, read_tStopLossLevel)) return; tStopLossLevel = Round(read_tStopLossLevel, _Digits); - if (ObjectGetDouble(ChartID(), ObjectPrefix + "TakeProfitLine", OBJPROP_PRICE, 0, read_tTakeProfitLevel)) tTakeProfitLevel = Round(read_tTakeProfitLevel, _Digits); - else tTakeProfitLevel = 0; if (!DisableStopLimit) { if (!ObjectGetDouble(ChartID(), ObjectPrefix + "StopPriceLine", OBJPROP_PRICE, 0, read_tStopPriceLevel)) return; tStopPriceLevel = Round(read_tStopPriceLevel, _Digits); } - double StopLevel = SymbolInfoInteger(Symbol(), SYMBOL_TRADE_STOPS_LEVEL) * _Point; + double StopLevel = SymbolInfoInteger(SymbolForTrading, SYMBOL_TRADE_STOPS_LEVEL) * _Point; WarningEntry = ""; WarningSL = ""; - WarningTP = ""; WarningSP = ""; double AskBid = 0; if (sets.EntryType == Instant) @@ -6417,22 +6576,6 @@ void RecalculatePositionSize() } if (MathAbs(tStopLossLevel - tEntryLevel) < StopLevel) WarningSL = " " + TRANSLATION_LABEL_WARNING_TOO_CLOSE; - if (tTakeProfitLevel > 0) - { - if (MathAbs(tTakeProfitLevel - tEntryLevel) < StopLevel) WarningTP = " " + TRANSLATION_LABEL_WARNING_TOO_CLOSE; - } - - double add_tTakeProfitLevel[]; - ArrayResize(add_tTakeProfitLevel, sets.TakeProfitsNumber - 1); - for (int i = 1; i < sets.TakeProfitsNumber; i++) - { - if (!ObjectGetDouble(ChartID(), ObjectPrefix + "TakeProfitLine" + IntegerToString(i), OBJPROP_PRICE, 0, add_tTakeProfitLevel[i - 1])) return; - add_tTakeProfitLevel[i - 1] = Round(add_tTakeProfitLevel[i - 1], _Digits); - if (add_tTakeProfitLevel[i - 1] > 0) - { - if (MathAbs(add_tTakeProfitLevel[i - 1] - tEntryLevel) < StopLevel) AdditionalWarningTP[i - 1] = " " + TRANSLATION_LABEL_WARNING_TOO_CLOSE; - } - } StopLoss = MathAbs(tEntryLevel - tStopLossLevel); @@ -6456,13 +6599,24 @@ void RecalculatePositionSize() sets.EntryLevel = tEntryLevel; sets.StopLossLevel = tStopLossLevel; - sets.TakeProfitLevel = tTakeProfitLevel; sets.StopPriceLevel = tStopPriceLevel; - for (int i = 1; i < sets.TakeProfitsNumber; i++) sets.TP[i] = add_tTakeProfitLevel[i - 1]; -//!!!! if (StopLoss != 0) CalculateRiskAndPositionSize(); + double add_tTakeProfitLevel[]; + ArrayResize(add_tTakeProfitLevel, sets.TakeProfitsNumber - 1); + for (int i = 1; i < sets.TakeProfitsNumber; i++) + { + if (!ObjectGetDouble(ChartID(), ObjectPrefix + "TakeProfitLine" + IntegerToString(i), OBJPROP_PRICE, 0, add_tTakeProfitLevel[i - 1])) return; + add_tTakeProfitLevel[i - 1] = Round(add_tTakeProfitLevel[i - 1], _Digits); + if (add_tTakeProfitLevel[i - 1] > 0) + { + if (MathAbs(add_tTakeProfitLevel[i - 1] - tEntryLevel) < StopLevel) AdditionalWarningTP[i - 1] = " " + TRANSLATION_LABEL_WARNING_TOO_CLOSE; + } + } + sets.TakeProfitLevel = tTakeProfitLevel; + for (int i = 1; i < sets.TakeProfitsNumber; i++) sets.TP[i] = add_tTakeProfitLevel[i - 1]; + if (ShowLineLabels) { DrawLineLabel(ObjectPrefix + "StopLossLabel", IntegerToString((int)MathRound((MathAbs(tStopLossLevel - tEntryLevel) / _Point))), tStopLossLevel, sl_label_font_color); @@ -6574,38 +6728,38 @@ void RecalculatePositionSize() //+------------------------------------------------------------------+ void GetSymbolAndAccountData() { - TickSize = SymbolInfoDouble(Symbol(), SYMBOL_TRADE_TICK_SIZE); - MinLot = SymbolInfoDouble(Symbol(), SYMBOL_VOLUME_MIN); - MaxLot = SymbolInfoDouble(Symbol(), SYMBOL_VOLUME_MAX); - LotStep = SymbolInfoDouble(Symbol(), SYMBOL_VOLUME_STEP); + TickSize = SymbolInfoDouble(SymbolForTrading, SYMBOL_TRADE_TICK_SIZE); + MinLot = SymbolInfoDouble(SymbolForTrading, SYMBOL_VOLUME_MIN); + MaxLot = SymbolInfoDouble(SymbolForTrading, SYMBOL_VOLUME_MAX); + LotStep = SymbolInfoDouble(SymbolForTrading, SYMBOL_VOLUME_STEP); if (!CalculateUnadjustedPositionSize) LotStep_digits = CountDecimalPlaces(LotStep); else LotStep_digits = 8; - ContractSize = SymbolInfoDouble(Symbol(), SYMBOL_TRADE_CONTRACT_SIZE); - CalcMode = (ENUM_SYMBOL_CALC_MODE)SymbolInfoInteger(Symbol(), SYMBOL_TRADE_CALC_MODE); + ContractSize = SymbolInfoDouble(SymbolForTrading, SYMBOL_TRADE_CONTRACT_SIZE); + CalcMode = (ENUM_SYMBOL_CALC_MODE)SymbolInfoInteger(SymbolForTrading, SYMBOL_TRADE_CALC_MODE); AccountMarginMode = (ENUM_ACCOUNT_MARGIN_MODE)AccountInfoInteger(ACCOUNT_MARGIN_MODE); - MarginHedging = SymbolInfoDouble(Symbol(), SYMBOL_MARGIN_HEDGED); + MarginHedging = SymbolInfoDouble(SymbolForTrading, SYMBOL_MARGIN_HEDGED); AccountCurrency = AccountInfoString(ACCOUNT_CURRENCY); AccountCurrencyDigits = (int)AccountInfoInteger(ACCOUNT_CURRENCY_DIGITS); // A rough patch for cases when account currency is set as RUR instead of RUB. if (AccountCurrency == "RUR") AccountCurrency = "RUB"; - MarginCurrency = SymbolInfoString(Symbol(), SYMBOL_CURRENCY_MARGIN); + MarginCurrency = SymbolInfoString(SymbolForTrading, SYMBOL_CURRENCY_MARGIN); if (MarginCurrency == "RUR") MarginCurrency = "RUB"; - ProfitCurrency = SymbolInfoString(Symbol(), SYMBOL_CURRENCY_PROFIT); + ProfitCurrency = SymbolInfoString(SymbolForTrading, SYMBOL_CURRENCY_PROFIT); if (ProfitCurrency == "RUR") ProfitCurrency = "RUB"; - BaseCurrency = SymbolInfoString(Symbol(), SYMBOL_CURRENCY_BASE); + BaseCurrency = SymbolInfoString(SymbolForTrading, SYMBOL_CURRENCY_BASE); if (BaseCurrency == "RUR") BaseCurrency = "RUB"; AccStopoutMode = AccountInfoInteger(ACCOUNT_MARGIN_SO_MODE); AccStopoutLevel = AccountInfoDouble(ACCOUNT_MARGIN_SO_SO); - TickValue = SymbolInfoDouble(Symbol(), SYMBOL_TRADE_TICK_VALUE); + TickValue = SymbolInfoDouble(SymbolForTrading, SYMBOL_TRADE_TICK_VALUE); - InitialMargin = SymbolInfoDouble(Symbol(), SYMBOL_MARGIN_INITIAL); - MaintenanceMargin = SymbolInfoDouble(Symbol(), SYMBOL_MARGIN_MAINTENANCE); + InitialMargin = SymbolInfoDouble(SymbolForTrading, SYMBOL_MARGIN_INITIAL); + MaintenanceMargin = SymbolInfoDouble(SymbolForTrading, SYMBOL_MARGIN_MAINTENANCE); if (MaintenanceMargin == 0) MaintenanceMargin = InitialMargin; - SwapsTripleDay = WeekdayToString((int)SymbolInfoInteger(Symbol(), SYMBOL_SWAP_ROLLOVER3DAYS)); + SwapsTripleDay = WeekdayToString((int)SymbolInfoInteger(SymbolForTrading, SYMBOL_SWAP_ROLLOVER3DAYS)); } //+------------------------------------------------------------------+ @@ -6622,12 +6776,14 @@ void CalculateRiskAndPositionSize() if (!sets.UseMoneyInsteadOfPercentage) { RiskMoney = Round(AccSize * sets.Risk / 100, AccountCurrencyDigits, RoundDown); + sets.MoneyRisk = RiskMoney; } else { RiskMoney = sets.MoneyRisk; if (AccSize != 0) DisplayRisk = Round(sets.MoneyRisk / AccSize * 100, 2); else DisplayRisk = 0; + sets.Risk = DisplayRisk; } CalculateUnitCost(UnitCost, UnitCost_reward); @@ -6651,11 +6807,11 @@ void CalculateRiskAndPositionSize() double current_rate = 1; if (tStopLossLevel < tEntryLevel) { - current_rate = SymbolInfoDouble(_Symbol, SYMBOL_ASK); + current_rate = SymbolInfoDouble(SymbolForTrading, SYMBOL_ASK); } else if (tStopLossLevel > tEntryLevel) { - current_rate = SymbolInfoDouble(_Symbol, SYMBOL_BID); + current_rate = SymbolInfoDouble(SymbolForTrading, SYMBOL_BID); } UnitCost *= (current_rate / future_rate); } @@ -6668,7 +6824,8 @@ void CalculateRiskAndPositionSize() sets.MoneyRisk = RiskMoney; if (AccSize != 0) DisplayRisk = Round(sets.MoneyRisk / AccSize * 100, 2); else DisplayRisk = 0; - PositionSize = OutputPositionSize; + sets.Risk = DisplayRisk; + PositionSize = OutputPositionSize; } else { @@ -6679,12 +6836,9 @@ void CalculateRiskAndPositionSize() if (!CalculateUnadjustedPositionSize) // If need to adjust to broker's restrictions. { - if (PositionSize < MinLot) OutputPositionSize = MinLot; - else if ((PositionSize > MaxLot) && (!SurpassBrokerMaxPositionSize)) OutputPositionSize = MaxLot; - double steps = OutputPositionSize / LotStep; - if (MathAbs(MathRound(steps) - steps) < 0.00000001) steps = MathRound(steps); - if (MathFloor(steps) < steps) OutputPositionSize = MathFloor(steps) * LotStep; + OutputPositionSize = AdjustPositionSizeByMinMaxStep(OutputPositionSize); } + if ((CapMaxPositionSizeBasedOnMargin) && (OutputPositionSize > OutputMaxPositionSize)) OutputPositionSize = OutputMaxPositionSize; // Cap with max position size by free margin if necessary. if (TickSize == 0) return; OutputRiskMoney = Round((StopLoss * UnitCost / TickSize + 2 * commission) * OutputPositionSize, AccountCurrencyDigits); @@ -6699,6 +6853,23 @@ void CalculateRiskAndPositionSize() // Calculate adjusted position size shares for use here and in RecalculatePositionSize(). PositionSizeToArray(OutputPositionSize); // Fills ArrayPositionSize[]. + if (sets.TPLockedOnSL) + { + tEntryLevel = sets.EntryLevel; + tStopLossLevel = sets.StopLossLevel; + if (sets.TakeProfitLevel == 0) ExtDialog.ProcessTPChange(true); // When TPLockedOnSL has been enabled via an input parameter. + else ExtDialog.ProcessTPChange(false); + } + double read_tTakeProfitLevel; + if (ObjectGetDouble(ChartID(), ObjectPrefix + "TakeProfitLine", OBJPROP_PRICE, 0, read_tTakeProfitLevel)) tTakeProfitLevel = Round(read_tTakeProfitLevel, _Digits); + else tTakeProfitLevel = 0; + WarningTP = ""; + if (tTakeProfitLevel > 0) + { + double StopLevel = SymbolInfoInteger(SymbolForTrading, SYMBOL_TRADE_STOPS_LEVEL) * _Point; + if (MathAbs(tTakeProfitLevel - tEntryLevel) < StopLevel) WarningTP = " " + TRANSLATION_LABEL_WARNING_TOO_CLOSE; + } + if (tTakeProfitLevel > 0) { // If account currency == pair's base currency, adjust UnitCost to future rate (TP). Works only for Forex pairs. @@ -6708,11 +6879,11 @@ void CalculateRiskAndPositionSize() double current_rate = 1; if (tStopLossLevel < tEntryLevel) { - current_rate = SymbolInfoDouble(_Symbol, SYMBOL_ASK); + current_rate = SymbolInfoDouble(SymbolForTrading, SYMBOL_ASK); } else if (tStopLossLevel > tEntryLevel) { - current_rate = SymbolInfoDouble(_Symbol, SYMBOL_BID); + current_rate = SymbolInfoDouble(SymbolForTrading, SYMBOL_BID); } UnitCost_reward *= (current_rate / future_rate); } @@ -6757,11 +6928,11 @@ void CalculateRiskAndPositionSize() double current_rate = 1; if (tStopLossLevel < tEntryLevel) { - current_rate = SymbolInfoDouble(_Symbol, SYMBOL_ASK); + current_rate = SymbolInfoDouble(SymbolForTrading, SYMBOL_ASK); } else if (tStopLossLevel > tEntryLevel) { - current_rate = SymbolInfoDouble(_Symbol, SYMBOL_BID); + current_rate = SymbolInfoDouble(SymbolForTrading, SYMBOL_BID); } UnitCost_reward *= (current_rate / future_rate); } @@ -6866,9 +7037,10 @@ void CalculatePortfolioRisk(const CALCULATE_RISK_FOR_TRADING_TAB calculate_risk_ // Skip orders in other symbols if the ignore checkbox is ticked. if (!calculate_risk_for_trading_tab) { - if ((OrderGetString(ORDER_SYMBOL) != Symbol()) && (sets.IgnoreOtherSymbols)) continue; + if ((OrderGetString(ORDER_SYMBOL) != SymbolForTrading) && (sets.IgnoreSymbols == IGNORE_SYMBOLS_OTHER)) continue; + else if ((OrderGetString(ORDER_SYMBOL) == SymbolForTrading) && (sets.IgnoreSymbols == IGNORE_SYMBOLS_CURRENT)) continue; } - else if ((OrderGetString(ORDER_SYMBOL) != Symbol()) && (calculate_risk_for_trading_tab == CALCULATE_RISK_FOR_TRADING_TAB_PER_SYMBOL)) continue; + else if ((OrderGetString(ORDER_SYMBOL) != SymbolForTrading) && (calculate_risk_for_trading_tab == CALCULATE_RISK_FOR_TRADING_TAB_PER_SYMBOL)) continue; // Buy orders. if ((OrderGetInteger(ORDER_TYPE) == ORDER_TYPE_BUY_LIMIT) || (OrderGetInteger(ORDER_TYPE) == ORDER_TYPE_BUY_STOP)) @@ -7045,9 +7217,10 @@ void CalculatePortfolioRisk(const CALCULATE_RISK_FOR_TRADING_TAB calculate_risk_ // Skip orders in other symbols if the ignore checkbox is ticked. if (!calculate_risk_for_trading_tab) { - if ((PositionGetString(POSITION_SYMBOL) != Symbol()) && (sets.IgnoreOtherSymbols)) continue; + if ((PositionGetString(POSITION_SYMBOL) != SymbolForTrading) && (sets.IgnoreSymbols == IGNORE_SYMBOLS_OTHER)) continue; + else if ((PositionGetString(POSITION_SYMBOL) == SymbolForTrading) && (sets.IgnoreSymbols == IGNORE_SYMBOLS_CURRENT)) continue; } - else if ((PositionGetString(POSITION_SYMBOL) != Symbol()) && (calculate_risk_for_trading_tab == CALCULATE_RISK_FOR_TRADING_TAB_PER_SYMBOL)) continue; + else if ((PositionGetString(POSITION_SYMBOL) != SymbolForTrading) && (calculate_risk_for_trading_tab == CALCULATE_RISK_FOR_TRADING_TAB_PER_SYMBOL)) continue; // Buy position. if (PositionGetInteger(POSITION_TYPE) == POSITION_TYPE_BUY) @@ -7260,7 +7433,7 @@ void CalculateMargin() if (TickValue == 0) return; double initial_margin_rate = 0, maintenance_margin_rate = 0, max_margin_rate = 0; - SymbolInfoMarginRate(Symbol(), OrderType, initial_margin_rate, maintenance_margin_rate); + SymbolInfoMarginRate(SymbolForTrading, OrderType, initial_margin_rate, maintenance_margin_rate); if (maintenance_margin_rate == 0) maintenance_margin_rate = initial_margin_rate; PositionMargin = 0; @@ -7289,7 +7462,7 @@ void CalculateMargin() (CalcMode == SYMBOL_CALC_MODE_EXCH_STOCKS) || (CalcMode == SYMBOL_CALC_MODE_CFDLEVERAGE)) { MqlTick tick; - SymbolInfoTick(Symbol(), tick); + SymbolInfoTick(SymbolForTrading, tick); if (PositionDirection == POSITION_TYPE_BUY) PriceCorrectionCoefficient = tick.ask; else if (PositionDirection == POSITION_TYPE_SELL) PriceCorrectionCoefficient = tick.bid; } @@ -7299,7 +7472,7 @@ void CalculateMargin() PositionMargin = (OutputPositionSize * ContractSize * PriceCorrectionCoefficient / Leverage) * maintenance_margin_rate; // Otherwise, no need to adjust margin. - if (AccountCurrency != MarginCurrency) CurrencyCorrectionCoefficient = CalculateAdjustment(Loss, MarginCurrency, AccountCurrency, Symbol()); + if (AccountCurrency != MarginCurrency) CurrencyCorrectionCoefficient = CalculateAdjustment(Loss, MarginCurrency, AccountCurrency, SymbolForTrading); if (CurrencyCorrectionCoefficient == 0) // Couldn't calculate correction coefficient due to the lack of the required currency pair. { CurrencyCorrectionCoefficient = 1; @@ -7334,7 +7507,7 @@ void CalculateMargin() // Netting: if (AccountMarginMode != ACCOUNT_MARGIN_MODE_RETAIL_HEDGING) { - if ((PositionSelect(Symbol())) && (PositionGetInteger(POSITION_TYPE) != PositionDirection)) + if ((PositionSelect(SymbolForTrading)) && (PositionGetInteger(POSITION_TYPE) != PositionDirection)) { double existing_open_price = 1; double existing_volume = PositionGetDouble(POSITION_VOLUME); @@ -7352,7 +7525,7 @@ void CalculateMargin() if (AccountCurrency != MarginCurrency) { MqlTick tick; - SymbolInfoTick(Symbol(), tick); + SymbolInfoTick(SymbolForTrading, tick); // This yields inaccurate margin of existing position, but it is the best we can get so far. CurrencyCorrectionCoefficient_existing = (tick.bid != 0) ? (1 / tick.bid) : -1; } @@ -7412,7 +7585,7 @@ void CalculateMargin() { if (!PositionSelectByTicket(PositionGetTicket(i))) continue; - if (PositionGetString(POSITION_SYMBOL) != Symbol()) continue; + if (PositionGetString(POSITION_SYMBOL) != SymbolForTrading) continue; if (PositionGetInteger(POSITION_TYPE) == POSITION_TYPE_BUY) { @@ -7516,12 +7689,7 @@ void CalculateMargin() OutputMaxPositionSize = MaxPositionSizeByMargin; if (!CalculateUnadjustedPositionSize) // If need to adjust to broker's restrictions. { - if (MaxPositionSizeByMargin < MinLot) OutputMaxPositionSize = 0; // Cannot open any position at all. - else if ((MaxPositionSizeByMargin > MaxLot) && (!SurpassBrokerMaxPositionSize)) OutputMaxPositionSize = MaxLot; - double steps = 0; - if (LotStep != 0) steps = OutputMaxPositionSize / LotStep; - if (MathAbs(MathRound(steps) - steps) < 0.00000001) steps = MathRound(steps); - if (MathFloor(steps) < steps) OutputMaxPositionSize = MathFloor(steps) * LotStep; + OutputMaxPositionSize = AdjustPositionSizeByMinMaxStep(MaxPositionSizeByMargin); } // End Max position size. @@ -7687,9 +7855,9 @@ string GetSymbolByCurrencies(string base_currency, string profit_currency) //+------------------------------------------------------------------+ void GetSwapData() { - ENUM_SYMBOL_SWAP_MODE swap_mode = (ENUM_SYMBOL_SWAP_MODE)SymbolInfoInteger(Symbol(), SYMBOL_SWAP_MODE); - double swap_long = SymbolInfoDouble(Symbol(), SYMBOL_SWAP_LONG); - double swap_short = SymbolInfoDouble(Symbol(), SYMBOL_SWAP_SHORT); + ENUM_SYMBOL_SWAP_MODE swap_mode = (ENUM_SYMBOL_SWAP_MODE)SymbolInfoInteger(SymbolForTrading, SYMBOL_SWAP_MODE); + double swap_long = SymbolInfoDouble(SymbolForTrading, SYMBOL_SWAP_LONG); + double swap_short = SymbolInfoDouble(SymbolForTrading, SYMBOL_SWAP_SHORT); double swap_long_1_lot = EMPTY_VALUE, swap_short_1_lot = EMPTY_VALUE; switch(swap_mode) { @@ -7706,10 +7874,10 @@ void GetSwapData() double UnitCost_long, UnitCost_short; - if (swap_long > 0) UnitCost_long = SymbolInfoDouble(Symbol(), SYMBOL_TRADE_TICK_VALUE_PROFIT); - else UnitCost_long = SymbolInfoDouble(Symbol(), SYMBOL_TRADE_TICK_VALUE_LOSS); - if (swap_short > 0) UnitCost_short = SymbolInfoDouble(Symbol(), SYMBOL_TRADE_TICK_VALUE_PROFIT); - else UnitCost_short = SymbolInfoDouble(Symbol(), SYMBOL_TRADE_TICK_VALUE_LOSS); + if (swap_long > 0) UnitCost_long = SymbolInfoDouble(SymbolForTrading, SYMBOL_TRADE_TICK_VALUE_PROFIT); + else UnitCost_long = SymbolInfoDouble(SymbolForTrading, SYMBOL_TRADE_TICK_VALUE_LOSS); + if (swap_short > 0) UnitCost_short = SymbolInfoDouble(SymbolForTrading, SYMBOL_TRADE_TICK_VALUE_PROFIT); + else UnitCost_short = SymbolInfoDouble(SymbolForTrading, SYMBOL_TRADE_TICK_VALUE_LOSS); if ((ProfitCurrency != AccountCurrency) && (CalcMode != SYMBOL_CALC_MODE_FOREX) && (CalcMode != SYMBOL_CALC_MODE_FOREX_NO_LEVERAGE)) { @@ -7731,12 +7899,12 @@ void GetSwapData() string base_or_margin_currency; if (swap_mode == SYMBOL_SWAP_MODE_CURRENCY_SYMBOL) { - base_or_margin_currency = SymbolInfoString(Symbol(), SYMBOL_CURRENCY_BASE); + base_or_margin_currency = SymbolInfoString(SymbolForTrading, SYMBOL_CURRENCY_BASE); OutputSwapsType = TRANSLATION_LABEL_BASE_CURRENCY + " (" + base_or_margin_currency + ")"; } else { - base_or_margin_currency = SymbolInfoString(Symbol(), SYMBOL_CURRENCY_MARGIN); + base_or_margin_currency = SymbolInfoString(SymbolForTrading, SYMBOL_CURRENCY_MARGIN); OutputSwapsType = TRANSLATION_LABEL_MARGIN_CURRENCY + " (" + base_or_margin_currency + ")"; } // Simple case: @@ -7751,14 +7919,14 @@ void GetSwapData() // Simple case - use Symbol rates for conversion: if (AccountCurrency == ProfitCurrency) { - double bid = SymbolInfoDouble(Symbol(), SYMBOL_BID); + double bid = SymbolInfoDouble(SymbolForTrading, SYMBOL_BID); swap_long_1_lot = swap_long * bid; swap_short_1_lot = swap_short * bid; } // Go through Market Watch trying to find the currency pair with both base_currency and account_currency in it. else { - double CCC = CalculateAdjustment(Profit, base_or_margin_currency, AccountCurrency, Symbol()); + double CCC = CalculateAdjustment(Profit, base_or_margin_currency, AccountCurrency, SymbolForTrading); swap_long_1_lot = swap_long * CCC; swap_short_1_lot = swap_short * CCC; } @@ -7781,12 +7949,12 @@ void GetSwapData() if ((sets.EntryType == Pending) || (sets.EntryType == StopLimit)) symbol_cost_1_lot_loss = ContractSize * sets.EntryLevel; // Calculate it by current price of contract - it is impossible to determine potential future price. - else symbol_cost_1_lot_loss = ContractSize * SymbolInfoDouble(Symbol(), SYMBOL_ASK); + else symbol_cost_1_lot_loss = ContractSize * SymbolInfoDouble(SymbolForTrading, SYMBOL_ASK); symbol_cost_1_lot_profit = symbol_cost_1_lot_loss; if (ProfitCurrency != AccountCurrency) { - double CCC_loss = CalculateAdjustment(Loss, ProfitCurrency, AccountCurrency, Symbol()); - double CCC_profit = CalculateAdjustment(Profit, ProfitCurrency, AccountCurrency, Symbol()); + double CCC_loss = CalculateAdjustment(Loss, ProfitCurrency, AccountCurrency, SymbolForTrading); + double CCC_profit = CalculateAdjustment(Profit, ProfitCurrency, AccountCurrency, SymbolForTrading); // Adjust the unit cost. symbol_cost_1_lot_profit = symbol_cost_1_lot_loss * CCC_profit; symbol_cost_1_lot_loss = symbol_cost_1_lot_loss * CCC_loss; @@ -7801,12 +7969,12 @@ void GetSwapData() if ((sets.EntryType == Pending) || (sets.EntryType == StopLimit)) symbol_cost_1_lot_loss = UnitCost_loss * sets.EntryLevel / TickSize; // Calculate it by current price of contract - it is impossible to determine potential future price. - else symbol_cost_1_lot_loss = UnitCost_loss * SymbolInfoDouble(Symbol(), SYMBOL_ASK) / TickSize; + else symbol_cost_1_lot_loss = UnitCost_loss * SymbolInfoDouble(SymbolForTrading, SYMBOL_ASK) / TickSize; // For profit (positive swap): if ((sets.EntryType == Pending) || (sets.EntryType == StopLimit)) symbol_cost_1_lot_profit = UnitCost_profit * sets.EntryLevel / TickSize; // Calculate it by current price of contract - it is impossible to determine potential future price. - else symbol_cost_1_lot_profit = UnitCost_profit * SymbolInfoDouble(Symbol(), SYMBOL_ASK) / TickSize; + else symbol_cost_1_lot_profit = UnitCost_profit * SymbolInfoDouble(SymbolForTrading, SYMBOL_ASK) / TickSize; } // Percentage per 360 days. @@ -7837,6 +8005,35 @@ void GetSwapData() case SYMBOL_SWAP_MODE_REOPEN_BID: OutputSwapsType = TRANSLATION_LABEL_REOPENING; break; + case SYMBOL_SWAP_MODE_CURRENCY_PROFIT: + { + OutputSwapsType = TRANSLATION_LABEL_PROFIT_CURRENCY + " (" + ProfitCurrency + ")"; + // Simple case: + if (AccountCurrency == ProfitCurrency) + { + swap_long_1_lot = swap_long; + swap_short_1_lot = swap_short; + } + // Need to find the current PRO/ACC or ACC/PRO rate. + else + { + // Simple case - use Symbol rates for conversion: + if (AccountCurrency == BaseCurrency) + { + double ask = SymbolInfoDouble(SymbolForTrading, SYMBOL_ASK); + swap_long_1_lot = swap_long / ask; + swap_short_1_lot = swap_short / ask; + } + // Go through Market Watch trying to find the currency pair with both ProfitCurrency and AccountCurrency in it. + else + { + double CCC = CalculateAdjustment(Profit, ProfitCurrency, AccountCurrency, SymbolForTrading); + swap_long_1_lot = swap_long * CCC; + swap_short_1_lot = swap_short * CCC; + } + } + } + break; default: break; } @@ -7952,7 +8149,7 @@ void CalculateSymbolLeverage() double UnitCost_loss, UnitCost_profit; CalculateUnitCost(UnitCost_loss, UnitCost_profit); if ((TickSize == 0) || (UnitCost_loss == 0)) return; - double lotValue = SymbolInfoDouble(Symbol(), SYMBOL_ASK) / TickSize * UnitCost_loss; + double lotValue = SymbolInfoDouble(SymbolForTrading, SYMBOL_ASK) / TickSize * UnitCost_loss; if (PreHedgingPositionMargin == 0) return; double margin = PreHedgingPositionMargin; if ((PreCustomLeverage > 0) && (CustomLeverage > 0)) margin = margin * CustomLeverage / PreCustomLeverage; // Recalculate margin using the original leverage, not the custom leverage. @@ -7976,18 +8173,18 @@ void CalculateUnitCost(double &UnitCost_loss, double &UnitCost_profit) // If profit currency is different from account currency. if (ProfitCurrency != AccountCurrency) { - double CCC = CalculateAdjustment(Loss, ProfitCurrency, AccountCurrency, Symbol()); + double CCC = CalculateAdjustment(Loss, ProfitCurrency, AccountCurrency, SymbolForTrading); // Adjust the unit cost. UnitCost_loss *= CCC; - CCC = CalculateAdjustment(Profit, ProfitCurrency, AccountCurrency, Symbol()); + CCC = CalculateAdjustment(Profit, ProfitCurrency, AccountCurrency, SymbolForTrading); UnitCost_profit *= CCC; } } // With Forex instruments, tick value already equals 1 unit cost. else { - UnitCost_loss = SymbolInfoDouble(Symbol(), SYMBOL_TRADE_TICK_VALUE_LOSS); - UnitCost_profit = SymbolInfoDouble(Symbol(), SYMBOL_TRADE_TICK_VALUE_PROFIT); + UnitCost_loss = SymbolInfoDouble(SymbolForTrading, SYMBOL_TRADE_TICK_VALUE_LOSS); + UnitCost_profit = SymbolInfoDouble(SymbolForTrading, SYMBOL_TRADE_TICK_VALUE_PROFIT); if ((UnitCost_loss == 0) || (UnitCost_profit == 0)) WarnAboutZeroUnitCost(); } } @@ -8087,7 +8284,7 @@ double CalculateCommission() if (sets.CommissionType == COMMISSION_PERCENT) // Commission in %. Tricky. { // Need to convert this commission to currency units. The result may be incorrect in some cases. - double contract_size = SymbolInfoDouble(Symbol(), SYMBOL_TRADE_CONTRACT_SIZE); + double contract_size = SymbolInfoDouble(SymbolForTrading, SYMBOL_TRADE_CONTRACT_SIZE); double ContractValue = 0; if ((CalcMode == SYMBOL_CALC_MODE_FOREX) || (CalcMode == SYMBOL_CALC_MODE_FOREX_NO_LEVERAGE)) // Forex. { @@ -8099,12 +8296,12 @@ double CalculateCommission() { if (ProfitCurrency == AccountCurrency) // E.g., EUR/USD. { - ContractValue = contract_size * SymbolInfoDouble(Symbol(), SYMBOL_ASK); + ContractValue = contract_size * SymbolInfoDouble(SymbolForTrading, SYMBOL_ASK); } else // E.g., GBP/JPY. { // Conversion needed: - double ccc = CalculateAdjustment(Loss, BaseCurrency, AccountCurrency, Symbol()); + double ccc = CalculateAdjustment(Loss, BaseCurrency, AccountCurrency, SymbolForTrading); ContractValue = contract_size * ccc; } } @@ -8114,12 +8311,12 @@ double CalculateCommission() // Let's consider that the contract price is in the profit currency (which isn't strictly true unfortunately). if (ProfitCurrency == AccountCurrency) // E.g., trading US500 on a USD account. { - ContractValue = contract_size * SymbolInfoDouble(Symbol(), SYMBOL_ASK); + ContractValue = contract_size * SymbolInfoDouble(SymbolForTrading, SYMBOL_ASK); } else // E.g., trading Nikkei on a USD account. { // Conversion needed: - double ccc = CalculateAdjustment(Loss, BaseCurrency, AccountCurrency, Symbol()); + double ccc = CalculateAdjustment(Loss, BaseCurrency, AccountCurrency, SymbolForTrading); ContractValue = contract_size * ccc; } } @@ -8171,4 +8368,15 @@ void PositionSizeToArray(double ps) } else ArrayPositionSize[0] = ps; } + +double AdjustPositionSizeByMinMaxStep(double ps) +{ + if (ps < MinLot) ps = MinLot; + else if ((ps > MaxLot) && (!SurpassBrokerMaxPositionSize)) ps = MaxLot; + double steps = 0; + if (LotStep != 0) steps = ps / LotStep; + if (MathAbs(MathRound(steps) - steps) < 0.00000001) steps = MathRound(steps); + if (MathFloor(steps) < steps) ps = MathFloor(steps) * LotStep; + return ps; +} //+------------------------------------------------------------------+ \ No newline at end of file diff --git a/MQL5/Experts/Position Sizer/Translations/ChineseTraditional.mqh b/MQL5/Experts/Position Sizer/Translations/ChineseTraditional.mqh new file mode 100644 index 0000000..65f6022 --- /dev/null +++ b/MQL5/Experts/Position Sizer/Translations/ChineseTraditional.mqh @@ -0,0 +1,297 @@ +#define TRANSLATION_TAB_BUTTON_MAIN "主選項" +#define TRANSLATION_TAB_BUTTON_RISK "風險" +#define TRANSLATION_TAB_BUTTON_MARGIN "保證金" +#define TRANSLATION_TAB_BUTTON_SWAPS "利息" +#define TRANSLATION_TAB_BUTTON_TRADING "交易" + +#define TRANSLATION_LABEL_SPREAD "點差" + +#define TRANSLATION_LABEL_ENTRY "入場位" + +#define TRANSLATION_BUTTON_LONG "做多" +#define TRANSLATION_BUTTON_SHORT "做空" + +#define TRANSLATION_TOOLTIP_BUTTON_LONG_SHORT "在做多與做空之間切換" + +#define TRANSLATION_TOOLTIP_ENTRY_INCREASE "入場位增加1點" +#define TRANSLATION_TOOLTIP_ENTRY_DECREASE "入場位元減少1點" + +#define TRANSLATION_LABEL_STOPLOSS "停損位元" +#define TRANSLATION_BUTTON_SL "停損位,點數" + +#define TRANSLATION_TOOLTIP_STOPLOSS_INCREASE "停損位元增加1點" +#define TRANSLATION_TOOLTIP_STOPLOSS_DECREASE "停損位元減少1點" + +#define TRANSLATION_LABEL_TAKEPROFIT "止盈位元" +#define TRANSLATION_BUTTON_TP "止盈位,點數" + +#define TRANSLATION_TOOLTIP_TAKEPROFIT_ADD "新增止盈位元" +#define TRANSLATION_TOOLTIP_BUTTON_TP "讓停盈位元基於停損位元或啟用鎖定止盈位元模式" + +#define TRANSLATION_TOOLTIP_TAKEPROFIT_INCREASE "止盈位元增加1點" +#define TRANSLATION_TOOLTIP_TAKEPROFIT_DECREASE "停損位元減少1點" + +#define TRANSLATION_LABEL_TAKEPROFIT_MULTIPLE_DISTANCE "止盈位元" +#define TRANSLATION_LABEL_TAKEPROFIT_MULTIPLE_POINTS "點數" + +#define TRANSLATION_TOOLTIP_TAKEPROFIT_REMOVE "移除止盈位元" + +#define TRANSLATION_TOOLTIP_TAKEPROFIT_INCREASE_MULTIPLE "止盈位增加" +#define TRANSLATION_TOOLTIP_TAKEPROFIT_DECREASE_MULTIPLE "止盈位元減少" +#define TRANSLATION_TOOLTIP_TAKEPROFIT_BY_ONE_POINT "1點" + +#define TRANSLATION_LABEL_STOPPRICE "停止價" + +#define TRANSLATION_TOOLTIP_STOPPRICE_INCREASE "停止價增加1點" +#define TRANSLATION_TOOLTIP_STOPPRICE_DECREASE "停止價減少1點" + +#define TRANSLATION_LABEL_ATR_PERIOD "ATR時段" +#define TRANSLATION_BUTTON_ATR_PERIOD_CURRENT "目前時段" +#define TRANSLATION_LABEL_ATR_SL_MULTIPLIER "停損乘數" +#define TRANSLATION_LABEL_ATR_TP_MULTIPLIER "止盈乘數" + +#define TRANSLATION_CHECKBOX_ATR_SA "點差調整" +#define TRANSLATION_TOOLTIP_ATR_SA_SL "將點差調整套用到停損位元" +#define TRANSLATION_TOOLTIP_ATR_SA_TP "將點差調整套用至止盈位元" + +#define TRANSLATION_LABEL_ATR_TIMEFRAME "ATR時間週期" +#define TRANSLATION_LABEL_ATR_VALUE "ATR" + +#define TRANSLATION_LABEL_ORDER_TYPE "訂單類型" + +#define TRANSLATION_BUTTON_ORDER_TYPE_INSTANT "即時單" +#define TRANSLATION_BUTTON_ORDER_TYPE_PENDING "掛單" +#define TRANSLATION_BUTTON_ORDER_TYPE_STOPLIMIT "限價停損單" + +#define TRANSLATION_TOOLTIP_ORDER_TYPE "在即時單、掛單、限價停損單之間切換" + +#define TRANSLATION_BUTTON_HIDE_LINES "隱藏線" +#define TRANSLATION_BUTTON_SHOW_LINES "顯示線" + +#define TRANSLATION_LABEL_COMMISSION "每手佣金(單向)" + +#define TRANSLATION_TOOLTIP_COMMISSION "以帳戶幣種或百分比計算,每1標準手" +#define TRANSLATION_TOOLTIP_COMMISSION_TYPE "點擊切換" + +#define TRANSLATION_BUTTON_ACCOUNT_BALANCE "帳戶餘額" +#define TRANSLATION_BUTTON_ACCOUNT_EQUITY "帳戶淨值" +#define TRANSLATION_BUTTON_BALANCE_MINUS_CPR "餘額- CPR" + +#define TRANSLATION_TOOLTIP_ACCOUNT_SIZE "在餘額、淨值、餘額減當前投資組合風險之間切換" +#define TRANSLATION_TOOLTIP_ACCOUNT_SIZE_ASTERISK_CUSTOM "自訂餘額設定" +#define TRANSLATION_TOOLTIP_ACCOUNT_SIZE_ASTERISK_ADD "追加資金" +#define TRANSLATION_TOOLTIP_ACCOUNT_SIZE_ASTERISK_SUB "減去資金" + +#define TRANSLATION_LABEL_INPUT "輸入" +#define TRANSLATION_LABEL_RESULT "結果" +#define TRANSLATION_LABEL_RISK "風險" +#define TRANSLATION_LABEL_MONEY "資金" +#define TRANSLATION_LABEL_REWARD "回報" +#define TRANSLATION_LABEL_REWARD_RISK "回報/風險" +#define TRANSLATION_LABEL_POSITION_SIZE "頭寸數量" +#define TRANSLATION_BUTTON_MAX_PS "最大PS" +#define TRANSLATION_LABEL_POINT_VALUE "點數值" + +#define TRANSLATION_CHECKBOX_COUNT_PENDING_ORDERS "統計掛單" +#define TRANSLATION_CHECKBOX_IGNORE_ORDERS_WO_SL "忽略無停損位訂單" +#define TRANSLATION_CHECKBOX_IGNORE_ORDERS_WO_TP "忽略無止損位元訂單" +#define TRANSLATION_CHECKBOX_IGNORE_ORDERS_IN_OTHER_SYMBOLS "忽略其他交易品種的訂單" + +#define TRANSLATION_LABEL_LOTS "手數" +#define TRANSLATION_LABEL_CURRENT_PORTFOLIO "目前投資組合" +#define TRANSLATION_TOOLTIP_CURRENT_PORTFOLIO "目前未平倉交易" +#define TRANSLATION_LABEL_POTENTIAL_PORTFOLIO "潛力投資組合" +#define TRANSLATION_TOOLTIP_POTENTIAL_PORTFOLIO "包括正在計算的部位" +#define TRANSLATION_LABEL_CRRR_TOOLTIP "目前投資組合的風險報酬比率" +#define TRANSLATION_LABEL_PRRR_TOOLTIP "潛在投資組合的風險報酬比率" + +#define TRANSLATION_LABEL_POSITION_MARGIN "部位保證金" +#define TRANSLATION_LABEL_FUTURE_USED_MARGIN "未來的已使用保證金" +#define TRANSLATION_LABEL_FUTURE_FREE_MARGIN "未來的可用保證金" +#define TRANSLATION_LABEL_CUSTOM_LEVERAGE "自訂槓桿" + +#define TRANSLATION_LABEL_DEFAULT "預設" +#define TRANSLATION_LABEL_SYMBOL "交易品種" +#define TRANSLATION_LABEL_MAX_PS_BY_MARGIN "以保證金計算的最大部位數量" + +#define TRANSLATION_TOOLTIP_MAX_PS_BY_MARGIN "以手數計" + +#define TRANSLATION_LABEL_TYPE "型別" + +#define TRANSLATION_LABEL_UNKNOWN "未知" +#define TRANSLATION_LABEL_DISABLED "已停用" +#define TRANSLATION_LABEL_INTEREST_OPEN "利率(開盤價)" +#define TRANSLATION_LABEL_INTEREST_CURRENT "利率(目前價)" + +#define TRANSLATION_LABEL_REOPENING "重開" +#define TRANSLATION_LABEL_TRIPLE_SWAP "三倍利息" +#define TRANSLATION_EDIT_WEEKDAY_SUNDAY "週日" +#define TRANSLATION_EDIT_WEEKDAY_MONDAY "週一" +#define TRANSLATION_EDIT_WEEKDAY_TUESDAY "週二" +#define TRANSLATION_EDIT_WEEKDAY_WEDNESDAY "週三" +#define TRANSLATION_EDIT_WEEKDAY_THURSDAY "週四" +#define TRANSLATION_EDIT_WEEKDAY_FRIDAY "週五" +#define TRANSLATION_EDIT_WEEKDAY_SATURDAY "週六" + +#define TRANSLATION_LABEL_NOMINAL "名義" +#define TRANSLATION_LABEL_DAILY "每日" +#define TRANSLATION_LABEL_YEARLY "每年" +#define TRANSLATION_LABEL_PER_LOT "每手" +#define TRANSLATION_LABEL_PER_PS "每PS" +#define TRANSLATION_LABEL_BASE_CURRENCY "基準貨幣" +#define TRANSLATION_LABEL_MARGIN_CURRENCY "保證金貨幣" + +#define TRANSLATION_BUTTON_TRADE "交易" +#define TRANSLATION_LABEL_TRAILING_STOP "移動停損" +#define TRANSLATION_LABEL_BREAKEVEN "損益兩平" +#define TRANSLATION_LABEL_MAGIC_NUMBER "幻數" +#define TRANSLATION_LABEL_ORDER_COMMENTARY "訂單註解" +#define TRANSLATION_LABEL_ORDER_AUTOSUFFIX "自動後綴" +#define TRANSLATION_TOOLTIP_ORDER_AUTOSUFFIX "為每筆新交易的註解新增自動遞增數字?" +#define TRANSLATION_LABEL_MAX_NUMBER_OF_TRADES "最大交易數" +#define TRANSLATION_LABEL_TOTAL "總共" +#define TRANSLATION_LABEL_PER_SYMBOL "每品種" +#define TRANSLATION_LABEL_MAX_VOLUME "最大交易量" +#define TRANSLATION_LABEL_MAX_RISK "最大風險" +#define TRANSLATION_CHECKBOX_DISABLE_TRADING_LINES_HIDDEN "當線條被隱藏時停用交易" +#define TRANSLATION_TOOLTIP_FILL_INWARD "在入場位與主止盈位之間等距填充追加止盈位。" +#define TRANSLATION_TOOLTIP_FILL_OUTWARD "以相同的距離在主止盈位元之外設定追加止盈位元。" +#define TRANSLATION_LABEL_SHARE "份額" +#define TRANSLATION_TOOLTIP_SHARE "自動填入交易量份額" +#define TRANSLATION_LABEL_POINTS "點數" +#define TRANSLATION_LABEL_MAX_SLIPPAGE "最大滑點" +#define TRANSLATION_LABEL_MAX_SPREAD "最大點差" +#define TRANSLATION_LABEL_MAX_ENTRY_SL_DISTANCE "最大入場位元/停損距離" +#define TRANSLATION_LABEL_MIN_ENTRY_SL_DISTANCE "最小入場位元/停損距離" +#define TRANSLATION_CHECKBOX_SUBTRACT_OPEN_POSITIONS_VOLUME "減去未平倉部位數量" +#define TRANSLATION_CHECKBOX_SUBTRACT_PENDING_ORDERS_VOLUME "減去掛單量" +#define TRANSLATION_CHECKBOX_DO_NOT_APPLY_STOPLOSS "不施加停損位元" +#define TRANSLATION_CHECKBOX_DO_NOT_APPLY_TAKEPROFIT "不套用止盈位元" +#define TRANSLATION_TOOLTIP_SUBTRACT_OPEN_POSITIONS_VOLUME "開始交易前,EA 將從計算的頭寸數量中減去當前未平倉交易量。" +#define TRANSLATION_TOOLTIP_SUBTRACT_PENDING_ORDERS_VOLUME "開始交易前,EA 將從計算的頭寸數量中減去掛單量。" +#define TRANSLATION_TOOLTIP_DO_NOT_APPLY_STOPLOSS "EA 不會對它所開立的交易套用停損位元。" +#define TRANSLATION_TOOLTIP_DO_NOT_APPLY_TAKEPROFIT "EA 不會對它開立的交易套用止盈位元。" +#define TRANSLATION_CHECKBOX_ASK_FOR_CONFIRMATION "要求確認" +#define TRANSLATION_TOOLTIP_ASK_FOR_CONFIRMATION "EA 將在開立交易前要求確認。" +#define TRANSLATION_LABEL_EXPIRY "到期" +#define TRANSLATION_TOOLTIP_EXPIRY "下一個已建立掛單的到期時間(以分鐘為單位)。最小值=2。" +#define TRANSLATION_LABEL_MINUTES "分鐘" +#define TRANSLATION_TOOLTIP_MINUTES "分鐘" + +#define TRANSLATION_TOOLTIP_STOP_PRICE_LINE "停止價(用於限價停損單)" +#define TRANSLATION_TOOLTIP_SL_LABEL "停損距離,點數" +#define TRANSLATION_TOOLTIP_TP_LABEL "止盈距離,點數" +#define TRANSLATION_TOOLTIP_ENTRY_LABEL "入場距離,點數" +#define TRANSLATION_TOOLTIP_STOP_PRICE_LABEL "停止價距離,點數" +#define TRANSLATION_TOOLTIP_ENTRY_LABEL_ADDITIONAL "部位數量,手數" + +#define TRANSLATION_LABEL_WARNING_TOO_CLOSE "(太接近!)" +#define TRANSLATION_LABEL_WARNING_WRONG_VALUE "(錯誤值!)" +#define TRANSLATION_LABEL_WARNING_INVALID_TP "無效止盈位元" + +#define TRANSLATION_TOOLTIP_WARNING_PS "大於以保證金計算的最大部位數量" + +#define TRANSLATION_MESSAGE_SL_SHOULD_BE_POSITIVE "停損位元應為正值。" +#define TRANSLATION_MESSAGE_TRYING_TO_SAVE_FILE "嘗試將設定儲存至檔案" +#define TRANSLATION_MESSAGE_FAILED_TO_OPEN_FOR_WRITING "無法開啟檔案進行寫入" +#define TRANSLATION_MESSAGE_ERROR "錯誤" +#define TRANSLATION_MESSAGE_SAVED_SETTINGS "已成功儲存設定。" +#define TRANSLATION_MESSAGE_TRYING_TO_LOAD_FILE "嘗試從檔案載入設定。" +#define TRANSLATION_MESSAGE_NO_SETTINGS_FILE_TO_LOAD "沒有可載入的設定檔。" +#define TRANSLATION_MESSAGE_FAILED_TO_OPEN_FOR_READING "無法開啟檔案讀取" +#define TRANSLATION_MESSAGE_LOADED_SETTINGS "已成功載入設定。" +#define TRANSLATION_MESSAGE_NO_SETTINGS_FILE_TO_DELETE "沒有可刪除的設定檔。" +#define TRANSLATION_MESSAGE_TRYING_TO_DELETE_FILE "嘗試刪除設定檔。" +#define TRANSLATION_MESSAGE_FAILED_TO_DELETE_FILE "檔案刪除失敗" +#define TRANSLATION_MESSAGE_DELETED_SETTINGS "已成功刪除設定檔。" +#define TRANSLATION_MESSAGE_DELETED_DUPLICATE_PANEL "刪除了帶有前綴的重複面板物件。" +#define TRANSLATION_MESSAGE_FAILED_TO_CREATE_ATR "無法建立ATR句柄" +#define TRANSLATION_MESSAGE_ENTRY_SL_DIFFERENT_NON_ZERO "入場位元與停損位元應不相同,且為非零值。" +#define TRANSLATION_MESSAGE_ENTRY_SL_DIFFERENT "停損位元應與入場位元不相同。" +#define TRANSLATION_MESSAGE_CANNOT_RETRIEVE_TICKSIZE "無法擷取跳動點的大小" +#define TRANSLATION_MESSAGE_LOOKS_LIKE "這項工具似乎已不可用。計算可能有誤。" +#define TRANSLATION_MESSAGE_MISCONFIGURED_SYMBOL "交易伺服器上的交易品種配置錯誤- 零單位成本。" +#define TRANSLATION_MESSAGE_ALGO_TRADING_DISABLED "演算法交易已停用!請開啟演算法交易。" +#define TRANSLATION_MESSAGE_STOPLOSS_PROBLEM "停損問題" +#define TRANSLATION_MESSAGE_WRONG_POSITION_SIZE_VALUE "頭寸數量值錯誤!" +#define TRANSLATION_MESSAGE_MULTIPLE_TP_VOLUME_SHARE_SUM "多個止盈交易量份額的總和" +#define TRANSLATION_MESSAGE_INCORRECT_VOLUME_SUM "多個止盈交易量份額的總和錯誤- 未進行任何交易。" +#define TRANSLATION_MESSAGE_NETTING_MODE_DETECTED "偵測到連網模式。多個止盈位元無效。將一個止盈位元的交易量設為100%。" +#define TRANSLATION_MESSAGE_NOT_TAKING_A_TRADE "未進行交易" +#define TRANSLATION_MESSAGE_NTAT_LINES "線條被隱藏,面板設為在線條隱藏時不做交易。" +#define TRANSLATION_MESSAGE_NTAT_SPREAD "目前點差" +#define TRANSLATION_MESSAGE_MAXIMUM_SPREAD "最大點差" +#define TRANSLATION_MESSAGE_NTAT_ENTRY_SL_DISTANCE "目前入場位元/停損距離" +#define TRANSLATION_MESSAGE_NTAT_TOTAL_NUMBER "目前交易總數" +#define TRANSLATION_MESSAGE_NUMBER_OF_TRADES_IN_EXECUTION "執行中的交易數量" +#define TRANSLATION_MESSAGE_MAXIMUM_TOTAL_NUMBER_OF_TRADES_ALLOWED "允許的最大交易總數" +#define TRANSLATION_MESSAGE_NTAT_PER_SYMBOL_NUMBER "每個交易品種的目前交易數量" +#define TRANSLATION_MESSAGE_MAXIMUM_PER_SYMBOL_NUMBER_OF_TRADES_ALLOWED "每個交易品種允許的最大交易數量" +#define TRANSLATION_MESSAGE_TOTAL_POTENTIAL_RISK "總潛在風險" +#define TRANSLATION_MESSAGE_MAXIUMUM_TOTAL_RISK "允許的最大風險總量" +#define TRANSLATION_MESSAGE_INFINITE_TOTAL_POTENTIAL_RISK "無限潛在風險總量" +#define TRANSLATION_MESSAGE_PER_SYMBOL_POTENTIAL_RISK "每個交易品種的潛在風險" +#define TRANSLATION_MESSAGE_MAXIMUM_PER_SYMBOL_RISK "每個交易品種允許的最大風險" +#define TRANSLATION_MESSAGE_INFINITE_PER_SYMBOL_POTENTIAL_RISK "每個交易品種的無限潛在風險" +#define TRANSLATION_MESSAGE_IGNORE_MARKET_EXECUTION_MODE_WARNING ",但IgnoreMarketExecutionMode = true。如果交易未執行,則切換為false。" +#define TRANSLATION_MESSAGE_EXECUTION_MODE "執行模式" +#define TRANSLATION_MESSAGE_ORDER_FILLING_MODE "訂單填滿模式" +#define TRANSLATION_MESSAGE_FILL_OR_KILL "全部執行否則取消" +#define TRANSLATION_MESSAGE_IMMEDIATE_OR_CANCEL "立即成交否則取消" +#define TRANSLATION_MESSAGE_FOUND_EXISTING_BUY_VOLUME "發現現有買入量" +#define TRANSLATION_MESSAGE_FOUND_EXISTING_SELL_VOLUME "發現現有賣出量" +#define TRANSLATION_MESSAGE_ADJUSTED_POSITION_SIZE "調整部位數量" +#define TRANSLATION_MESSAGE_ADJUSTED_POSITION_SIZE_LESS_THAN_ZERO "調整後的部位數量小於零。不會執行任何交易。" +#define TRANSLATION_MESSAGE_NTAT_TOTAL_VOLUME "目前總交易量" +#define TRANSLATION_MESSAGE_NTAT_NEW_POSITION_VOLUME "新部位量" +#define TRANSLATION_MESSAGE_NTAT_MAXIMUM_TOTAL_VOLUME "允許的最大總交易量" +#define TRANSLATION_MESSAGE_NTAT_PER_SYMBOL_VOLUME "每個交易品種的目前交易量" +#define TRANSLATION_MESSAGE_NTAT_MAXIMUM_PER_SYMBOL_VOLUME "每個交易品種允許的最大交易量" +#define TRANSLATION_MESSAGE_BROKER_MINIMUM "經紀商的最小部位規模。不會執行交易。" +#define TRANSLATION_MESSAGE_BROKER_MAXIMUM "經紀商的最大部位規模。減少它。" +#define TRANSLATION_MESSAGE_ERROR_SENDING_ORDER "發送訂單出錯" +#define TRANSLATION_MESSAGE_ORDER_EXECUTED "訂單已執行。" +#define TRANSLATION_MESSAGE_TICKET "憑證" +#define TRANSLATION_MESSAGE_ORDER "訂單" +#define TRANSLATION_MESSAGE_EXECUTED "已執行" +#define TRANSLATION_MESSAGE_ERROR_OPENING_POSITION "開立部位出錯" +#define TRANSLATION_MESSAGE_RETURN_CODE "回傳代碼" +#define TRANSLATION_MESSAGE_INITIAL_RETURN_CODE "初始回傳代碼" +#define TRANSLATION_MESSAGE_ORDER_ID "訂單號碼" +#define TRANSLATION_MESSAGE_DEAL_ID "交易號碼" +#define TRANSLATION_MESSAGE_POSITION_ID "部位編號" +#define TRANSLATION_MESSAGE_ERROR_MODIFYING_POSITION "修改部位出錯" +#define TRANSLATION_MESSAGE_SL_TP_APPLIED "成功套用停損/停損位元。" +#define TRANSLATION_MESSAGE_ERROR_SELECTING_DEAL "選擇交易時發生錯誤" +#define TRANSLATION_MESSAGE_ERROR_SELECTING_DEAL_HISTORY "選擇交易歷史記錄時發生錯誤" +#define TRANSLATION_MESSAGE_WAITING "等待中..." +#define TRANSLATION_MESSAGE_ERROR_SELECTING_POSITIONS "選擇部位時發生錯誤" +#define TRANSLATION_MESSAGE_POSITION_SIZER_ON "頭寸數量計算器用於" +#define TRANSLATION_MESSAGE_EXECUTE_TRADE "執行交易嗎?" +#define TRANSLATION_MESSAGE_BUY "買入" +#define TRANSLATION_MESSAGE_BUY_STOP "買入停損" +#define TRANSLATION_MESSAGE_BUY_LIMIT "買入限價" +#define TRANSLATION_MESSAGE_BUY_STOP_LIMIT "買入停損限價" +#define TRANSLATION_MESSAGE_SELL "賣出" +#define TRANSLATION_MESSAGE_SELL_STOP "賣出停損" +#define TRANSLATION_MESSAGE_SELL_LIMIT "賣出限價" +#define TRANSLATION_MESSAGE_SELL_STOP_LIMIT "賣出停損限價" +#define TRANSLATION_MESSAGE_SIZE "規模" +#define TRANSLATION_MESSAGE_MULTIPLE "多個" +#define TRANSLATION_MESSAGE_TRADE_CANCELED "交易取消。" +#define TRANSLATION_MESSAGE_POSITIONGETTICKET_FAILED "PositionGetTicket失敗" +#define TRANSLATION_MESSAGE_POSITIONMODIFY_FAILED_BUY_TSL "PositionModify因買入移動而損失敗" +#define TRANSLATION_MESSAGE_POSITIONMODIFY_FAILED_SELL_TSL "PositionModify因賣出移動止損失敗" +#define TRANSLATION_MESSAGE_TSL_APPLIED "移動停損已套用於部位" +#define TRANSLATION_MESSAGE_SL_WAS_MOVED_FROM "停損位元的移動是從" +#define TRANSLATION_MESSAGE_SL_WAS_MOVED_TO "至" +#define TRANSLATION_MESSAGE_POSITIONMODIFY_FAILED_BUY_BE "PositionModify failed for Buy breakeven" +#define TRANSLATION_MESSAGE_POSITIONMODIFY_FAILED_SELL_BE "未能實現賣出損益平衡" +#define TRANSLATION_MESSAGE_BE_APPLIED "損益平衡被應用到部位" +#define TRANSLATION_MESSAGE_BE_FOR "損益平衡用於" +#define TRANSLATION_MESSAGE_ERROR_SETTING_TIMER "設定計時器時發生錯誤" +#define TRANSLATION_MESSAGE_FAILED_DELETE_INI "無法刪除PS面板的.ini檔案" +#define TRANSLATION_MESSAGE_CANNOT_CONVERT "無法轉換" +#define TRANSLATION_MESSAGE_CANNOT_CONVERT_TO "為" +#define TRANSLATION_MESSAGE_CANNOT_CONVERT_CALCULATION "計算可能有誤" +#define TRANSLATION_MESSAGE_MINIMUM_EXPIRY "最短到期時間為2 分鐘。" diff --git a/MQL5/Experts/Position Sizer/Translations/English.mqh b/MQL5/Experts/Position Sizer/Translations/English.mqh index d3add32..c4bff7a 100644 --- a/MQL5/Experts/Position Sizer/Translations/English.mqh +++ b/MQL5/Experts/Position Sizer/Translations/English.mqh @@ -99,13 +99,19 @@ #define TRANSLATION_LABEL_POSITION_SIZE "Position size" #define TRANSLATION_BUTTON_MAX_PS "Max PS" #define TRANSLATION_LABEL_POINT_VALUE "Point value" +#define TRANSLATION_TOOLTIP_INPUTS "Fields in this column are calculated based on inputs" +#define TRANSLATION_TOOLTIP_RESULT "Fields in this column take into account broker's limitations" // Risk tab #define TRANSLATION_CHECKBOX_COUNT_PENDING_ORDERS "Count pending orders" #define TRANSLATION_CHECKBOX_IGNORE_ORDERS_WO_SL "Ignore orders without stop-loss" #define TRANSLATION_CHECKBOX_IGNORE_ORDERS_WO_TP "Ignore orders without take-profit" -#define TRANSLATION_CHECKBOX_IGNORE_ORDERS_IN_OTHER_SYMBOLS "Ignore orders in other symbols" +#define TRANSLATION_LABEL_IGNORE_TRADES_IN "Ignore trades in" +#define TRANSLATION_BUTTON_SYMBOLS_NO "no symbols " +#define TRANSLATION_BUTTON_SYMBOLS_OTHER "other symbols " +#define TRANSLATION_BUTTON_SYMBOLS_CURRENT "current symbol" +#define TRANSLATION_BUTTON_SYMBOLS_TOOLTIP "Switch between No, Other, and Current." #define TRANSLATION_LABEL_LOTS "Lots" #define TRANSLATION_LABEL_CURRENT_PORTFOLIO "Current portfolio" #define TRANSLATION_TOOLTIP_CURRENT_PORTFOLIO "Trades that are currently open" @@ -147,6 +153,7 @@ #define TRANSLATION_LABEL_PER_PS "per PS" #define TRANSLATION_LABEL_BASE_CURRENCY "Base currency" #define TRANSLATION_LABEL_MARGIN_CURRENCY "Margin currency" +#define TRANSLATION_LABEL_PROFIT_CURRENCY "Profit currency" // Trading tab @@ -172,6 +179,7 @@ #define TRANSLATION_LABEL_MAX_SPREAD "Max spread" #define TRANSLATION_LABEL_MAX_ENTRY_SL_DISTANCE "Max Entry/SL distance" #define TRANSLATION_LABEL_MIN_ENTRY_SL_DISTANCE "Min Entry/SL distance" +#define TRANSLATION_LABEL_MAX_RISK_PERCENTAGE "Max risk %" #define TRANSLATION_CHECKBOX_SUBTRACT_OPEN_POSITIONS_VOLUME "Subtract open positions volume" #define TRANSLATION_CHECKBOX_SUBTRACT_PENDING_ORDERS_VOLUME "Subtract pending orders volume" #define TRANSLATION_CHECKBOX_DO_NOT_APPLY_STOPLOSS "Do not apply stop-loss" @@ -224,7 +232,8 @@ #define TRANSLATION_MESSAGE_CANNOT_RETRIEVE_TICKSIZE "Cannot retrieve tick size for " #define TRANSLATION_MESSAGE_LOOKS_LIKE "Looks like the instrument is no longer available. Calculation may not be accurate." #define TRANSLATION_MESSAGE_MISCONFIGURED_SYMBOL "Misconfigured symbol on trading server - zero unit cost." -#define TRANSLATION_MESSAGE_ALGO_TRADING_DISABLED "Algo Trading disabled! Please enable Algo Trading." +#define TRANSLATION_MESSAGE_ALGO_TRADING_DISABLED_1 "Algorithmic trading is disabled in the platform's options! Please enable it via Tools->Options->Expert Advisors." +#define TRANSLATION_MESSAGE_ALGO_TRADING_DISABLED_2 "Algo Trading is disabled in the Position Sizer's settings! Please tick the Allow Algo Trading checkbox on the Common tab." #define TRANSLATION_MESSAGE_STOPLOSS_PROBLEM "Stop-loss problem" #define TRANSLATION_MESSAGE_WRONG_POSITION_SIZE_VALUE "Wrong position size value!" #define TRANSLATION_MESSAGE_MULTIPLE_TP_VOLUME_SHARE_SUM "Multiple TP volume share sum" @@ -235,6 +244,8 @@ #define TRANSLATION_MESSAGE_NTAT_SPREAD "current spread" #define TRANSLATION_MESSAGE_MAXIMUM_SPREAD "maximum spread" #define TRANSLATION_MESSAGE_NTAT_ENTRY_SL_DISTANCE "current Entry/SL distance" +#define TRANSLATION_MESSAGE_NTAT_CURRENT_RISK "current resulting risk" +#define TRANSLATION_MESSAGE_NTAT_MAX_RISK "maximum risk" #define TRANSLATION_MESSAGE_NTAT_TOTAL_NUMBER "current total # of trades" #define TRANSLATION_MESSAGE_NUMBER_OF_TRADES_IN_EXECUTION "number of trades in execution" #define TRANSLATION_MESSAGE_MAXIMUM_TOTAL_NUMBER_OF_TRADES_ALLOWED "maximum total number of trades allowed" @@ -310,4 +321,9 @@ #define TRANSLATION_MESSAGE_MINIMUM_EXPIRY "Minimum expiry duration is 2 minutes." #define TRANSLATION_MESSAGE_DONOTAPPLLYSL_SET "'Do not apply stop-loss' checkbox is ticked." #define TRANSLATION_MESSAGE_DONOTAPPLLYTP_SET "'Do not apply take-profit' checkbox is ticked." -#define TRANSLATION_MESSAGE_FAILED_TO_CREATE_OUTSIDE_BUTTON "Failed to create an outside button." \ No newline at end of file +#define TRANSLATION_MESSAGE_FAILED_TO_CREATE_OUTSIDE_BUTTON "Failed to create an outside button." +#define TRANSLATION_MESSAGE_TAKING_SMALLER_TRADE "Taking a smaller trade" +#define TRANSLATION_MESSAGE_NEW_POSITION_SIZE "New position size" +#define TRANSLATION_MESSAGE_CANNOT_TAKE_SMALLER_TRADE "Cannot take a smaller trade." +#define TRANSLATION_MESSAGE_ARE_YOU_SURE "Are you sure you want to close the Position Sizer?" +#define TRANSLATION_MESSAGE_EXIT "Exit?" \ No newline at end of file diff --git a/MQL5/Experts/Position Sizer/Translations/Russian.mqh b/MQL5/Experts/Position Sizer/Translations/Russian.mqh index 20e5eae..329235e 100644 --- a/MQL5/Experts/Position Sizer/Translations/Russian.mqh +++ b/MQL5/Experts/Position Sizer/Translations/Russian.mqh @@ -95,13 +95,19 @@ #define TRANSLATION_LABEL_POSITION_SIZE "Размер позиции" #define TRANSLATION_BUTTON_MAX_PS "Макс РП" #define TRANSLATION_LABEL_POINT_VALUE "Цена пункта" +#define TRANSLATION_TOOLTIP_INPUTS "Поля в этом столбце рассчитываются на основе введенных данных" +#define TRANSLATION_TOOLTIP_RESULT "Поля в этом столбце принимают во внимание ограничения брокера" // Risk tab #define TRANSLATION_CHECKBOX_COUNT_PENDING_ORDERS "Считать отложенные ордеры" #define TRANSLATION_CHECKBOX_IGNORE_ORDERS_WO_SL "Игнорировать ордеры без стоп-лосса" #define TRANSLATION_CHECKBOX_IGNORE_ORDERS_WO_TP "Игнорировать ордеры без тейк-профита" -#define TRANSLATION_CHECKBOX_IGNORE_ORDERS_IN_OTHER_SYMBOLS "Игнорировать ордеры по другим символам" +#define TRANSLATION_LABEL_IGNORE_TRADES_IN "Игнорировать" +#define TRANSLATION_BUTTON_SYMBOLS_NO "ничего" +#define TRANSLATION_BUTTON_SYMBOLS_OTHER "др. символы" +#define TRANSLATION_BUTTON_SYMBOLS_CURRENT "тек. символ" +#define TRANSLATION_BUTTON_SYMBOLS_TOOLTIP "Переключение между «ничего», «другими символами» и «текущим символом»." #define TRANSLATION_LABEL_LOTS "Лоты" #define TRANSLATION_LABEL_CURRENT_PORTFOLIO "Тек. портфолио" #define TRANSLATION_TOOLTIP_CURRENT_PORTFOLIO "Сделки, которые сейчас открыты" @@ -144,6 +150,7 @@ #define TRANSLATION_LABEL_PER_PS "за РП" #define TRANSLATION_LABEL_BASE_CURRENCY "Базовая валюта" #define TRANSLATION_LABEL_MARGIN_CURRENCY "Валюта маржи" +#define TRANSLATION_LABEL_PROFIT_CURRENCY "Валюта прибыли" // Trading tab @@ -169,6 +176,7 @@ #define TRANSLATION_LABEL_MAX_SPREAD "Макс спред" #define TRANSLATION_LABEL_MAX_ENTRY_SL_DISTANCE "Макс расст. Вход/СЛ" #define TRANSLATION_LABEL_MIN_ENTRY_SL_DISTANCE "Мин расст. Вход/СЛ" +#define TRANSLATION_LABEL_MAX_RISK_PERCENTAGE "Макс риск %" #define TRANSLATION_CHECKBOX_SUBTRACT_OPEN_POSITIONS_VOLUME "Выч. об. откр. позиций" #define TRANSLATION_CHECKBOX_SUBTRACT_PENDING_ORDERS_VOLUME "Выч. об. отлож. ордеров" #define TRANSLATION_CHECKBOX_DO_NOT_APPLY_STOPLOSS "Не примен. стоп-лосс" @@ -233,6 +241,8 @@ #define TRANSLATION_MESSAGE_NTAT_SPREAD "текущий спред" #define TRANSLATION_MESSAGE_MAXIMUM_SPREAD "максимальный спред" #define TRANSLATION_MESSAGE_NTAT_ENTRY_SL_DISTANCE "текущее расстояние Вход/СЛ" +#define TRANSLATION_MESSAGE_NTAT_CURRENT_RISK "текущий результат по риску" +#define TRANSLATION_MESSAGE_NTAT_MAX_RISK "максимальный риск" #define TRANSLATION_MESSAGE_NTAT_TOTAL_NUMBER "текущее общее число сделок" #define TRANSLATION_MESSAGE_NUMBER_OF_TRADES_IN_EXECUTION "число сделок на исполнении" #define TRANSLATION_MESSAGE_MAXIMUM_TOTAL_NUMBER_OF_TRADES_ALLOWED "максимально допустимое общее число сделок" @@ -308,4 +318,9 @@ #define TRANSLATION_MESSAGE_MINIMUM_EXPIRY "Минимальный срок действия отложенного ордера - 2 минуты." #define TRANSLATION_MESSAGE_DONOTAPPLLYSL_SET "Отмечен чекбокс 'Не примен. стоп-лосс'." #define TRANSLATION_MESSAGE_DONOTAPPLLYTP_SET "Отмечен чекбокс 'Не примен. тейк-профит'." -#define TRANSLATION_MESSAGE_FAILED_TO_CREATE_OUTSIDE_BUTTON "Ошибка при создании внешней кнопки." \ No newline at end of file +#define TRANSLATION_MESSAGE_FAILED_TO_CREATE_OUTSIDE_BUTTON "Ошибка при создании внешней кнопки." +#define TRANSLATION_MESSAGE_TAKING_SMALLER_TRADE "Открытие сделки меньшего размера" +#define TRANSLATION_MESSAGE_NEW_POSITION_SIZE "Новый размер позиции" +#define TRANSLATION_MESSAGE_CANNOT_TAKE_SMALLER_TRADE "Невозможно открыть меньшую сделку." +#define TRANSLATION_MESSAGE_ARE_YOU_SURE "Вы уверены, что хотите закрыть Position Sizer?" +#define TRANSLATION_MESSAGE_EXIT "Выйти?" \ No newline at end of file diff --git a/MQL5/Experts/Position Sizer/Translations/Ukrainian.mqh b/MQL5/Experts/Position Sizer/Translations/Ukrainian.mqh index c7a545a..7d03868 100644 --- a/MQL5/Experts/Position Sizer/Translations/Ukrainian.mqh +++ b/MQL5/Experts/Position Sizer/Translations/Ukrainian.mqh @@ -95,13 +95,19 @@ #define TRANSLATION_LABEL_POSITION_SIZE "Розмір позиції" #define TRANSLATION_BUTTON_MAX_PS "Макс РП" #define TRANSLATION_LABEL_POINT_VALUE "Ціна пункту" +#define TRANSLATION_TOOLTIP_INPUTS "Поля в цьому стовбці розраховуються на основі введених даних" +#define TRANSLATION_TOOLTIP_RESULT "Поля в цьому стовбці скориговані з огляду на обмеження брокера" // Risk tab #define TRANSLATION_CHECKBOX_COUNT_PENDING_ORDERS "Рахувати відкладені ордери" #define TRANSLATION_CHECKBOX_IGNORE_ORDERS_WO_SL "Ігнорувати ордери без стоп-лосу" #define TRANSLATION_CHECKBOX_IGNORE_ORDERS_WO_TP "Ігнорувати ордери без тейк-профіта" -#define TRANSLATION_CHECKBOX_IGNORE_ORDERS_IN_OTHER_SYMBOLS "Ігнорувати ордери по іншим символам" +#define TRANSLATION_LABEL_IGNORE_TRADES_IN "Ігнорувати" +#define TRANSLATION_BUTTON_SYMBOLS_NO "нічого" +#define TRANSLATION_BUTTON_SYMBOLS_OTHER "інш. символи" +#define TRANSLATION_BUTTON_SYMBOLS_CURRENT "пот. символ" +#define TRANSLATION_BUTTON_SYMBOLS_TOOLTIP "Перемикайте поміж «нічого», «іншими символами» та «поточним символом»." #define TRANSLATION_LABEL_LOTS "Лоти" #define TRANSLATION_LABEL_CURRENT_PORTFOLIO "Поточ. портфоліо" #define TRANSLATION_TOOLTIP_CURRENT_PORTFOLIO "Угоди, що зараз є відкритими" @@ -144,6 +150,7 @@ #define TRANSLATION_LABEL_PER_PS "за РП" #define TRANSLATION_LABEL_BASE_CURRENCY "Базова валюта" #define TRANSLATION_LABEL_MARGIN_CURRENCY "Валюта маржі" +#define TRANSLATION_LABEL_PROFIT_CURRENCY "Валюта прибутку" // Trading tab @@ -169,6 +176,7 @@ #define TRANSLATION_LABEL_MAX_SPREAD "Макс спред" #define TRANSLATION_LABEL_MAX_ENTRY_SL_DISTANCE "Макс відстань Вхід/СЛ" #define TRANSLATION_LABEL_MIN_ENTRY_SL_DISTANCE "Мін відстань Вхід/СЛ" +#define TRANSLATION_LABEL_MAX_RISK_PERCENTAGE "Макс ризик %" #define TRANSLATION_CHECKBOX_SUBTRACT_OPEN_POSITIONS_VOLUME "Відн. об. відкр. позицій" #define TRANSLATION_CHECKBOX_SUBTRACT_PENDING_ORDERS_VOLUME "Відн. об. відкл. ордерів" #define TRANSLATION_CHECKBOX_DO_NOT_APPLY_STOPLOSS "Не застосовувати СЛ" @@ -234,6 +242,8 @@ #define TRANSLATION_MESSAGE_NTAT_SPREAD "поточний спред" #define TRANSLATION_MESSAGE_MAXIMUM_SPREAD "максимальний спред" #define TRANSLATION_MESSAGE_NTAT_ENTRY_SL_DISTANCE "поточна відстань Вхід/СЛ" +#define TRANSLATION_MESSAGE_NTAT_CURRENT_RISK "поточний результат по ризику" +#define TRANSLATION_MESSAGE_NTAT_MAX_RISK "максимальний ризик" #define TRANSLATION_MESSAGE_NTAT_TOTAL_NUMBER "поточна загальна кількість угод" #define TRANSLATION_MESSAGE_NUMBER_OF_TRADES_IN_EXECUTION "кількість угод на виконанні" #define TRANSLATION_MESSAGE_MAXIMUM_TOTAL_NUMBER_OF_TRADES_ALLOWED "максимально припустима загальна кількість угод" @@ -309,4 +319,9 @@ #define TRANSLATION_MESSAGE_MINIMUM_EXPIRY "Мінімальний термін дії відкладеного ордеру - 2 хвилини." #define TRANSLATION_MESSAGE_DONOTAPPLLYSL_SET "Відмічено чекбокс 'Не застосовувати СЛ'." #define TRANSLATION_MESSAGE_DONOTAPPLLYTP_SET "Відмічено чекбокс 'Не застосовувати ТП'." -#define TRANSLATION_MESSAGE_FAILED_TO_CREATE_OUTSIDE_BUTTON "Помилка при створенні зовнішньої кнопки." \ No newline at end of file +#define TRANSLATION_MESSAGE_FAILED_TO_CREATE_OUTSIDE_BUTTON "Помилка при створенні зовнішньої кнопки." +#define TRANSLATION_MESSAGE_TAKING_SMALLER_TRADE "Відкриття угоди меншого розміру" +#define TRANSLATION_MESSAGE_NEW_POSITION_SIZE "Новий розмір позиції" +#define TRANSLATION_MESSAGE_CANNOT_TAKE_SMALLER_TRADE "Меншу угоду неможливо відкрити." +#define TRANSLATION_MESSAGE_ARE_YOU_SURE "Ви впевнені, що хочете закрити Position Sizer?" +#define TRANSLATION_MESSAGE_EXIT "Вийти?" \ No newline at end of file