I'm working on a multi-time frame indicator. I'd like to have an indicator taking data from say a 12 range print on a 4 range. I worked it out with a SMA, but when I try to apply the same rules to this SuperTrend indicator I get nothing. Here is my code:
{
#region Variables
private DataSeries UpTrend;
#endregion
protected override void Initialize()
{
Add(new Plot(Color.FromKnownColor(KnownColor.Purple), PlotStyle.Line, "SMALine"));
Add(new Plot(Color.FromKnownColor(KnownColor.Red), PlotStyle.Line, "UpTrend"));
Overlay = true;
Plots[0].Pen.Width = 4;
Plots[0].Pen.Width = 4;
Add(PeriodType.Range, 12);
Add(PeriodType.Range, 12);
UpTrend = new DataSeries(this);
}
protected override void OnBarUpdate()
{
if (CurrentBars[0] < BarsRequired || CurrentBars[1] < BarsRequired || CurrentBars[2] < BarsRequired )
return;
SMALine.Set (SMA(BarsArray[1], 14)[0]) ;
UpTrend.Set (SuperTrend(BarsArray[2],14, 2.618, true).UpTrend[0]) ;
}

Comment