Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

How to set primary time frame of strategy?

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

    How to set primary time frame of strategy?

    Hi,

    I can use Add() to include additional time frames of my choosing but how do I specify in the code what the primary time frame should be?

    Cheers,
    darmbk.

    #2
    Hello darmbk,

    Thank you for your post.

    The primary instrument/time frame is determined by the instrument and timeframe you apply the indicator or strategy on your chart or the Strategies tab of the NinjaTrader Control Center.

    There is no method to set the timeframe for the primary bar series in your code.

    Please let me know if I may be of further assistance.

    Comment


      #3
      Please submit a feature request for "programmatically configuring the primary Data series properties". Thanks!

      Comment


        #4
        Hello dday1231,

        Thank you for your suggestion.

        Would this include setting the primary bar series of the chart itself or just on the primary bar series when setting the strategy on the Strategies tab of the NinjaTrader Control Center?

        Comment


          #5
          Good question. In my opinion, ideally, the bar series of the chart and the primary bar series of the strategy would be independent to satisfy the use case where a user would like to view different time frames in the chart while the strategy keeps plugging along on the correct time frame, which is defined in the strategy logic.

          Another point here is that every strategy I've built is tied to a particular time frame/bar series, which means that the data series is defined at strategy development time--not at strategy run time. So why make the user set this over and over at runtime?

          Another point here is that I'd like users to do as little configuration as possible since manual intervention is error prone, and as a strategy developer it is a little awkward to have to create a "dummy" primary data series, and then create and use a secondary data series to actually run strategy logic on.

          Comment


            #6
            Hello,

            Thank you for your suggestion on how we can improve our product. It has been inserted into our tracking system with the unique ID # 2778.

            Comment


              #7
              i am using the following code to set the primary time frame within the code:

              protected override void OnStartUp()
              {
              if (Instrument.MasterInstrument.Name == "NIFTY")
              {
              BarsPeriod.BasePeriodType = PeriodType.Minute;
              BarsPeriod.MarketDataType = MarketDataType.Last;
              BarsPeriod.Value = 7;
              Print(" "+Instrument.FullName+" Bars Period "+BarsPeriod.Value+" Minutes ")
              }
              }

              FYI.

              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
              574 views
              1 like
              Last Post RFrosty
              by RFrosty
               
              Working...
              X