Problem with "OrderModify error 4108" on OrderModify function

 

I'm asking for help with this error in my expert advisor's code: Failed to modify stop loss for short position (ticket #1). Error code: 4108. "OrderModify error 4108" I hope someone can help me, thanks. Here is the part of the code that returns the error:

if (is_short_position && ticket > 0 && OrderSelect(ticket, SELECT_BY_TICKET))
    {
        if (OrderCloseTime() == 0)
        {
            Print("Previous trade operation is not completed yet.");
            return;
        }

        double new_stop_loss2 = Ask + TrailingStopPips * Point;
        double stop_level = MarketInfo(Symbol(), MODE_STOPLEVEL);
        if (new_stop_loss2 < OrderStopLoss() && new_stop_loss2 > OrderOpenPrice() + stop_level * Point)
        {
            int modify_result = OrderModify(ticket, OrderOpenPrice(), new_stop_loss2, OrderTakeProfit(), 0, Red);
            if (modify_result == false)
            {
                Print("Failed to modify stop loss for short position (ticket #", ticket, "). Error code: ", GetLastError());
            }
            else if (modify_result == -1)
            {
                Print("OrderModify function returned -1 for short position (ticket #", ticket, "). Error code: ", GetLastError());
            }
            else
            {
                Print("Stop loss modified for short position (ticket #", ticket, ")");
            }
        }
    }
 
Luca Cerquatelli:

I'm asking for help with this error in my expert advisor's code: Failed to modify stop loss for short position (ticket #1). Error code: 4108. "OrderModify error 4108" I hope someone can help me, thanks. Here is the part of the code that returns the error:

&& new_stop_loss2 > OrderOpenPrice() + stop_level * Point

Are you sure about this condition? You mean stop loss will never move below open price?

 
Thanks, I fixed it
Reason: