I'm quite new to C# and ninja script and I am having some trouble coding a custom indicator. I need to find the index of the bar with the highest value in a specific interval offset from the current bar. More specifically, I am trying to find the lowest low and highest high for a range of bars - (let's say 12 for the sake of argument) but starting the search from an arbitrary bar index, say 5 bars ago from the current bar.
The standard Ninja Script instruction HighestBar(IDataSeries series, int period) returns the number of bars ago the highest price value occurred for the look back period, where period is an int value that represents the number of bars ago, I presume from the current bar. What I need is a way to specify the bar index from which to start looking for the highest value in the look back period, as if the standard syntax of this instruction were:
HighestBar(IDataSeries series, int period, int start);
where start is the offset from the current bar.
I am sure there is a way to sidestep the absence of this syntax, though I have not yet found it. I would appreciate any hint that could put me in the right direction.