Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

NinjaScript Indicator/Strategy Class Call Order

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

    NinjaScript Indicator/Strategy Class Call Order

    Hi,

    I’m hoping to break my indicators and strategies into components so I can easily re-use code & not have to make multiple changes to update similar logic, etc.

    My question is, in what order will my indicators and strategies receive OnBarUpdate() events? Is it deterministic or will it be random? I just want the assurance that within a single global OnBarUpdate event, one object will receive data, process/store it, then another object will be able to read that stored data (before the next OnBarUpdate). Another question, how does it affect this ordering when I go from OnBarClose to OnEachTick?

    #2
    Hello trevor14,

    This would be outside of what is supported by NinjaTrader, but the post below has some tips that may give you some ideas for an unsupported approach.
    https://ninjatrader.com/support/foru...245#post712245
    Chelsea B.NinjaTrader Customer Service

    Comment


      #3
      NinjaScript isn't supported by NinjaTrader?

      Comment


        #4
        Hello trevor14,

        Documented NinjaScript that is in the help guide is supported by NinjaTrader.
        https://ninjatrader.com/support/help...erence_wip.htm

        Breaking things into module classes using custom C# instead of making a straight forward indicator or strategy that does not have shared classes is not supported by NinjaTrader.

        This would be custom C# and would not be specifically NinjaScript.
        Chelsea B.NinjaTrader Customer Service

        Comment


          #5
          This is what I thought and tried buy while debugging the code I don't see it enters the OnBar Update of the indicator. Am I missing something?

          protected override void OnBarUpdate()
          {
          aoBalance.Update();
          for (int i=0; i< aoBalance.BalanceAreas.Count; i++)
          {
          BalanceArea ba = aoBalance.BalanceAreas[i];
          Draw.Rectangle(aoBalance, ba.Tag, ba.StartBar, ba.Min, 0, ba.Max, Brushes.Green);
          }
          }

          Comment


            #6
            Hello ofiramitai,

            Use prints to understand the behavior.

            Print aoBalance.BalanceAreas.Count and the time of the bar before the loop.
            Print i and aoBalance.BalanceAreas[i] inside the loop.
            Print ba.Tag, print ba.StartBar, print ba.Min, print ba.Max inside the loop after ba is declared and assigned.

            Below is a link to a forum post that demonstrates how to use prints to understand behavior.
            https://ninjatrader.com/support/foru...121#post791121

            Save the output from the output window (right-click -> Save As) to a text file and include this with your reply.
            I am happy to assist with analyzing the output.
            Chelsea B.NinjaTrader Customer Service

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by canzana, Today, 12:11 AM
            0 responses
            1 view
            0 likes
            Last Post canzana
            by canzana
             
            Started by canzana, Today, 12:10 AM
            0 responses
            1 view
            0 likes
            Last Post canzana
            by canzana
             
            Started by thebionukerlife, Yesterday, 11:41 PM
            0 responses
            2 views
            0 likes
            Last Post thebionukerlife  
            Started by thebionukerlife, Yesterday, 11:40 PM
            0 responses
            2 views
            0 likes
            Last Post thebionukerlife  
            Started by KirkHammett, Yesterday, 11:15 PM
            0 responses
            5 views
            0 likes
            Last Post KirkHammett  
            Working...
            X