Download MetaTrader 5
To add comments, please log in or register
Share links on the Forum. Now they have Rich Content!
sebastian1121
47
sebastian1121 2014.04.04 00:06 

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:
Keith Watford
Moderator
7904
Keith Watford 2014.04.04 00:25  

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

SYED NAUFAL GADDAFI
1401
SYED NAUFAL GADDAFI 2014.04.04 00:38  
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.

qjol
3243
qjol 2014.04.04 01:19  
or you can put the EA a Sleep while GetLastError == 4066
Tjipke de Vries
6277
Tjipke de Vries 2014.04.04 05:28  
int start()
  {
  if(AccountBalance()==0)return(0);
SYED NAUFAL GADDAFI
1401
SYED NAUFAL GADDAFI 2014.04.04 07:42  
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
qjol
3243
qjol 2014.04.04 09:33  

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)

SYED NAUFAL GADDAFI
1401
SYED NAUFAL GADDAFI 2014.04.04 10:52  
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. :)
qjol
3243
qjol 2014.04.04 10:55  
the account balance is updated before the charts history
MikeBor
7
MikeBor 2014.04.04 11:00  
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.
Alain Verleyen
Moderator
28551
Alain Verleyen 2014.04.04 12:05  
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.
/ /12
To add comments, please log in or register