Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Secondary Series and Data, Int, Bool Series

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Secondary Series and Data, Int, Bool Series

    I add a Secondary Series, 60 Minute to a Primary Daily, and then want to add DataSeries / IntSeries / BoolSeries to the Secondary Series.

    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()


    PHP Code:
            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  ));
                    }                
                }
            } 
    
    Any suggestions would be greatly appreciated.
    Last edited by TAJTrades; 03-24-2012, 07:20 AM.

    #2
    Originally posted by TAJTrades View Post
    I add a Secondary Series, 60 Minute to a Primary Daily, and then want to add DataSeries / IntSeries / BoolSeries to the Secondary Series.

    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()


    PHP Code:
            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
                    if (CurrentBars[1]  < 1) return;
                    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  ));
                    }                
                }
            } 
    
    Any suggestions would be greatly appreciated.
    Correction/addition is in the code.
    Last edited by koganam; 05-02-2014, 09:20 PM.

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by Geovanny Suaza, 02-11-2026, 06:32 PM
    0 responses
    562 views
    0 likes
    Last Post Geovanny Suaza  
    Started by Geovanny Suaza, 02-11-2026, 05:51 PM
    0 responses
    329 views
    1 like
    Last Post Geovanny Suaza  
    Started by Mindset, 02-09-2026, 11:44 AM
    0 responses
    101 views
    0 likes
    Last Post Mindset
    by Mindset
     
    Started by Geovanny Suaza, 02-02-2026, 12:30 PM
    0 responses
    547 views
    1 like
    Last Post Geovanny Suaza  
    Started by RFrosty, 01-28-2026, 06:49 PM
    0 responses
    547 views
    1 like
    Last Post RFrosty
    by RFrosty
     
    Working...
    X