calculate only when the bar closes

 

Hello,


I have an indicator that runs really heavy.  Instead of it calculating every tick i want it to calculate once only when the bar closes.  Is there a quick way to do this (like there is in ninjatrader etc) where you can tell it to run only when the bar closes?  Eg.  if it's a 15 min bar, the values get calculated 4 times an hour and not for every tick.

 

For a new bar test, Bars is unreliable (a refresh/reconnect can change number of bars on chart), volume is unreliable (miss ticks), Price is unreliable (duplicate prices and The == operand. - MQL4 programming forum.) Always use time.
          New candle - MQL4 programming forum #3 2014.04.04

I disagree with making a new bar function, because it can only be called once per tick. A variable can be tested multiple times.
          Running EA once at the start of each bar - MQL4 programming forum 2011.05.06

 

Bars[1]- previous bar.

Close[1] -previous close.

 
Aleksandr Morozov:

Bars[1]- previous bar.

Close[1] -previous close.

What parts of “volume is unreliable” and “Price is unreliable” was unclear to you?
Reason: