update of OrderStopLoss() after OrderModify()

 

hi,

i have run into something which is a little puzzling. i am modifying the stoploss of a trade using OrderModify(). i have checked the return value and the stoploss shift was successful and it is logged as something like:

20:21:28 2010.07.16 08:10  grapple GBPUSD,H1: modify #5 sell 1.65 GBPUSD at 1.54107 sl: 1.54107 tp: 1.53911 ok

but when i shortly thereafter call OrderStopLoss() for the same ticket, i find that the returned value is the OLD value of the stoploss and not the new one:

20:21:28 2010.07.16 08:10  grapple GBPUSD,H1: COMPARE 1.54137

i thought that maybe a call to RefreshRates() would update the return value, but no luck there.

any ideas why it would behave like this? and, more importantly, how to get around it?

thanks,

andrew.

 

Selecting the order again will update the OrderStopLoss(). Its similar to updating the price with resfreshrates.

 
thanks, that did the trick!
 
Bence Németh: what dou you mean by selecting the order again?

You can not use any Trade Functions until you first select an order.

Perhaps you should read the manual.
   How To Ask Questions The Smart Way. 2004
      How To Interpret Answers.
         RTFM and STFW: How To Tell You've Seriously Screwed Up.

 
Bence Németh: I want my stop loss move to BE. But the OrderStoppLoss() function stays at the original SL, not the modified one.

Did you select the order again after successfully modifying the order? What part of:

[Deleted]: Selecting the order again will update the OrderStopLoss(). Its similar to updating the price with resfreshrates.

was unclear?

 
  1. Don't double post! You already had this thread open.
              General rules and best pratices of the Forum. - General - MQL5 programming forum 2017.07.19


  2. Bence Németh: Could you please help me to fix my code?
    Help you with what? You already know how to select an order.
 
Bence Németh:
This is the selection of an order: 

Where should I pass this?  After the 'return'? I don't really understand, sorry.

I have deleted your duplicate topic. Your code will only modify the SL if condition is also met to modify the TP.

How do you know that the SL is not being modified?

Reason: