Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Self unchecking of strategy enable box

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

    #16
    Ok. If that's what you want, you want to use OnPriceChange. It's still possible to calculate things on the bar close, because you still have all that data. If you want to calculate things once per bar, you could use Bars.IsFirstTickOfBar. It's a boolean, so it will either be true or false, and you can add that to your entry calculations so that it only calculates once per bar. Because it's the first tick of the new bar, you would get the High using High[1], Close with Close[1] etc, because you want the prior bar's data. It's a little different than OnBarClose, because you are calculating on the next bar instead of the close of the bar, but it's easily remedied. This would be the way to calculate some things once per bar for entries, while giving you the ability to use the granularity of OnPriceChange later on for precise exits.

    What are your calculations for the entry? I wouldn't mind helping out with that.

    Comment


      #17
      Hello rockmanx00,

      When using Calculate.OnPriceChange or .OnEachTick, for conditions you want to run when the bar closes require IsFirstTickOfBar to be true in the condition.
      For conditions you want to update on each price change or tick, don't include a check for IsFirstTickOfBar in the condition.
      Join the official NinjaScript Developer Community for comprehensive resources, documentation, and community support. Build custom indicators and automated strategies for the NinjaTrader platforms with our extensive guides and APIs.


      In historical, calculate is always OnBarClose unless TickReplay is enabled and 1-tick intra-bar granularity is implemented.
      Chelsea B.NinjaTrader Customer Service

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by NullPointStrategies, Yesterday, 05:17 AM
      0 responses
      71 views
      0 likes
      Last Post NullPointStrategies  
      Started by argusthome, 03-08-2026, 10:06 AM
      0 responses
      143 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