I have an ea on four pairs. At first, the ea is working well, but if I close the platform and open it again in one of the pairs multiple orders start to open.
Could you show me what is wrong?
Thank you in advance
You must change/adapt your code, so that when it starts, it first looks over all currently open orders that have the same Symbol and Magic Number and re-calibrate all the variables accordingly so that it continues to work where it left off. Hopefully, the magic number is not used by any other EA.
Use the "OrderHistory()" to find out how many open or pending orders there are and then go over all of them from last to first (important) using the "OrderSelect()" function. For each order verify the, Magic Number, the Symbol and Order Type to make sure they belong to your specific EA and then adjust the states of the EA's internal variables to reflect this information.
Once the EA has "collected" all the orders details and adjusted accordingly, it can then continue to function as before!
To add comments, please log in or register