EA closing orders instantly

 

Dear sirs,

I'm using an MA cross EA that closes orders on 8,25 periods and when launched it closes opened order instead of waiting for the cross to happen and then close the opened order although there's no error or anything else showing in the journal.

find attached the EA's that I'm using they're all doing the same.


***

2018.05.10 00:34:17.134 '81132589': order #9964261 buy 0.10 EURUSD at 1.18526 sl: 0.00000 tp: 0.00000 closed at price 1.18513

2018.05.10 00:34:16.800 '81132589': close order #9964261 buy 0.10 EURUSD at 1.18526 sl: 0.00000 tp: 0.00000 at price 0.00000

2018.05.10 00:34:06.882 Expert CloseMaCross EURUSD,H1: loaded successfully

2018.05.10 00:33:26.409 Automated trading enabled

2018.05.10 00:33:17.570 '81132589': order was opened : #9964261 buy 0.10 EURUSD at 1.18526 sl: 0.00000 tp: 0.00000

2018.05.10 00:33:17.276 '81132589': order buy market 0.10 EURUSD sl: 0.00000 tp: 0.00000

***
 
Also i've just figured that even if no EA is attached and i open an order and then turn on autotrading by pressing on the button it also just closes opened orders directly so i'm figuring the problem isn't from the EA but from mt4 ?
 
It is a great piece of work. May be proved to be very useful.
My humble request is, if YOU add magic number to it, so that it can be used on different time-frames of same chart and same currency pair.

Thanx.
 
mohamad hadi i'm figuring the problem isn't from the EA but from mt4 ?

Figure again, it's your code. Use the debugger or print out your variables, including _LastError and find out why.