I already managed to make it work on a time Chart, like an 1 Minute Chart. The main part of my indicator is the following loop:
// While index is smaller than the number of rows in the table
if(index < count)
{
if (BarsInProgress == 0)
{
Values[0][0] = 0; Values[1][0] = Delta_values[index-1];
}
if(BarsInProgress == 1) index ++;
}
The problema is the using BarsInProgress == 0 seems to work only in the minute Charts. As a matter of fact, I am getting the opening of a bar, so to compensate, I subtract 1 when indexing Delta_values.
Then I tried another solution: using
if (Bars.BarsPeriod.Value == Bars.TickCount)
in place of
if (BarsInProgress == 0)
This solution also didn't work for Renko and gave out of bounds results for minutes:
"Indicator 'CumulativeDelta': Error on calling 'OnBarUpdate" method on bar -1: You are accessing an index with a value that is invalid since it is out-of-range.
Can anyone tell me why this new solution generate an out of bounds error? Is this solution a good one?
Thank you,
Claudio
Comment