will ea recognise old order if it restarts?

jiasheng09
65
jiasheng09  
can i ask that if my ea place some orders and then i addientally  close the chart tgt with the ea, when i load it back agn, the orders is still there, but will my ea recognise those previous order ?
Juvenille Emperor Limited
Moderator
14170
Eleni Anna Branou  
jiasheng09:
can i ask that if my ea place some orders and then i addientally  close the chart tgt with the ea, when i load it back agn, the orders is still there, but will my ea recognise those previous order ?

It depends on the EA, how is coded and if it uses a magic number in order to manage its trades.

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

  2. 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 / Position select loop to recover, or persistent storage (GV+flush or files) of ticket numbers required.

    On a network disconnection you might get ERR_NO_RESULT or ERR_TRADE_TIMEOUT. There is nothing to be done, but log the error, return and wait for a reconnection and a new tick. Then reevaluate.

Keith Watford
Moderator
26136
Keith Watford  
jiasheng09:
can i ask that if my ea place some orders and then i addientally  close the chart tgt with the ea, when i load it back agn, the orders is still there, but will my ea recognise those previous order ?

Do not double post!

I have deleted your duplicate post.