Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

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 RDTrader16, Today, 10:19 PM
              0 responses
              5 views
              0 likes
              Last Post RDTrader16  
              Started by gemify, 03-08-2023, 08:02 AM
              9 responses
              148 views
              0 likes
              Last Post culpepper  
              Started by elirion, Today, 10:03 PM
              0 responses
              2 views
              0 likes
              Last Post elirion
              by elirion
               
              Started by RaddiFX, Today, 09:55 PM
              0 responses
              9 views
              0 likes
              Last Post RaddiFX
              by RaddiFX
               
              Started by Trader146, 03-29-2024, 01:22 PM
              4 responses
              27 views
              0 likes
              Last Post Trader146  
              Working...
              X