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

CalculateOnBarClose = False + BarsInProgress

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

    CalculateOnBarClose = False + BarsInProgress

    Hi,

    I'm running an automated strategy which uses the CalculateOnBarClose = False on a 1-min timeframe.

    But I would like to add a 60-min timeframe to the script and have a check performed on this 60-min bar at the close of this bar.

    How would I go about to accomplish this? Because I use the calculateonbarclose = false I have no idea how to wait for a second timeseries close.

    Thanks!

    #2
    As long as your strategy is set to COBC = False, you will not know whether the current tick of your bar is the last tick, as it is well possible that it is followed by another tick before the bar closes. Therefore you only know that a bar has closed with the first incoming tick of the next bar.

    Therefore you should check the value of the 60 min bar when you detect the first tick of the next 60 min bar. You can then use that value as needed.

    Comment


      #3
      Hello Harry,

      Thanks for your reply. So how would I go about checking for the first tick of the next 60min bar then?

      Comment


        #4
        Originally posted by siroki View Post
        Hello Harry,

        Thanks for your reply. So how would I go about checking for the first tick of the next 60min bar then?
        You would wait until BarsInProgress == 1 (secondary bar series) and FirstTickOfBar comes true. Then you would retrieve the value for the prior bar of the secondary bar series.

        Comment


          #5
          Hello siroki,

          Thank you for your post and thank you to Harry for his assistance on this thread.

          Harry is correct, you can find information on FirstTickOfBar at the following link: http://www.ninjatrader.com/support/h...ttickofbar.htm
          And BarsInProgress at the following link: http://www.ninjatrader.com/support/h...inprogress.htm

          Please let me know if you have any questions.

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by Aviram Y, Today, 05:29 AM
          0 responses
          2 views
          0 likes
          Last Post Aviram Y  
          Started by quantismo, 04-17-2024, 05:13 PM
          3 responses
          25 views
          0 likes
          Last Post NinjaTrader_Gaby  
          Started by ScottWalsh, 04-16-2024, 04:29 PM
          7 responses
          34 views
          0 likes
          Last Post NinjaTrader_Gaby  
          Started by cls71, Today, 04:45 AM
          0 responses
          6 views
          0 likes
          Last Post cls71
          by cls71
           
          Started by mjairg, 07-20-2023, 11:57 PM
          3 responses
          218 views
          1 like
          Last Post PaulMohn  
          Working...
          X