Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Difficulty in Pre-loading Multiple Timeframes

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

    Difficulty in Pre-loading Multiple Timeframes

    Currently, I am able to add a second time frame to a strategy as follows:

    protectedoverridevoid Initialize()
    {


    if(biasTimeFrames == TimeFrames.Ten_Min)
    { Add(PeriodType.Minute, 10); }
    }


    I would like to have the ability to select the TimeFrame based on the Chart timeframe ( i.e. 5 min or 10 bar chart ), Not the input parameter that I am using - biasTimeFrames.

    The following examnple is what I would like to accomplish ...
    protectedoverridevoid Initialize()
    {

    switch (Bars.Period.Value)
    {
    case (005): Add(PeriodType.Minute, 10); break;
    case (010): Add(PeriodType.Minute, 60); break;
    }
    }

    Any suggestions on how best to approach this problem?
    Thanks.
    Larry.

    #2
    Larry,

    Unfortunately this is not supported. You don't have access to the bars series in Initialize().
    Josh P.NinjaTrader Customer Service

    Comment


      #3
      Josh,
      Thanks for the quick response. Your response clarified what I figured was happening. Is there any other means to add a second timeframe outside of the Initialize() routine of the strategy.

      Another error that I have/will encounter ... If I attempt to load several timeframes and one of them happens to be the same timeframe as that of the loaded chart ... we errror out again. Is there any way to capture or handle that error.

      Regards,
      Larry.

      Comment


        #4
        Unfortunately not. Adding bar series is not done dynamically. If you are worried about having a dupe series with the primary, you could just ignore the primary altogther in your code and add all the series you need as secondaries and program against those instead. Drawback would be not having any usable charts for the strategy.
        Josh P.NinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

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