Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

{NinjaScript} NT8 - Execution Mode

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

    {NinjaScript} NT8 - Execution Mode

    Dear all, hope you are fine.
    What is the diference between "OnEachTick" and "OnPriceChange" ?
    Thank you so much!

    #2
    Hello fcabrera87,

    Thanks for your post and welcome to the NinjaTrader forums!

    When a script is connected to live data (or playback with market replay data) Calculate.OnEachTick means your script will run on every single incoming tick regardless if the tick is at the same or different price. For example, if using an SMA indicator with Calculate.OnEachTick, if the incoming tick did not change price the SMA is still recalculated which would result in exactly the same SMA value as the previous tick(s), this would be wasteful of resources. There are indicators that need the data of every tick, such as BuySellVolume where the price does not change but the count of buy or sell volume does and that indicator should be run with Calculate.OnEachTick.

    When a script is connected to live data (or playback with market replay data) Calculate.OnPriceChange means your script will run whenever the incoming tick is at a different price. Using the SMA example, the SMA would then only be recalculated when the tick is a different price and the SMA then would be recalculated to a slightly different value. this would be a more efficient use of resources.

    The bottom line is we recommend using Calculate.OnPriceChange when possible and Calculate.OnEachTick when required.

    Please note that for historical data, the script will be run as if Calculate.OnBarClose was selected.

    References: https://ninjatrader.com/support/help...?calculate.htm

    ​​​​​​​

    Comment


      #3
      It's all about how often NT calls OnBarUpdate.

      Do you wish NT to call OnBarUpdate 'on each tick' or 'on a price change'?

      If 5 ticks come in with the same price, then OnPriceChange means OnBarUpdate
      only sees one of them, whereas OnEachTick means it sees all of them.

      OnEachTick is like a raw firehose, you get every tick.

      OnPriceChange checks the price of each incoming tick, and only calls OnBarUpdate
      if the price has changed compared to the previous tick.

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by NullPointStrategies, Yesterday, 05:17 AM
      0 responses
      66 views
      0 likes
      Last Post NullPointStrategies  
      Started by argusthome, 03-08-2026, 10:06 AM
      0 responses
      141 views
      0 likes
      Last Post argusthome  
      Started by NabilKhattabi, 03-06-2026, 11:18 AM
      0 responses
      76 views
      0 likes
      Last Post NabilKhattabi  
      Started by Deep42, 03-06-2026, 12:28 AM
      0 responses
      47 views
      0 likes
      Last Post Deep42
      by Deep42
       
      Started by TheRealMorford, 03-05-2026, 06:15 PM
      0 responses
      51 views
      0 likes
      Last Post TheRealMorford  
      Working...
      X