Plot2.Set(dateTime2[0])
the momentum for the first BarsArray plots correctly. If I then change
Plot1.Set(dateTime1[0]) to Plot1.Set(dateTime2[0])
it plots out the second BarsArray.
Why does Plot2.Set cause an error? I'm sure there is something simple I am missing.... Thanks
public class MutliTimeframePlot : Indicator
{
#region Variables
private DataSeries dataTime1;
private DataSeries dataTime2;
#endregion
protected override void Initialize()
{
Add(PeriodType.Minute, 5);
Add(PeriodType.Minute, 15);
dataTime1 = new DataSeries(this);
dataTime2 = new DataSeries(this);
CalculateOnBarClose = true;
Overlay = false;
}
protected override void OnBarUpdate()
{
if (BarsInProgress == 0)
{
if (CurrentBar < 100) return;
dataTime1[0] = Momentum(BarsArray[1], 14)[0];
dataTime2[0] = Momentum(BarsArray[2], 14)[0];
Plot1.Set(dataTime1[0]);
Plot2.Set(dataTime2[0]);
}
if (BarsInProgress == 1)
{
}
if (BarsInProgress == 2)
{
}
}
#region Properties
[Browsable(false)]
[XmlIgnore()]
public DataSeries Plot1
{
get { return Values[0]; }
}
[Browsable(false)]
[XmlIgnore()]
public DataSeries Plot2
{
get { return Values[1]; }
}
#endregion
}
Comment