I've managed to prevent the plot from displaying beyond a specified bar by making the color transparent, but this approach doesn’t actually reduce the computational effort—it just hides the result visually.
I believe the following code snippet should accomplish what I need:
protected override void (OnBarUpdate()
{
if (CurrentBar < 40)
return;
}
However, when I apply this, it doesn't seem to work as expected. The history still shows beyond the point where the calculcations should stop.
I've included images of two sample indicators where I attempted to implement this, along with bits of the relevant code.
I would appreciate any input on how to make this work effectively. If it can be made to work for the Colored Region indicator, it would likely result in significant computational savings, especially when compared to a simpler two-colored EMA indicator. The actual indicator files are also attached as .cs files for easier review.
sandman

Comment