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 CarlTrading, 03-31-2026, 09:41 PM
      1 response
      83 views
      1 like
      Last Post NinjaTrader_ChelseaB  
      Started by CarlTrading, 04-01-2026, 02:41 AM
      0 responses
      45 views
      0 likes
      Last Post CarlTrading  
      Started by CaptainJack, 03-31-2026, 11:44 PM
      0 responses
      65 views
      2 likes
      Last Post CaptainJack  
      Started by CarlTrading, 03-30-2026, 11:51 AM
      0 responses
      68 views
      0 likes
      Last Post CarlTrading  
      Started by CarlTrading, 03-30-2026, 11:48 AM
      0 responses
      56 views
      0 likes
      Last Post CarlTrading  
      Working...
      X