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 hotkey to set the Entry line to the price level at the mouse pointer's current position (SetEntryHotKey).
2. Added files with Arabic, Chinese (Simplified), and Spanish translations of the panel for the MT5 version of the expert advisor.
3. Fixed a bug that caused TP levels (when set in points) to drift from their given values.
4. Fixed a bug where incorrect previous SL was reported upon application of a trailing stop or breakeven.
5. Fixed a potential 'array out of range' error when switching symbols.
6. Fixed a bug with SL not resetting to default on symbol change when required by the SymbolChange parameter.
7. Fixed a bug when SL and TP lines could get set to levels that don't respect the symbol's tick sizer property.
8. Removed the possibility for the Stop-Loss to be set to zero.
Copy file name to clipboardExpand all lines: MQL4/Experts/Position Sizer/Position Sizer Trading.mqh
+4-2Lines changed: 4 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -575,11 +575,12 @@ void DoBreakEven()
575
575
if ((be_line_color != clrNONE) && (BE_price > OrderStopLoss())) DrawBELine(OrderTicket(), BE_threshold, BE_price); // Only draw if not triggered yet.
576
576
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.
577
577
{
578
+
doubleprev_sl = OrderStopLoss(); // Remember old SL for reporting.
578
579
// Write Open price to the SL field.
579
580
if (!OrderModify(OrderTicket(), OrderOpenPrice(), BE_price, OrderTakeProfit(), OrderExpiration()))
580
581
Print("OrderModify Buy BE failed " + ErrorDescription(GetLastError()) + ".");
581
582
else
582
-
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) + ".");
583
+
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) + ".");
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).
591
592
{
593
+
doubleprev_sl = OrderStopLoss(); // Remember old SL for reporting.
592
594
// Write Open price to the SL field.
593
595
if (!OrderModify(OrderTicket(), OrderOpenPrice(), BE_price, OrderTakeProfit(), OrderExpiration()))
594
596
Print("OrderModify Sell BE failed " + ErrorDescription(GetLastError()) + ".");
595
597
else
596
-
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) + ".");
598
+
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) + ".");
if (!ObjectGetDouble(ChartID(), ObjectPrefix + "StopLossLine", OBJPROP_PRICE, 0, read_tStopLossLevel)) return; // Line was deleted, waiting for automatic restoration.
for (inti = 1; i < sets.TakeProfitsNumber; i++) AdditionalWarningTP[i - 1] = "";
5384
5407
5385
-
if (sets.EntryType == Instant)
5386
-
{
5387
-
if ((Ask > 0) && (Bid > 0))
5388
-
{
5389
-
if (sets.ShowLines)
5390
-
{
5391
-
doubleread_tStopLossLevel;
5392
-
if (!ObjectGetDouble(ChartID(), ObjectPrefix + "StopLossLine", OBJPROP_PRICE, 0, read_tStopLossLevel)) return; // Line was deleted, waiting for automatic restoration.
0 commit comments