I hope someonecan be of assistance, since I am kind of a newbie to this mql4/forex thing.
I am building an EA, that does multiple transactions as the day goes on.
For each day, it calculates some global parameters based on the day before.
It also has a time filter.
When trading resumes the following day, the new parameters are adjusted, opened orders from the previous day have their takeprofit modified according to the global parameters, and pending orders are deleted and re-created in new places, thus adapting the strategy from the day before, to the new day.
I know that if my EA keeps running, I can obviously find WHEN the day changes, change current orders, and keep on ticking, using global variables, for instance. HOWEVER, should the EA crash, be disconnected, whatever in one day, and only resume the next, I my global variables are gone. I thought of using comments to keep the date an order was last "touched", mas while it works for the pending ones (I just delete them, and recreate them with different values, including the new "touch" date in the comment), when I get to the already open orders, I hit a bit of a snag. Yes, I can change the takeprofit accordingly... but then I can't change the comment to flag the order as already having been "touched" for the day (because by definition comments cannot be changed,it seems).
So... does anyone have any idea on how to deal with this?
THANKS A LOT IN ADVANCE!
Not a good idea, brokers can change comments, including complete replacement. You can not change comment at all.
When you start, you calculate what the SL should be for the current order based on yesterday's values. If it's more than a pip different from the current SL, modify the order. Otherwise you already did it. No "touch" date is required.
Please enable the necessary setting in your browser, otherwise you will not be able to log in.