Custum Indicator: Draw line only every x bars

 

Hello,

I don't know how to do this:


I want to calculate and draw the indicator line just every 5 bars.

My idea was:

if(MathMod(i,deltaBars) == 0){...} //deltBars = 5

this works for optimisaton but not live.


Can anybody help?