Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Considerations for Calculate.OnPriceChange

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

    Considerations for Calculate.OnPriceChange

    NT Team,

    What considerations are required when restructuring an Indicator from Calculate.OnEachTick to Calculate.OnPriceChange?
    Where the Indicator:
    - DataSeries type = Minute (i.e. bar type is not set up to remove the last bar on a chart) (NinjaTrader 8),
    - does not deal with volume or tick counting (NinjaTrader 8), and
    - has references to the most recently completed bar (i.e. Bar[1]).

    I am attempting to improve the performance, as per NT8 performance tips (NinjaTrader 8). Noting, "When set to Calculate OnPriceChange, the OnBarUpdate() method is ONLY called when the price has changed which does not necessarily occur the end of the close of the bar" (NinjaTrader 8).

    As I understand the above links, under OnPriceChange, OnBarUpdate is only called where price has changed.
    The attached Indicator and video (https://www.screencast.com/t/YYb5U68OKO) shows my understanding is wrong.
    It appears as though the Indicator OnPriceChange is behaving as I'd expect from OnEachTick.

    Any insight is apprecaited.
    Thanks
    Shannon






    However, under Playback, it appearsSo,


    Attached Files

    #2
    Hello Shansen,

    Thank you for your post.

    Even if the price has not changed we will still get new OnBarUpdate() iterations for new bar formations when Calculate is set to OnPriceChange. New ticks will create a new bar, not price changes, so OnBarUpdate will be called for the formation of the new bar.

    Please let us know if we may assist further.

    Brandon H.NinjaTrader Customer Service

    Comment


      #3
      Brandon,

      Thank you for your quick response.

      If I understand you correctly, under Calculate.OnPriceChange OnBarUpdate() occurs:
      - at a change in price (i.e. not at a tick of the same price), and
      - at the first tick of a new bar.

      Your response appears to be in direct conflict with the NT8 HelpGuide: "When set to Calculate OnPriceChange, the OnBarUpdate() method is ONLY called when the price has changed which does not necessarily occur the end of the close of the bar" (NinjaTrader 8).

      Please advise where my understanding of the NT8 HelpGuide has gone awry.
      I should say, I am happy NT8 conforms to your stated sequence of events.
      Last edited by Shansen; 12-28-2020, 07:23 PM.

      Comment


        #4
        Hello Shansen,

        Thank you for your note.

        You are understanding correctly. When Calculate is set to OnPriceChange, OnBarUpdate will occur when there is a change in price or for the first tick of a new bar.

        We will be updating the Help Guide documentation so that the information explains this more clearly.

        Please let us know if we may assist further.

        Brandon H.NinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by alifarahani, Today, 09:40 AM
        3 responses
        15 views
        0 likes
        Last Post NinjaTrader_Jesse  
        Started by RookieTrader, Today, 09:37 AM
        4 responses
        17 views
        0 likes
        Last Post RookieTrader  
        Started by PaulMohn, Today, 12:36 PM
        0 responses
        4 views
        0 likes
        Last Post PaulMohn  
        Started by love2code2trade, 04-17-2024, 01:45 PM
        4 responses
        40 views
        0 likes
        Last Post love2code2trade  
        Started by junkone, Today, 11:37 AM
        3 responses
        23 views
        0 likes
        Last Post NinjaTrader_ChelseaB  
        Working...
        X