help me please?

 

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

Files:
 

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

 
GumRai:

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.

 
or you can put the EA a Sleep while GetLastError == 4066
 
int start()
  {
  if(AccountBalance()==0)return(0);
 
if(AccountBalance()==0)return(0);

Been asked many times here at this forum. Just the way of questioning is a bit different though. LOL XD
 

deVries:

int start()
  {
  if(AccountBalance()==0)return(0);

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)

 
qjol:

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)


As I notice it when I account balance not updating correctly when initializing, I simply put a timer to check for incoming tick. When the tick comes, everything shows the expected numbers. :)
 
the account balance is updated before the charts history
 
Hello guys, wanted to share this free <link removed> with you. I do not know which topic to choose, sorry if it is incorrect. It shows good results and small profit.
 
MikeBor:
Hello guys, wanted to share this free <link removed> with you. I do not know which topic to choose, sorry if it is incorrect. It shows good results and small profit.
You can't do that on this forum. Advertising is not allowed, even if it's free product. Thank you.
Reason: