Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

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 algospoke, Yesterday, 06:40 PM
      2 responses
      19 views
      0 likes
      Last Post algospoke  
      Started by ghoul, Today, 06:02 PM
      3 responses
      14 views
      0 likes
      Last Post NinjaTrader_Manfred  
      Started by jeronymite, 04-12-2024, 04:26 PM
      3 responses
      45 views
      0 likes
      Last Post jeronymite  
      Started by Barry Milan, Yesterday, 10:35 PM
      7 responses
      21 views
      0 likes
      Last Post NinjaTrader_Manfred  
      Started by AttiM, 02-14-2024, 05:20 PM
      10 responses
      181 views
      0 likes
      Last Post jeronymite  
      Working...
      X