Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Calculate On Bar Close/Open-Low-High-Close relationship

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

    Calculate On Bar Close/Open-Low-High-Close relationship

    Hi all,

    If 'Calculate on bar close' if False are the values of Open[0], Close[0], High[0] and Low[0] modified with each tick before OnBarUpdate gets called?

    I'm guessing the answer is yes but want to confirm.

    john

    #2
    Hi John,

    Thanks for the post. The standard Open ,High, Low, Close values for your bars would be considered price data, so they will update independent of CalculateOnBarClose settings. There isn't available a COBC setting for standard price bars.

    If you use Open[0], Close[0], etc in a script, then their values will update according to the scripts' CalculateOnBarClose settings. If CalculateOnBarClose = false, then OnBarUpate() will be raised with each tick. If COBC = true, then OnBarUpdate() is raised only on bar close.
    Ryan M.NinjaTrader Customer Service

    Comment


      #3
      Thank you for your response. I didn't ask the question well. I understand that onbarupdate is called differently based on the CalculateOnBarClose setting.

      The scenario I was exploring was if CalculateOnBarClose is false and OnBarUpdate is called with each tick. In that scenario are High[0] and Low[0] updated by the platform with each tick or is High[0] only set at the end of the time frame? I want to be absolutely sure.

      john

      Comment


        #4
        Hi John, they would be updated with each tick as well, so as new Highs and Lows are seen. With CalculateOnBarClose set to 'false' index 0 always means the currently developing / updating bar. With CalculateOnBarClose set to 'true' index 0 means the last completed bar.
        BertrandNinjaTrader Customer Service

        Comment


          #5
          Hi Ryan,

          On historical testing I understand the setting 'calculate on bar close' = false is irrelevant as it is always calculated as 'calculate on bar close' = true.

          I have a strategy that enters a limit order 3 pips lower than the high of the last bar. What I would like the strategy to do is that:

          "IF two bars have passed since the limit order was placed and the limit order is not filled, cancel the limit order". I have done this for historical testing by assigning an integer variable (called 'barcount') thats adds 1 to itself each time OnBarUpdate is called, and when 'barcount' = 3 then do not resubmit the limit order. This works on historical testing because OnBarUpdate is called on each bar for historical testing ('calculate on bar close' = true).

          So...my question is how do I achieve the same thing for live testing when 'Calculate on bar close' = false, as each OnBarUpdate will calculate on each tick.?

          Many thanks.

          Comment


            #6
            Hi adam_norsworthy,
            You can check when property FirstTickOfBar == true which is only once per bar. A sample showing best way to combine bar close/every tick logic is available here:
            http://www.ninjatrader.com/support/f...ad.php?t=19387
            Ryan M.NinjaTrader Customer Service

            Comment


              #7
              Perfect. Thanks Ryan.

              Comment

              Latest Posts

              Collapse

              Topics Statistics Last Post
              Started by op1031, Yesterday, 05:16 PM
              1 response
              8 views
              0 likes
              Last Post NT-Roland  
              Started by sinpeople, Today, 07:20 AM
              1 response
              3 views
              0 likes
              Last Post NT-Roland  
              Started by Frank1000, Today, 03:05 AM
              1 response
              7 views
              0 likes
              Last Post NT-Roland  
              Started by ntdev, Today, 01:14 AM
              4 responses
              16 views
              0 likes
              Last Post ntdev
              by ntdev
               
              Started by ct, Today, 02:22 AM
              1 response
              8 views
              0 likes
              Last Post NinjaTrader_Jason  
              Working...
              X