Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Is it possible to use a calculated OnEachTick Indicator in an OnBarClose strategy?

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

    Is it possible to use a calculated OnEachTick Indicator in an OnBarClose strategy?

    Hello everyone,

    I have an indicator that calculates OnEachTick and it works without problem

    I want to create a strategy that will calculate OnBarClose using this indicator

    Is it possible to do this?

    I've tried the OnEachTick strategy and it works fine, but if I change it to OnBarClose, it doesn't pull the indicator value.

    Thank you so much​

    Have a nice day

    #2
    Hello Mestor,

    Thank you for your post.

    The parent script determines how frequently OnBarUpdate() will calculate. This is addressed as Tip number 4 on the following page:


    That means you would need to set your strategy to OnEachTick if you require the indicator called by your strategy to calculate OnEachTick. Then, what you could do if you want your strategy to only process OnBarClose, is program your strategy logic with the condition checking if IsFirstTickOfBar is true. We have a reference sample that demonstrates separating logic to calculate once on bar close or on every tick here:


    Please let us know if we may be of further assistance.

    Comment


      #3
      Originally posted by NinjaTrader_Emily View Post
      Hello Mestor,

      Thank you for your post.

      The parent script determines how frequently OnBarUpdate() will calculate. This is addressed as Tip number 4 on the following page:
      https://ninjatrader.com/support/help.../calculate.htm

      That means you would need to set your strategy to OnEachTick if you require the indicator called by your strategy to calculate OnEachTick. Then, what you could do if you want your strategy to only process OnBarClose, is program your strategy logic with the condition checking if IsFirstTickOfBar is true. We have a reference sample that demonstrates separating logic to calculate once on bar close or on every tick here:
      https://ninjatrader.com/support/help...either_cal.htm

      Please let us know if we may be of further assistance.
      Thank you very much Emily,

      It's just what I needed.

      I have modified the code following your explanation and example and it works perfectly.

      Greetings and have a nice day​

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by NullPointStrategies, Yesterday, 05:17 AM
      0 responses
      81 views
      0 likes
      Last Post NullPointStrategies  
      Started by argusthome, 03-08-2026, 10:06 AM
      0 responses
      149 views
      0 likes
      Last Post argusthome  
      Started by NabilKhattabi, 03-06-2026, 11:18 AM
      0 responses
      79 views
      0 likes
      Last Post NabilKhattabi  
      Started by Deep42, 03-06-2026, 12:28 AM
      0 responses
      52 views
      0 likes
      Last Post Deep42
      by Deep42
       
      Started by TheRealMorford, 03-05-2026, 06:15 PM
      0 responses
      59 views
      0 likes
      Last Post TheRealMorford  
      Working...
      X