Candlestick EA generating signals at 19:00 on 4 hour chart

 

I have written an EA to trade using candlestick patterns and I'm mainly testing it on the 4 hour timeframe.

Using historical data, the majority of all trades are executed at the expected times - 08:00, 12:00, 16:00, 20:00

But for some reason, there are a significant number of trades at 19:00

I have checked the history data and can see that each bar has the expected time stamps at 08:00, 12:00 etc - there are no bars timed at 19:00

However, looking at the journals and the history data, I can see the following: Large gaps in the 1 minute history data eg nothing from 14:59 until 19:00. 

Clearly this is the start of the problem, so when MT4 generates the simulated ticks, there is no change in price until 19:00. So I understand part of the problem here, but not quite.

This goes against my original understanding - my assumption was that if using 4 hour timeframe, the backtester would still generate the 4h bar at 16:00 and this should still trigger my signal (if conditions are met for the bar open/close etc)

So I think my question comes down to  - the difference between running the algo using strict ticks as per change in price, or using 4 hour bars regardless even if the price is actually static.

I expect the behaviour will be different in production in any case, because the ticks will not have gaps like the history data.

I think the question I am asking here is this: how do I get my MQL4/MT4 to create the 4H bar at 16:00 and assess the state of the signal at that point, regardless of when the last tick happened?

Thanks,


Col

Reason: