Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

OnBarUpdate call order for Indicator within Strategy

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

    OnBarUpdate call order for Indicator within Strategy

    Hi, adding my custom indicator to my strategy using the Add() function.
    However, I noticed that the OnBarUpdate of the indicator doesn't get called until all the OnBarUpdate events of the strategy are called.

    The Initialize() and OnStartUp() interchange, ie:
    1- Strategy Initialize
    2- Indicator Initialize
    3- Strategy OnStartUp
    4- Indicator OnStartUp

    Is that normal behavior for the OnBarUpdate?

    Thanks

    #2
    Hello Silacitrader,

    Thank you for your post.

    Yes, this is expected to happen.

    The indicator doesn't start processing until its first call. After which it will start updating with the OBU of the Strategy

    Let me know if I can be of further assistance.
    Cal H.NinjaTrader Customer Service

    Comment


      #3
      Thanks, can you please explain what you mean by "until its first call"?

      Comment


        #4
        SilaciTrader,

        C# works logically, left to right, top to bottom.

        When I mean by first call, is the first time you try get the class information such as calling the SMA(14).

        This is creating a new instance of the Class and thus getting the processed values for it.
        Cal H.NinjaTrader Customer Service

        Comment


          #5
          Thanks Cal. It's clear now.

          Comment


            #6
            Hi NinjaTrader_Cal,

            Is there anyway to force the indicator OnBarUpdate() to be executed before the strategy OnBarUpdate()?

            I'm trying to use the GomVolumeLadder indicator in a strategy and I'm running into a problem where the bid/ask ladder is always 1 tick behind when trying to execute trades in the strategy.

            Comment


              #7
              Hello rupurt,

              Thank you for your post.

              You could implement Update() in the indicator. For a reference sample please visit the following link: http://ninjatrader.com/support/forum...ead.php?t=4991
              You can find information on Update() at the following link: http://ninjatrader.com/support/helpG...nt7/update.htm

              Please let me know if you have any questions.

              Comment

              Latest Posts

              Collapse

              Topics Statistics Last Post
              Started by Geovanny Suaza, 02-11-2026, 06:32 PM
              0 responses
              558 views
              0 likes
              Last Post Geovanny Suaza  
              Started by Geovanny Suaza, 02-11-2026, 05:51 PM
              0 responses
              324 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
              545 views
              1 like
              Last Post Geovanny Suaza  
              Started by RFrosty, 01-28-2026, 06:49 PM
              0 responses
              547 views
              1 like
              Last Post RFrosty
              by RFrosty
               
              Working...
              X