How do I get the DataSEries / IntSeries / BoolSeries to attach to the Secondary Series? The following code wants to attach to the Primary Series.
The following code throws Exception:
BIP == 1: Bar: 13
Exception: System.ArgumentOutOfRangeException: Index was out of range. Must be non-negative and less than the size of the collection.
Parameter name: index
at System.Collections.ArrayList.get_Item(Int32 index)
at NinjaTrader.Data.DataSeries.Set(Double value)
at NinjaTrader.Indicator.MTFDataSeriesTest.OnBarUpdat e()
protected override void Initialize()
{
ClearOutputWindow();
Overlay = true;
Add(PeriodType.Minute, 60); // BarsArray[1]
BarsRequired = 0;
myDataSeries = new DataSeries(this, MaximumBarsLookBack.Infinite);
}
/// <summary>
/// Called on each bar update event (incoming tick)
/// </summary>
protected override void OnBarUpdate()
{
if(BarsInProgress == 0)
{
// Primary Series will be Daily Chart
// Print(String.Format("BIP == 0: CurrentBar: {0} Time: {1} Close: {2:0000.00}", CurrentBar, Time[0], Close[0] ));
}
if(BarsInProgress == 1)
{
// Secondary Series will be 60 Minute Chart
try
{
myDataSeries.Set(Close[0]);
// Print(String.Format("\t\tBIP == 1 Bar: {0} Time: {1} {2:0000.00}", CurrentBar, Time[0], myDataSeries[0] ));
}
catch (Exception e)
{
Print(String.Format("BIP == 1: Bar: {0}", CurrentBar ));
Print(String.Format("Exception: {0}", e ));
}
}
}
Comment