ea working in demo mode, but giving strange buy and sell signals in strategy tester. how come?

 

I wrote an expert advisor that does what it is intended to do on a demo account (EURUSD 1 hour chart). When I try to test it with strategy tester on the same pair and timeframe I get very strange opened positions.

Anyone interested to give some feedback/help? the mql4 is attached 

Files:
system_42.mq4  4 kb
 

You need to check the return value from OrderSend() to know if it has worked or not,  if it hasn't worked why are you trying to do the OrderModify ?

For a Buy you buy at Ask,  for a Sell you sell at Bid . . . .  not at  Close[1]

Your position size calculation will probably not work for pairs other than XXXUSD.

Reason: