Hello there thanks for taking the time to click my post, I needed some help with editing an EA that I have.
the main problem I'm having is that its opening new trades at random places. What i mean is, say I set up my expert adviser and then shutdown mt4. Then say I come back 24 hours later and re-open it, the expert adviser will open new trades as if i miraculously arrived at the right moment all the parameters lined up.
I'm experimenting with "only short" "only long" options in the common section. I'm using price action and some other indicators to determine weather I want the ea to only take long or short positions. THE PROBLEM is the ea will take a new trade as soon as go from only long to only short or vise versa. as if its registering the last buy/sell command from many many pips ago
I've not looked at the code, but it is possible that the history is updating and so you are getting undesired results.
Click on expert advisors to disable them as soon as the platform opens and before it connects to the internet
Disable EAs before shutting down the platform
Write code in init to deal with platform re-starts
Nah. Just put a timer. Simple as that.
Or, put a checks before opening any trades.
not true at all, because the account balance is taking let's say 2 sec to get the right value
and then you need a few more seconds for history update (i mean the charts history not orders history)