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

Multi time frame BarsSinceNewTradingDay

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

    Multi time frame BarsSinceNewTradingDay

    I am creating an indicator using multi time frames. I want to access the BarsSinceNewTradingDay for each time series. How do I do that?

    Thanks,
    Dana

    #2
    Hello,

    Thank you for the post.

    It is important to understand that the majority of properties will belong to the series that calls OnBarUpdate in a muilti instrument script.

    In this case when the primary calls OnBarUpdate, you could call BarsSinceNewTradingDay to find out the value for the primary. When the secondary series calls OnBarUpdate, this property now reflects the secondary series.

    Assuming the instruments have different session hours, this can be seen by using the following print:

    Code:
    protected override void OnBarUpdate()
    {
    	Print("BarsInProgress: " + BarsInProgress + " Bars.BarsSinceNewTradingDay: " + Bars.BarsSinceNewTradingDay);
    }
    I am unaware of any way to call this in a cross series case, such as if you wanted the value for the Primary series when BarsInProgress 1 is called. You would instead need to store the last seen value to a variable and then use the private variable from the other BarsInProgress.


    I look forward to being of further assistance.
    JesseNinjaTrader Customer Service

    Comment


      #3
      How do I know which series called OnBarUpdate?

      Comment


        #4
        Hello,

        Thank you for the reply.

        In the prior example, this is shown, the BarsInProgress will determine which series called OnBarUpdate. As noted you would need to use two instruments that have different sessions for the example print to differentiate them. BarsInProgress will change in that example, but if the session is the same the BarsSinceNewTradingDay will likely be the same.

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

        Comment


          #5
          Thanks,

          Dana

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by arvidvanstaey, Today, 02:19 PM
          4 responses
          11 views
          0 likes
          Last Post arvidvanstaey  
          Started by samish18, 04-17-2024, 08:57 AM
          16 responses
          61 views
          0 likes
          Last Post samish18  
          Started by jordanq2, Today, 03:10 PM
          2 responses
          9 views
          0 likes
          Last Post jordanq2  
          Started by traderqz, Today, 12:06 AM
          10 responses
          18 views
          0 likes
          Last Post traderqz  
          Started by algospoke, 04-17-2024, 06:40 PM
          5 responses
          48 views
          0 likes
          Last Post NinjaTrader_Jesse  
          Working...
          X