I am trying to perform a simple task of looping between two bars and finding the "Highest High" bar between those two bars (on a Renko chart).
Something like this:
int C=0;
int CBarIndex = 0;
for (int x = ABarIndex+1; x < BBarIndex; x++)
{
if (High[x] > C)
{
C = High[x];
CBarIndex = x;
}
}
GC ##-## (8 Renko): http://i.imgur.com/SATyRcg.png
Instead, I get the correct price, but the wrong bar index:
GC ##-## (8 Renko): http://i.imgur.com/32XsFPk.png
Is there a NinjaTrader built-in method that I should use instead that handles Renko bar reporting in this situation? Or, something different I should do to get the correct bar index? (I've tried looping from A to B or from B to A with the same result.)
I've looked at HighestBar(), but it doesn't look like I can correctly specify the range of bars to look at (but, perhaps I am using it wrong?).
EDIT: Another way to find the price is to do something like this, but it still won't give me the BarIndex, which is the problem.
C = MAX(High,ABarIndex)[BBarIndex];
Thank you!
Daniel
Comment