I sent this yesterday by email but I'm not sure the email system is working as have not received the regular auto-response (tried twice). Sorry for any duplication!
I'm after some help with the an indicator I'm trying to write.
I'm trying to load data from a secondary timeframe retrieving values of an indicator on the secondary timeframe so I can use those values to plot on the primary timeframe chart.
I inherited the indicator which calculates the values I need (called NeuTrendForTimeframeTitan) and I'm creating an indicator called TimeframeTitan.
NeuTrendForTimeframeTitan has 3 values that I'm looking to get:
Trigger (double)
Average (double)
UpTrend (bool)
I reviewed the SampleSyncSecondarySeries example from the help pages but my interpretation of this must be wrong as I'm getting the below error:
Indicator 'Timeframe Titan': 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
Could you help me out with this?
private Series<double> primarySeries; private Series<double> htfTrigger; private Series<double> htfAverage; private Series<bool> htfUpTrend; [COLOR=#222222][FONT=Arial][/FONT][/COLOR]
else if (State == State.DataLoaded)
{
NeuTrend1 = NeuTrendForTimeframeTitan(false, 30, Brushes.Green, Brushes.Red, false, 10, Brushes.Green,
Brushes.Red, false, "", false, Brushes.Green, Brushes.Red, Brushes.Green, Brushes.Red);
primarySeries = new Series<double>(this, MaximumBarsLookBack.Infinite);
htfTrigger = new Series<double>(SMA(BarsArray[1], 50), MaximumBarsLookBack.Infinite);
htfAverage = new Series<double>(SMA(BarsArray[1], 50), MaximumBarsLookBack.Infinite);
htfUpTrend = new Series<bool>(this, MaximumBarsLookBack.Infinite);
}
[COLOR=#222222][FONT=Arial][/FONT][/COLOR]
protected override void OnBarUpdate()
{
if (CurrentBar < BarsRequiredToPlot)
return;
if (BarsInProgress == 1)
{
if (CurrentBar < BarsRequiredToPlot) return;
htfTrigger[0] = NeuTrend1.Trigger[0];
htfAverage[0] = NeuTrend1.Average[0];
htfUpTrend[0] = NeuTrend1.UpTrend[0];
Print(Time[0] + " htfTrigger: " + htfTrigger[0] + " htfAverage: " + htfAverage[0] + " htfUpTrend: " + htfUpTrend[0]);
}
}
[COLOR=#222222][FONT=Arial][/FONT][/COLOR]
Thanks in advance
Tim

Comment