Stoploss Modification

 

Hello Everybody,

I'm new on MQL4 and I would like to modify the stoploss of and existing order.

If my trade go up I would like to modify my stoploss, it should be greather than the open price (in case of buy), in this case OrderModify return me error code 130.

Does anyone have a solution to modify the stoploss with a value greather than the openprice ?

Of course, the actual price (Ask) is greather than the stoploss (new value) in case of buy.


Thank you.


Lionel

 
lionelalbo:

the actual price (Ask) is greather than the stoploss (new value) in case of buy.

Check mode stop level.
 
  1. lionelalbo: Of course, the actual price (Ask) is greather than the stoploss (new value) in case of buy.
    You buy at the Ask and sell at the Bid.
    • Your buy order's TP/SL are triggered when the Bid reaches it. Not the Ask.
    • Your sell order's TP/SL will be triggered when the Ask reaches it. To trigger at a specific Bid price, add the average spread.
                MODE_SPREAD (Paul) - MQL4 and MetaTrader 4 - MQL4 programming forum - Page 3
    • The charts show Bid prices only. Turn on the Ask line to see how big the spread is (Tools -> Options {control-O} -> charts -> Show ask line.)

  2. lionelalbo: in this case OrderModify return me error code 130.
    You can't move stops (or pending prices) closer to the market than the minimum (MODE_STOPLEVEL * _Point.)
              Requirements and Limitations in Making Trades - Appendixes - MQL4 Tutorial

Reason: