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 BarzTrading, Today, 07:25 AM
          2 responses
          21 views
          1 like
          Last Post BarzTrading  
          Started by devatechnologies, 04-14-2024, 02:58 PM
          3 responses
          20 views
          0 likes
          Last Post NinjaTrader_BrandonH  
          Started by tkaboris, Today, 08:01 AM
          0 responses
          4 views
          0 likes
          Last Post tkaboris  
          Started by EB Worx, 04-04-2023, 02:34 AM
          7 responses
          163 views
          0 likes
          Last Post VFI26
          by VFI26
           
          Started by Mizzouman1, Today, 07:35 AM
          1 response
          10 views
          0 likes
          Last Post NinjaTrader_Gaby  
          Working...
          X