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 charlesugo_1, 05-26-2026, 05:03 PM
      0 responses
      61 views
      0 likes
      Last Post charlesugo_1  
      Started by DannyP96, 05-18-2026, 02:38 PM
      1 response
      149 views
      0 likes
      Last Post NinjaTrader_ChelseaB  
      Started by CarlTrading, 05-11-2026, 05:56 AM
      0 responses
      162 views
      0 likes
      Last Post CarlTrading  
      Started by CarlTrading, 05-10-2026, 08:12 PM
      0 responses
      99 views
      0 likes
      Last Post CarlTrading  
      Started by Hwop38, 05-04-2026, 07:02 PM
      0 responses
      286 views
      0 likes
      Last Post Hwop38
      by Hwop38
       
      Working...
      X