You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
1. Added a dark theme mode, which can be set via the DarkMode input parameter.
2. Added an option to display breakeven lines at levels where the Position Sizer will apply breakeven to existing positions.
3. Added the Entry line label to display the distance from the current price to the Entry level for pending orders.
4. Added input parameters (ShowMaxParametersOnTrading, ShowFusesOnTrading, and ShowCheckboxesOnTrading) to make the Trading tab more compact.
5. Added separate total and per-symbol fields to control volume, risk, and number of trades on the Trading tab.
6. Added an input parameter (SettingsFile) to let users load their own custom settings file with panel fields configured according to their needs. The EA won't delete custom settings files.
7. Added two new hotkeys — to set a stop-loss (SetStopLossHotKey) and a take-profit (SetTakeProfitHotKey) to the price level at the mouse pointer's current position.
8. Added an option to change the translation of the panel's interface in MetaTrader 5. Language files are currently only available for Ukrainian and Russian. Users can create and use their own translation files.
9. Changed the breakeven mechanism to take into account the size of the commission if UseCommissionToSetTPDistance is set to true.
10. Changed the additional TP fields to appear with some non-zero value if the main TP is non-zero.
11. Fixed a bug when switching the chart's symbol could result in line labels disappearing if SymbolChange was set to Keep panel as is.
12. Fixed a bug in the MT5 version that resulted in the trade type not resetting properly when SymbolChange was set to Reset to defaults on symbol change.
13. Fixed a bug that resulted in false warnings and incorrect position size calculation when the EA failed to get the symbol information at the first attempt.
14. Fixed a bug that resulted in some of the +/- buttons to remain on the chart when the panel was minimized.
15. Fixed a bug that resulted in the stop-loss not keeping its correct distance when SLDistanceInPoints was set to true.
16. Fixed a bug when the additional funds asterisk remained visible even when the panel was minimized.
17. Fixed a bug in the MT5 version that resulted in the risk field resetting to default when the user clicked on the position size field after setting it to a custom value.
18. Fixed a bug that resulted in the stop-loss line sometimes disappearing on a symbol change.
19. Fixed a bug in the MT5 version that resulted in the Stop Price line appearing after switching from Stop Limit to Instant and setting the DisableStopLimit input parameter to true.
20. Fixed a bug that would result in wrong value appearing in the account size field after clicking on it and then clicking outside if the value contained a thousands separator.
21. Fixed a bug in the MT5 version that caused a critical 'array out of range' error when clicking on the +/- buttons for a single take-profit field.
22. Fixed a bug in the MT4 version that caused a critical 'array out of range' error when switching the chart symbol to a one with more additional TPs saved in a settings file.
23. Fixed a bug that caused the risk to be calculated based on the percentage value instead of the money value when Custom Balance was updated even if the MoneyRisk parameter was greater than 0.
24. Fixed a bug with ATR timeframe button not working.
25. Fixed a bug with incorrect volume share allocation when adding a new TP.
26. Fixed a bug in the MT5 version that caused a critical 'stack overflow' error when the EA failed to convert a symbol's profit or margin currency.
27. Fixed a bug that would cause TP values set in points to shift when dragging doing some unrelated chart manipulations.
if ((sets.MaxNumberOfTradesTotal > 0) || (sets.MaxNumberOfTradesPerSymbol > 0))
102
102
{
103
103
inttotal = OrdersTotal();
104
-
intcnt = 0;
104
+
intcnt = 0, persymbol_cnt = 0;
105
105
for (inti = 0; i < total; i++)
106
106
{
107
107
if (!OrderSelect(i, SELECT_BY_POS)) continue;
108
108
if ((sets.MagicNumber != 0) && (OrderMagicNumber() != sets.MagicNumber)) continue;
109
-
if ((!sets.AllSymbols) && (OrderSymbol() !=Symbol())) continue;
109
+
if (OrderSymbol() ==Symbol())persymbol_cnt++;
110
110
cnt++;
111
111
}
112
-
if (cnt>=sets.MaxNumberOfTrades)
112
+
if ((cnt+ sets.TakeProfitsNumber >sets.MaxNumberOfTradesTotal) && (sets.MaxNumberOfTradesTotal > 0))
113
113
{
114
-
Alert("Not taking a trade - current # of traes (", cnt, ") >= maximum number of trades (", sets.MaxNumberOfTrades, ").");
114
+
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, ").");
115
+
return;
116
+
}
117
+
if ((persymbol_cnt + sets.TakeProfitsNumber > sets.MaxNumberOfTradesPerSymbol) && (sets.MaxNumberOfTradesPerSymbol > 0))
118
+
{
119
+
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, ").");
Alert("Not taking a trade - potential risk per symbol (", DoubleToString(risk, 2), ") >= maximum risk per symbol allowed (", DoubleToString(sets.MaxRiskPerSymbol, 2), ").");
153
+
return;
154
+
}
155
+
}
156
+
else
157
+
{
158
+
Alert("Not taking a trade - infinite potential risk per symbol.");
if ((sets.MaxPositionSizeTotal > 0) && (sets.MaxPositionSizePerSymbol > 0))
193
217
{
194
218
inttotal = OrdersTotal();
195
-
doublevolume = 0;
219
+
doublevolume = 0, volume_persymbol = 0;
196
220
for (inti = 0; i < total; i++)
197
221
{
198
222
if (!OrderSelect(i, SELECT_BY_POS)) continue;
199
223
if ((sets.MagicNumber != 0) && (OrderMagicNumber() != sets.MagicNumber)) continue;
200
-
if ((!sets.AllSymbols) && (OrderSymbol() !=Symbol())) continue;
224
+
if (OrderSymbol() ==Symbol())volume_persymbol += OrderLots();
201
225
volume += OrderLots();
202
226
}
203
-
if (volume + PositionSize > sets.MaxPositionSize)
227
+
if ((volume + PositionSize > sets.MaxPositionSizeTotal) && (sets.MaxPositionSizeTotal > 0))
204
228
{
205
-
Alert("Not taking a trade - current total volume (", DoubleToString(volume, LotStep_digits), ") + new position volume (", DoubleToString(PositionSize, LotStep_digits), ") >= maximum total volume (", sets.MaxPositionSize, ").");
229
+
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), ").");
230
+
return;
231
+
}
232
+
if ((volume_persymbol + PositionSize > sets.MaxPositionSizePerSymbol) && (sets.MaxPositionSizePerSymbol > 0))
233
+
{
234
+
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), ").");
206
235
return;
207
236
}
208
237
}
@@ -480,7 +509,38 @@ void DoTrailingStop()
480
509
// Sets SL to breakeven based on the Magic number and symbol.
481
510
voidDoBreakEven()
482
511
{
483
-
if ((!TerminalInfoInteger(TERMINAL_TRADE_ALLOWED)) || (!TerminalInfoInteger(TERMINAL_CONNECTED)) || (!MQLInfoInteger(MQL_TRADE_ALLOWED))) return;
512
+
if (!TerminalInfoInteger(TERMINAL_CONNECTED)) return;
if ((be_line_color != clrNONE) && (BE_price > OrderStopLoss())) DrawBELine(OrderTicket(), BE_threshold, BE_price); // Only draw if not triggered yet.
572
+
if ((Bid >= BE_threshold) && (Bid >= BE_price) && (BE_price > OrderStopLoss())) // Only move to BE if the price reached the necessary threshold, the price is above the calculated BE price, and the current stop-loss is lower.
496
573
{
497
574
// Write Open price to the SL field.
498
-
if (!OrderModify(OrderTicket(), OrderOpenPrice(), OrderOpenPrice(), OrderTakeProfit(), OrderExpiration()))
575
+
if (!OrderModify(OrderTicket(), OrderOpenPrice(), BE_price, OrderTakeProfit(), OrderExpiration()))
499
576
Print("OrderModify Buy BE failed " + ErrorDescription(GetLastError()) + ".");
500
577
else
501
578
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(OrderStopLoss(), _Digits) + ".");
if ((Ask <= BE) && ((OrderOpenPrice() < OrderStopLoss()) || (OrderStopLoss() == 0))) // Only move to breakeven if the current stop-loss is higher (or zero).
if ((Ask <= BE_threshold) && (Ask <= BE_price) && ((BE_price < OrderStopLoss()) || (OrderStopLoss() == 0))) // Only move to BE if the price reached the necessary threshold, the price below the calculated BE price, and the current stop-loss is higher (or zero).
508
587
{
509
588
// Write Open price to the SL field.
510
-
if (!OrderModify(OrderTicket(), OrderOpenPrice(), OrderOpenPrice(), OrderTakeProfit(), OrderExpiration()))
589
+
if (!OrderModify(OrderTicket(), OrderOpenPrice(), BE_price, OrderTakeProfit(), OrderExpiration()))
511
590
Print("OrderModify Sell BE failed " + ErrorDescription(GetLastError()) + ".");
512
591
else
513
592
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(OrderStopLoss(), _Digits) + ".");
0 commit comments