First, to state that I’m using Renko bars.
I’ve got an indicator which detects pivots if the pivot is the highest for the surrounding n bars. That works fine and I can draw a diamond over the pivots.
What I want to achieve is each time a pivot is detected, to place the CurrentBar number into a data series.
This is the essentials of the code:
Variables private int Counter = 1; private int pivotRadius = 4; private DataSeries PivotSeries; Initialize PivotSeries = new DataSeries(this); OnBarUpdate { ... if( HighestBar(High, PivotRadius * 2) == PivotRadius && High[PivotRadius] >= High[PivotRadius * 2] ) { PivotSeries[Counter] = CurrentBar; Counter++; DrawDiamond("Diamond" + CurrentBar, true, PivotRadius, High[PivotRadius] + 2 * TickSize, Color.Brown); } if( CurrentBar >= Count - 2 ) { for (int i = 1; i <= 10; i++) { Print( PivotSeries[i] ); } }
Any help with this would be much appreciated.
Comment