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 Hwop38, 05-04-2026, 07:02 PM
      0 responses
      161 views
      0 likes
      Last Post Hwop38
      by Hwop38
       
      Started by CaptainJack, 04-24-2026, 11:07 PM
      0 responses
      311 views
      0 likes
      Last Post CaptainJack  
      Started by Mindset, 04-21-2026, 06:46 AM
      0 responses
      245 views
      0 likes
      Last Post Mindset
      by Mindset
       
      Started by M4ndoo, 04-20-2026, 05:21 PM
      0 responses
      350 views
      0 likes
      Last Post M4ndoo
      by M4ndoo
       
      Started by M4ndoo, 04-19-2026, 05:54 PM
      0 responses
      179 views
      0 likes
      Last Post M4ndoo
      by M4ndoo
       
      Working...
      X