Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

CalculateBarOnClose=False & nested indicators

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

    CalculateBarOnClose=False & nested indicators

    Hi there,

    I have 1 indicator ("Pattern") which uses another indicator ("Pivots"). "Pivots" doesn't set CalculateOnBarClose.

    When CalculateBarOnClose is set to True for "Pattern", "Pivots".OnBarUpdate() is executed as soon as "Pattern".OnBarUpdate() uses "Pivots". Good & expected.

    Now, I manually set CalculateBarOnClose to false for "Pattern" in the Indicator window. To my surprise, "Pivots".OnBarUpdate() is now executed AFTER "Pattern".OnBarUpdate() completes (which makes Pattern.OnBarUpdate() actually see the prior-bar value of "Pivots"). I did print the CalculateBarOnClose value in "Pivots", it says it is false (which I expected). How can this happen, and more importantly how can I make sure that "Pivots".OnBarUptade() is executed as soon as "Pattern".OnBarUpdate() makes use of "Pivots" ?

    Note: I also tried to force CalculateOnBarClose=false in "Pivots".Initialize(), that doesn't change the processing order

    Thanks in advance,
    Dominique

    #2
    dom993,

    You could use Pivots.Update() to force the OnBarUpdate() method to be called from your Pattern indicator.

    I.e.

    //in pattern
    private override void OnBarUpdate()
    {

    Pivots.Update();

    //do everything else pattern does.

    }

    With CalculateOnBarClose = false, sometimes things can happen a little more asynchronously.
    Adam P.NinjaTrader Customer Service

    Comment


      #3
      Originally posted by NinjaTrader_AdamP View Post
      dom993,

      You could use Pivots.Update() to force the OnBarUpdate() method to be called from your Pattern indicator.

      I.e.

      //in pattern
      private override void OnBarUpdate()
      {

      Pivots.Update();

      //do everything else pattern does.

      }

      With CalculateOnBarClose = false, sometimes things can happen a little more asynchronously.
      Adam,

      Thank you, this does indeed work!

      Cheers
      Dominique

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by Geovanny Suaza, 02-11-2026, 06:32 PM
      0 responses
      579 views
      0 likes
      Last Post Geovanny Suaza  
      Started by Geovanny Suaza, 02-11-2026, 05:51 PM
      0 responses
      334 views
      1 like
      Last Post Geovanny Suaza  
      Started by Mindset, 02-09-2026, 11:44 AM
      0 responses
      101 views
      0 likes
      Last Post Mindset
      by Mindset
       
      Started by Geovanny Suaza, 02-02-2026, 12:30 PM
      0 responses
      554 views
      1 like
      Last Post Geovanny Suaza  
      Started by RFrosty, 01-28-2026, 06:49 PM
      0 responses
      551 views
      1 like
      Last Post RFrosty
      by RFrosty
       
      Working...
      X