Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

How ninja is calculating indicators.

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

    How ninja is calculating indicators.

    Hi

    I want to know how i can calculate indicator values in startegy most fastest way.

    If I want use example, both output from RSI indicator is ninja calculating RSI two times.

    x1=RSI(10)[0];
    x2=RSI(10).Avg[0];

    or Do I have to create a new object or class. ?
    I am newbie in c#

    thanks
    regards

    #2
    jokujoku,

    There can be a minor performance increase using indicators this way but most users are unlikely to notice. You can typically just call the indicator you're using for either comparisons or to assign values.

    You don't have to create a new object or class. You could use x1 or x2 in your code and it would refer to those items.
    Ryan M.NinjaTrader Customer Service

    Comment


      #3
      Hi that was example, I have allready very complex strategy, and I want use Market profile type indicators. so it will use lot of cpu cycles.
      If you are kind, please explain what is fastest way, and is ninja calculating these two "properties" or plots, twice.

      Thanks

      Comment


        #4
        In your example it looks like x1 and x2 are double values. The first time it's used it will create an instance of RSI(10) and cache it in case it's used again in your script. The cached indicator already calculates the avg plot so there will be only one call.
        Ryan M.NinjaTrader Customer Service

        Comment


          #5
          Great thanks.

          Comment


            #6
            I found your answer is not correct.
            calculating these values take quite long time.
            Its not cache values so, it will be fast. adn creating one instance and then just reading other values.
            I am using this in strategy and its take many many times longer than if I insert indicator to chart or
            just calculating one value.

            vat=dValueAreatrue, 0, 0, 0.7, 0, 0, _dValueEnums.dValueAreaTypes.TPO, 0, 30, 1, 24, true, 450, false, 2).VAt[1];
            vab=dValueArea(true, 0, 0, 0.7, 0, 0, _dValueEnums.dValueAreaTypes.TPO, 0, 30, 1, 24, true, 450, false, 2).VAb[1];
            poc=dValueArea(true, 0, 0, 0.7, 0, 0, _dValueEnums.dValueAreaTypes.TPO, 0, 30, 1, 24, true, 450, false, 2).POC[1];


            rpoc=dValueAreaFx(true, 0, 0, 0.7, 0, 0, _dValueEnums.dValueAreaTypes.TPO, 0, 30, 1, 24, true, 450, false, 2).RtPOC[1];

            Its take very long time when its calculate first time, this indicator values.
            What is most fastest way to calculate these values.
            I think its creating four different instances.
            Last edited by jokujoku; 02-26-2011, 01:17 PM.

            Comment


              #7
              Originally posted by NinjaTrader_RyanM View Post
              In your example it looks like x1 and x2 are double values. The first time it's used it will create an instance of RSI(10) and cache it in case it's used again in your script. The cached indicator already calculates the avg plot so there will be only one call.
              I found your answer is not correct.
              calculating these values take quite long time.
              Its not cache values so, it will be fast. adn creating one instance and then just reading other values.
              I am using this in strategy and its take many many times longer than if I insert indicator to chart or
              just calculating one value.

              vat=dValueAreatrue, 0, 0, 0.7, 0, 0, _dValueEnums.dValueAreaTypes.TPO, 0, 30, 1, 24, true, 450, false, 2).VAt[1];
              vab=dValueArea(true, 0, 0, 0.7, 0, 0, _dValueEnums.dValueAreaTypes.TPO, 0, 30, 1, 24, true, 450, false, 2).VAb[1];
              poc=dValueArea(true, 0, 0, 0.7, 0, 0, _dValueEnums.dValueAreaTypes.TPO, 0, 30, 1, 24, true, 450, false, 2).POC[1];


              rpoc=dValueAreaFx(true, 0, 0, 0.7, 0, 0, _dValueEnums.dValueAreaTypes.TPO, 0, 30, 1, 24, true, 450, false, 2).RtPOC[1];

              Its take very long time when its calculate first time, this indicator values.
              What is most fastest way to calculate these values.
              I think its creating four different instances.

              Comment


                #8
                jokujoku, I will have someone get back to you on Monday.
                AustinNinjaTrader Customer Service

                Comment


                  #9
                  Create an instance of each, then access the instance when you want to plot.

                  Comment


                    #10
                    Originally posted by jokujoku View Post
                    Hi

                    I want to know how i can calculate indicator values in startegy most fastest way.

                    If I want use example, both output from RSI indicator is ninja calculating RSI two times.

                    x1=RSI(10)[0];
                    x2=RSI(10).Avg[0];

                    or Do I have to create a new object or class. ?
                    I am newbie in c#

                    thanks
                    regards
                    In your example there will only be one instance of the RSI(10) indicator. The values for this indicator will only ever be calculated once. By calling the same instance the second time, the indicator internal logic knows that its already "up to date" in its calculation driven by the first call to this indicator.

                    The only efficiency you might lose is in the cache look up for this indicator. If your strategy only ever references one variation of an RSI indicator, then their is no practical performance impact. If your strategy has many variations of the RSI indicator, then each time you call it, the strategy must loop through its cache of RSI indicators to find the correct one. In this case, you can simply declare a variable to hold the RSI indicator(s) as a reference and then refer to this indicator variable thus bypassing the caching logic.
                    RayNinjaTrader Customer Service

                    Comment

                    Latest Posts

                    Collapse

                    Topics Statistics Last Post
                    Started by Geovanny Suaza, 02-11-2026, 06:32 PM
                    0 responses
                    631 views
                    0 likes
                    Last Post Geovanny Suaza  
                    Started by Geovanny Suaza, 02-11-2026, 05:51 PM
                    0 responses
                    364 views
                    1 like
                    Last Post Geovanny Suaza  
                    Started by Mindset, 02-09-2026, 11:44 AM
                    0 responses
                    105 views
                    0 likes
                    Last Post Mindset
                    by Mindset
                     
                    Started by Geovanny Suaza, 02-02-2026, 12:30 PM
                    0 responses
                    566 views
                    1 like
                    Last Post Geovanny Suaza  
                    Started by RFrosty, 01-28-2026, 06:49 PM
                    0 responses
                    568 views
                    1 like
                    Last Post RFrosty
                    by RFrosty
                     
                    Working...
                    X