|
Myslenice Poland
Posts: 25 since Aug 2019
Thanks Given: 6
Thanks Received: 8
|
Hey there :-)
I have a question about using Multi-Timeframes in . I've tried to use in my indicator three different Timeframes, 1. my actual Chart-Timeframe, 2. Range-10 and 3. Range-30. The first line after OnBarUpdate() is
if (CurrentBars[0] < BarsRequiredToPlot || CurrentBars[1] < BarsRequiredToPlot || CurrentBars[2] < BarsRequiredToPlot)
return;
If I try to start up, I got this error:
Error calling 'OnBarUpdate' method at Bar 20: You are accessing an index with an invalid value that is outside the expected range. E.g. Access a row with [BarsAgo] with a value of 5 if there are only 4 candles in the chart.
I know, what this error means and I have tried some options to fix it, for example I have changed RequiredBarsToPlotfrom 20 to 256 and changes the OR-Operator between CurrentBars to AND. That fixed the problem, if the Bar-Value on my Chart is between the two additional timeframes. But if I want to change my Chart-Timeframe to lower Values, for example to Range 4, Tick or anything else, I got this error immediatly. I have marked the whole Indicator-Logic as a comment, to rule out other sources of error.
I think that the spread between the lowest and the highest Timeframe could be too big, because for an 30-Range-Bar you need hundreds of Ticks or 4-Range-Bars and this could be the problem, when data is loading. Am I right with this assumption?
Is there a way to work around the problem? The same problem should arise, if someone calculates Res/Sup-Lines on Daily-Timeframe, but trades it in 10min or Tick.
Ani suggestions?
|