I developed an indicator which takes a long time on every "OnBarUpdate".
I would like to test it on historical data, but i only want it to run on the last bar (the most current one).
I can test it on live data with "if (Historical) return;", but as i said i need to test it on historical data of different time frames as well.
I found the idea of checking "if (Double.IsNaN(Close[-1]))", but i cant get it to work, it just seems to quit when it reaches the last bar, even when it is surrounded by a try/catch block.
Any ideas?
Thanks a lot!
EDIT: for reproducing, this is what i tried last:
try{
Print(CurrentBar + " testing " + Close[-1]);
}catch(Exception e){
Print ("exception at " + CurrentBar + " " + e.ToString() );
}
Comment