Writing code in EA to accommodate a communications failure

 

I'm working on a new EA, and have created a flow chart to visually show how it will work, and it hit me.....what happens if for whatever reason, there is a communications failure between the client (my pc) and the server while the EA is running and there are existing orders already placed?  Here's specifically what I'm thinking.....

1. EA is launched on the chart, and conditions are met according to what's been coded in the EA and trades are opened.

2. Communication between the client and server goes down (for whatever reason)

3. Communication is re-established.

So here is where I'm hoping to get some input.  At this point, I'm thinking loading my EA on the chart is NOT going to be a good idea until I either let the existing trades hit their stop or limit, or I do something with them manually.  If I do launch the EA again, then it's starting from 'scratch', not aware of any existing trades open - UNLESS I've written the EA to check for open orders first.

 Just wondering what everybody does for these situations.  I'm thinking about coding the EA so that it checks for open/pending orders first before it does anything in order to accommodate situations like this.  Any thoughts? 

 
mpr:


 Just wondering what everybody does for these situations.  I'm thinking about coding the EA so that it checks for open/pending orders first before it does anything in order to accommodate situations like this.  Any thoughts? 

Your EA should be written so that it can pick up from where it left off.
 
mpr:

I'm working on a new EA, and have created a flow chart to visually show how it will work, and it hit me.....what happens if for whatever reason, there is a communications failure between the client (my pc) and the server while the EA is running and there are existing orders already placed?  Here's specifically what I'm thinking.....

1. EA is launched on the chart, and conditions are met according to what's been coded in the EA and trades are opened.

2. Communication between the client and server goes down (for whatever reason)

3. Communication is re-established.

So here is where I'm hoping to get some input.  At this point, I'm thinking loading my EA on the chart is NOT going to be a good idea until I either let the existing trades hit their stop or limit, or I do something with them manually.  If I do launch the EA again, then it's starting from 'scratch', not aware of any existing trades open - UNLESS I've written the EA to check for open orders first.

 Just wondering what everybody does for these situations.  I'm thinking about coding the EA so that it checks for open/pending orders first before it does anything in order to accommodate situations like this.  Any thoughts? 


first thing you have to know before you open new trades  checking and managing the trades you still have open