Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Reading a strategy's data series type and value

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

    Reading a strategy's data series type and value

    In my backtesting I have a strategy with a higher time frame added. I want that higher time frame to be 5x the primary time frame. So if I'm backtesting on 5min bars then I want my higher time frame to use 5*5 = 25min bars.

    How does my strategy programatically determine the period type and value of the primary bars array? Would it be

    PHP Code:
    BarsArray[0].Period.Value 
    
    ???

    If so, then I would put this in my Initialize() method

    PHP Code:
    Add(PeriodType.Minute, 5 * BarsArray[0].Period.Value); 
    
    That would seem to work, but I get a "BarsArray can not be accessed in the Initialize() method" error when I try to do that.

    What other way is there?
    Last edited by shodson; 06-01-2010, 01:57 PM.

    #2
    Hello shodson,

    Unfortunately this is not supported. Series must be added in the Initialize method and BarsPeriod.Value is not accessible from this method. You will have to hard-code all series to be added.
    Last edited by NinjaTrader_RyanM1; 06-01-2010, 02:14 PM.
    Ryan M.NinjaTrader Customer Service

    Comment


      #3
      OK thanks, I just added it as a parameter of my strategy, no worries. Not what I wanted but it'll work.

      Comment

      Latest Posts

      Collapse

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