Hi, I've been coding in MT4 for a while now but for a current project I need to detect the end of the bar, or point close to the end of the bar. There is no option to use the open of the new bar unfortunately.
I've tried two bits of code so far, firstly:
Minute() > 58
and a bit of code I found on here:
TimeCurrent() >= Time[0] + (Period() * 60 - 1)
The problem I am having is not with the code but in the backtesting, sometimes the conditions aren't met, as in the backtesting never properly simulates a tick for the final minutes of the bar.. Sometimes it does seem to work fine though.
I've looked through the data and there does seem to be minute data for that time period. I can't work out why it doesn't show the tick.
PS I am aware that when forward testing it if no ticks come through then the event may be missed.
Thanks for your help!
I've tried two bits of code so far, firstly:
Minute() > 58
and a bit of code I found on here:
TimeCurrent() >= Time[0] + (Period() * 60 - 1)
The problem I am having is not with the code but in the backtesting, sometimes the conditions aren't met, as in the backtesting never properly simulates a tick for the final minutes of the bar.. Sometimes it does seem to work fine though.
I've looked through the data and there does seem to be minute data for that time period. I can't work out why it doesn't show the tick.
PS I am aware that when forward testing it if no ticks come through then the event may be missed.
Thanks for your help!