Real-time test on EA

 
Hello there, 

I created an EA that catches spikes. I backtested and it worked fine. But it fails to catch those spikes during a real-time test. Instead, it opens the position after the market has spike
 
A number of factors can be causing that..things like the tick modelling during backtests, timeframe and problems within the code 
 
Kekeletso Mofokeng #:
A number of factors can be causing that..things like the tick modelling during backtests, timeframe and problems within the code 
Could you suggest a realistic tick modeling and currently running it on a 1min time frame
 
That is hard to do without knowing how your code scans for the spikes...things like does it open positions after new bar
 
Kekeletso Mofokeng #:
That is hard to do without knowing how your code scans for the spikes...things like does it open positions after new bar
It uses the onTick function to monitor the pip movement of a candle. 

For instance, get the open and the close price on the current candle. If it is greater than 45 pips. It sends an order to open a position 
 
Alfred Nwanokwai #:
It uses the onTick function to monitor the pip movement of a candle. 

For instance, get the open and the close price on the current candle. If it is greater than 45 pips. It sends an order to open a position 

That the problem...the current bar doesn't have a close price just a high and a low and open 

 

You can adjust your code to something like.

for buy: if (current high - current open) is greater than 45 points buy

for sell: if (current open - current low) is greater than 45 points sell

 
Kekeletso Mofokeng #:

That the problem...the current bar doesn't have a close price just a high and a low and open 

Okay, thank you. Will fixed this now. 
 
Kekeletso Mofokeng #:

You can adjust your code to something like.

for buy: if (current high - current open) is greater than 45 points buy

for sell: if (current open - current low) is greater than 45 points sell

Okay, on it
 
Alfred Nwanokwai #:
Okay, on it

Yes this should fix it and when you do your backtesting use everytick for optimization and everytick based on real ticks for final testing