• If this is your first visit, you will have to register before you can post. To view messages, please scroll below and select the forum that you would like to visits. Questions? Be sure to check out the Forum FAQ.

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.Minute60);        //    BarsArray[1]
                
    BarsRequired 0;
                
                
    myDataSeries = new DataSeries(thisMaximumBarsLookBack.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.Minute60);        //    BarsArray[1]
                
    BarsRequired 0;
     
                
    myDataSeries = new DataSeries(thisMaximumBarsLookBack.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 aworldnervelink, Today, 12:29 PM
    0 responses
    3 views
    0 likes
    Last Post aworldnervelink  
    Started by U0000999, Today, 10:33 AM
    3 responses
    9 views
    0 likes
    Last Post U0000999  
    Started by Aporshnev, Today, 12:14 PM
    0 responses
    4 views
    0 likes
    Last Post Aporshnev  
    Started by CopyPasteGhost, Today, 11:22 AM
    3 responses
    6 views
    0 likes
    Last Post NinjaTrader_ChelseaB  
    Started by Sulfred, Today, 12:34 AM
    2 responses
    15 views
    0 likes
    Last Post NinjaTrader_Jesse  
    Working...
    X