I use below code to terminate my indicator run. However, if I load 5 years of 1 hour chart, even though I call below code on Bar 10, logic still runs through 1000s more bars before it actually terminates, which is visible in output window since I do Print(CurrentBar);. Is there any way to terminate the run right after bar 10 and not go further?
Thanks,
redduke
protected override void OnBarUpdate()
{
if(CurrentBar==10){
SetState(State.Terminated);
return;
}
Print(CurrentBar);
}

Comment