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 CarlTrading, 03-31-2026, 09:41 PM
      1 response
      67 views
      0 likes
      Last Post NinjaTrader_ChelseaB  
      Started by CarlTrading, 04-01-2026, 02:41 AM
      0 responses
      36 views
      0 likes
      Last Post CarlTrading  
      Started by CaptainJack, 03-31-2026, 11:44 PM
      0 responses
      60 views
      1 like
      Last Post CaptainJack  
      Started by CarlTrading, 03-30-2026, 11:51 AM
      0 responses
      62 views
      0 likes
      Last Post CarlTrading  
      Started by CarlTrading, 03-30-2026, 11:48 AM
      0 responses
      53 views
      0 likes
      Last Post CarlTrading  
      Working...
      X