Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Calculate.OnPriceChange vs Calculate.OnBarClose

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

    #16
    Hello Maxim,

    Thanks for your reply.

    I very much disagree with this statement, "all Indicators in NT8 to still work correct and use the Bar Close values", all indicators will work correctly in all calculation modes, what changes depends on what information you need and when. The Vortex indicator is quite capable of running in any of the modes.

    By default, most indicators are set to Calculate.OnBarClose as this represents the least impact on CPU use. The values they provide when using OnBarClose will not change as they do not reference the currently forming bar. In that mode [0] represents the "just closed" bar and the values are static, [1] would be the bar before that, etc..

    When an indicator uses Calculate.OnPriceChange or Calculate.OnEachTick, the calculations are done including the currently forming bar and the index of [0] now points to that currently forming bar. [1] points to the just-closed bar, [2] to the bar before that, etc. etc. Please note when using these modes, when your script is applied to say 5 days of historical data, each historical bar is processed as Calculate.OnBarClose and all indicators would also be calculated based on that. It is only when you get to the right edge that these modes would apply. (Exception would be if used TickReplay).

    Correct, if you have coded based on Calculate.OnBarClose and now want to use Calculate.OnPriceChange, or Calculate.OnEachTick, you would have to readjust your thinking and likely your code to pull the values of interest at the right time. Using IsfirstTickOfBar is a once per bar event that you can use when you want to process things once per bar while taking advantage of the order modes to access the current price data and the indicators current values (of real time data).
    Paul H.NinjaTrader Customer Service

    Comment


      #17
      Hi Paul,

      Originally posted by NinjaTrader_PaulH View Post
      I very much disagree with this statement, "all Indicators in NT8 to still work correct and use the Bar Close values", all indicators will work correctly in all calculation modes, what changes depends on what information you need and when. The Vortex indicator is quite capable of running in any of the modes.

      By default, most indicators are set to Calculate.OnBarClose as this represents the least impact on CPU use. The values they provide when using OnBarClose will not change as they do not reference the currently forming bar. In that mode [0] represents the "just closed" bar and the values are static, [1] would be the bar before that, etc..
      I guess that is true, Just because the indicators become too noisy for my task, does not mean they are not functioning correctly and that is exactly what someone else is looking for.

      Originally posted by NinjaTrader_PaulH View Post
      Correct, if you have coded based on Calculate.OnBarClose and now want to use Calculate.OnPriceChange, or Calculate.OnEachTick, you would have to readjust your thinking and likely your code to pull the values of interest at the right time. Using IsfirstTickOfBar is a once per bar event that you can use when you want to process things once per bar while taking advantage of the order modes to access the current price data and the indicators current values (of real time data).
      Ok, great! Thank you for your help!

      V/R,
      --Maxim

      Comment


        #18
        Hi Paul,

        Hope all is well,

        Do you know where I can find the updated link this?


        You can run your code with Calculate.OnPriceChange and set parts of the code to run only once per bar or on every price change. The bool IsFirstTickOfBar can be used to segment the code that you want to run only once per bar. Reference: https://ninjatrader.com/support/help...ttickofbar.htm

        here is a link to an educational example that demonstrates the concept: https://ninjatrader.com/support/help...either_cal.htm

        Comment


          #19
          Hello Mcol5925,

          The links you have provided are correct.

          Our IT is aware of an issue with links on our forum at this time and is investigating.

          Please try copying and pasting the address below.

          Code:
          https://ninjatrader.com/support/helpGuides/nt8/?isfirsttickofbar.htm
          https://ninjatrader.com/support/helpGuides/nt8/?separating_logic_to_either_cal.htm
          We have had users report that using the 'uBlock origin' will prevent the malformed urls.
          Chelsea B.NinjaTrader Customer Service

          Comment


            #20
            Originally posted by NinjaTrader_ChelseaB View Post
            Hello Mcol5925,

            The links you have provided are correct.

            Our IT is aware of an issue with links on our forum at this time and is investigating.
            I'm not sure what is causing the error. I don't hav Ubock on my PC and it still gives the error.
            When I click a link it always says page not found.
            However, if I look at the URL and remove everything after the HTM the link goes to the correct url.
            FWIW.
            Here is an example of what the link sends to my browser:
            I removed the http:// to see if it would not highlight the url.
            "ninjatrader.com/support/helpGuides/nt8/?isfirsttickofbar.htm&_gl=1*8o15ph*_gcl_au*NzU1NDI 3NTUxLjE2OTMxODc3MzE."

            Comment


              #21
              Hello DavidHP,

              Our IT is aware of the behavior.

              I have suggested using uBlock origin will prevent the malformed urls.
              Chelsea B.NinjaTrader Customer Service

              Comment

              Latest Posts

              Collapse

              Topics Statistics Last Post
              Started by DanielTynera, Today, 01:14 AM
              0 responses
              2 views
              0 likes
              Last Post DanielTynera  
              Started by yertle, 04-18-2024, 08:38 AM
              9 responses
              40 views
              0 likes
              Last Post yertle
              by yertle
               
              Started by techgetgame, Yesterday, 11:42 PM
              0 responses
              12 views
              0 likes
              Last Post techgetgame  
              Started by sephichapdson, Yesterday, 11:36 PM
              0 responses
              2 views
              0 likes
              Last Post sephichapdson  
              Started by bortz, 11-06-2023, 08:04 AM
              47 responses
              1,615 views
              0 likes
              Last Post aligator  
              Working...
              X