A question about what happens to an EA when the Trading Platform Closes and Restarts

 

I have an EA that opens its first position when  an active trend line is crossed.

This trend line is removed when the first position is filled so that this active trend line does not interfere with any other orders.

Sometimes the platform closes down. This is rare but it happens.  (I don't mean connection is lost. I mean the actual Metatrader Platform needs to be restarted)

When this happens the EA  resets (re initializes) 

The problem is that if  the active trend line has been crossed and removed before the platform reboots then when the Platform Reboots the EA looks for an active trend line that is no longer there because the EA has re initialized.

The EA also has a partial close feature. A similar problem occurs with the Partial Closes because they all reset when the platform reboots. If a partial close has been hit before the platform reboots, then this partial close will trigger again after the reboot so I end up with partial closes been triggered again at the same price.

My question is rather simple:

Do these 2 issues sound like something that can be easily repaired or should the EA be completely re-coded in a different way that will prevent the problems from happening?

 Thank you all,

 

I think they are not too complicated to repair by the original coder if you can contact him to do it.

I suppose the reason is that the EA is not using static type variables which can be stored in the computer even if it shut down

or the MT4 is restarted.

You may ask for hep at freelancer section. Be sure first that the coder can do it before accepting the bid.

Good luck ... 

 

Yes it can be done but has to be coded as recovery mechanism.

For example it can save to file and then read the file whenever a reboot occurs, then you can have it pop up a messagebox, "Historic setup found, Do you want to recover" etc.

 
Osama Shaban:

I think they are not too complicated to repair by the original coder if you can contact him to do it.

I suppose the reason is that the EA is not using static type variables which can be stored in the computer even if it shut down

or the MT4 is restarted.

You may ask for hep at freelancer section. Be sure first that the coder can do it before accepting the bid.

Good luck ... 

Thank you
 
Marco vd Heijden:

Yes it can be done but has to be coded as recovery mechanism.

For example it can save to file and then read the file whenever a reboot occurs, then you can have it pop up a messagebox, "Historic setup found, Do you want to recover" etc.

Thanks 
 
Brian:
Thanks 
Oh .. That's you Brian. I didn't notice that :) I just reply but noticed you from your PM :)
 
Marco vd Heijden:

Yes it can be done but has to be coded as recovery mechanism.

For example it can save to file and then read the file whenever a reboot occurs, then you can have it pop up a messagebox, "Historic setup found, Do you want to recover" etc.

Hi Marco,

Just to be clear. Do I understand it correctly:

Will all activity in the EA be saved to a file before MT4 closes and then this file is recovered whenever there is a reboot.

So after the reboot, the EA will continue with no problems as if the Platform never turned off?

 

Thanks,

Brian 

 
Brian: Just to be clear. Do I understand it correctly: Will all activity in the EA be saved to a file before MT4 closes and then this file is recovered whenever there is a reboot.
Only if you code it to.
EA's 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.
 
whroeder1:
Only if you code it to.
Thanks. Appreciate your help:)