Indicator calculated on selceted bars only

 

hi folks,

I tried to modify one of my iondicators so that a partial number of Bars (=partial timespan) is calculated and showed in the chart window Only,

i.e. for example that the Bars 50 to 100 should be used/calculated and shown by the indicator only.

I tried some ideas with the indicatorcounted() function but that doesn't seem to be the way.

If anybody has ideas, thanks very much in advance of course!

 
  1. Standard indicator uses:
    for (int shift = Bars - 1 - IndicatorCounted(); shift >=0; shift--){ ...
  2. Skip the first n-1 bars
    SetIndexDrawBegin(0,SmaLength);
    :
    for (int shift = MathMin(Bars - 1 - IndicatorCounted(), Bars - SmaLength); shift >=0; shift--){ ...
  3. Draw the last n bars
    for (int shift = MathMin(Bars - 1 - IndicatorCounted(), Limit); shift >=0; shift--){ ...

Reason: