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

Calculate Bar on Close

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

    Calculate Bar on Close

    I have a strategy with 2 types of entries. One type requires that the calculation be done on bar close the other requires intra bar calculations. What is the best way to approach this?

    #2
    Hello,
    You could achieve this by having your strategy set to CalculateOnBarClose and add in a 1 tick data series for intrabar granularity and checking your calculations for intrabar within BarsInProgress == 1. I would recommend to review our reference sample for Backtesting NinjaScript Strategies with an intrabar granularity: http://ninjatrader.com/support/forum...ead.php?t=6652 This reference sample should provide a great example of how you can get intrabar calculations with CalculateOnBarClose set to true.
    Please let me know if you have any further questions.
    Cody B.NinjaTrader Customer Service

    Comment


      #3
      This is related and I'm hoping somebody can just clarify quickly:

      I have two scenarios in a strategy with OnBarClose and OnEachTick in Playback with 10 minute bars

      If I call SMA(20) within OnBarUpdate and it's calculated OnBarClose, this will use wait for the current bar to close and then use the prior 20 ten minute bars.

      If I call SMA(20) within OnBarUpdate and it's calculated OnEachTick, at any time in the current 10 minute bar does this use the prior 19 ten minute bars and the current tick? Or does it use the prior 20 ticks?

      I hope that's clearly stated to get a clear answer because it's driving me crazy.

      Thanks in advance!

      Comment


        #4
        Hello,
        To clarify you are using this in NinjaTrader 8 Beta?
        Cody B.NinjaTrader Customer Service

        Comment


          #5
          Hey, yes using NT8 B9, but I suspect that this question applies to both NT7 and NT8.

          I just never really used CalculateOnBarClose=False when backtesting in NT7, so I'm trying to just figure out exactly what is happening without a trial and error sort of process.

          I can clarify the question if needed, but I'm just curious OnEachTick uses 20 prior 10 minute bars in my example before, 20 tick bars, or 19 ten minute bars and the current tick.

          Thanks again

          Comment


            #6
            Hello,
            With CalculateOnBarClose set to false and with Tick Replay it will use the past 19 bars and the value of the most recent update(the latest tick) for the data series.
            If we can be of any other assistance please let us know.
            Cody B.NinjaTrader Customer Service

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by The_Sec, Yesterday, 03:37 PM
            1 response
            11 views
            0 likes
            Last Post NinjaTrader_Gaby  
            Started by vecnopus, Today, 06:15 AM
            0 responses
            1 view
            0 likes
            Last Post vecnopus  
            Started by Aviram Y, Today, 05:29 AM
            0 responses
            5 views
            0 likes
            Last Post Aviram Y  
            Started by quantismo, 04-17-2024, 05:13 PM
            3 responses
            27 views
            0 likes
            Last Post NinjaTrader_Gaby  
            Started by ScottWalsh, 04-16-2024, 04:29 PM
            7 responses
            36 views
            0 likes
            Last Post NinjaTrader_Gaby  
            Working...
            X