Retrieving the original SL of an open order

 

Dear All,

Can someone please give me some clues as to how I could retrieve the original value of SL in an open order after the SL has been moved to BE or beyond?

Please note I am using MQL4 and not MQL5.

Thanks in advance,

Jaya

 
jaya7838: Can someone please give me some clues as to how I could retrieve the original value of SL in an open order after the SL has been moved to BE or beyond?
Does not exist, you must remember it.
EAs must be coded to recover. If the power fails, OS crashes, terminal or chart is accidentally closed, on the next tick, any static/global ticket variables will have been lost. You will have an open order but don't know it, so the EA will never try to close it, trail SL, etc. How are you going to recover? Use a OrderSelect loop to recover, or persistent storage (GV+flush or files) of ticket numbers required.
 

I guess I have to save the ticket number and the SL both in GVs. I am using this on a multiple pair terminal. Are GVs available in array form? Did some searching but couldn't find any info.

 
jaya7838: I guess I have to save the ticket number and the SL both in GVs. I am using this on a multiple pair terminal. Are GVs available in array form? Did some searching but couldn't find any info.
  1. Of course there isn't an array form.
  2. Why would you save the ticket number? You can get those from an OrderSelect loop.
  3. Make the name of the GV contain the ticket (e.g. OSL14003637.) The value of the GV is the original SL.
Reason: