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 GLFX005, Today, 03:23 AM
          0 responses
          1 view
          0 likes
          Last Post GLFX005
          by GLFX005
           
          Started by XXtrader, Yesterday, 11:30 PM
          2 responses
          11 views
          0 likes
          Last Post XXtrader  
          Started by Waxavi, Today, 02:10 AM
          0 responses
          6 views
          0 likes
          Last Post Waxavi
          by Waxavi
           
          Started by TradeForge, Today, 02:09 AM
          0 responses
          14 views
          0 likes
          Last Post TradeForge  
          Started by Waxavi, Today, 02:00 AM
          0 responses
          3 views
          0 likes
          Last Post Waxavi
          by Waxavi
           
          Working...
          X