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

Ranking Indicator Values

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

    #16
    Well, I wouldn't actually be doing a percentile ranking of a percentile ranking. It would be more like a percentile ranking of the average value of 3 indicators, and one of those 3 indicators is a percentile ranking of the daily changes.

    I do this manually in Excel on daily data right now and I have compared these doubly-ranked values against just using the arithmetic average of the 3 indicators and they are similar, but definitely not identical.

    Comment


      #17
      Originally posted by PhillyD View Post
      Well, I wouldn't actually be doing a percentile ranking of a percentile ranking. It would be more like a percentile ranking of the average value of 3 indicators, and one of those 3 indicators is a percentile ranking of the daily changes.

      I do this manually in Excel on daily data right now and I have compared these doubly-ranked values against just using the arithmetic average of the 3 indicators and they are similar, but definitely not identical.
      In that case you would need to define a new DataSeries in the Variables section of the indicator, intialize the DataSeries in the Initialize() section of the indicator and apply the following logic in OnBarUpdate():

      -> first run the percentile ranking algorithm on your input series
      -> then calculate the arithmetic mean of the 3 indicators and write the result to the newly created DataSereis
      -> finally apply the percentile ranking algorithm to the new DataSeries

      Percentile ranking is an interesting way of normalizing an indicator over a number N of given bars. Alternatively you could use the Z-score for doing the normlization.

      Comment


        #18
        Originally posted by anachronist View Post
        If you still need this, I have just uploaded a Percentile indicator to the NT7 file sharing area. You can use it to plot median values of the last N bars, or any percentile of the last N bars. It's an efficient, fast algorithm, too.
        @anachronist, the part of your indicator getPercentile(), does it return a percentile if passed an array of values? I have a need for this as I want to calculate percentiles based on portions of an array.

        Comment


          #19
          Originally posted by forrestang View Post
          @anachronist, the part of your indicator getPercentile(), does it return a percentile if passed an array of values? I have a need for this as I want to calculate percentiles based on portions of an array.
          No, getPercentile() takes only the desired percentile (0 to 100) as an argument. You cannot pass an array of values to it. Internally the indicator maintains a sorted list of the last N values in a data series. Most of the code in the getPercentile() function just calculates the array index corresponding to the desired percentile and, because this is almost never a whole number, it interpolates between the values in the nearest array indices to return a result.

          If you want the percentile of an array, it's simple. Just sort the array and calculate the array index closest to your desired percentile. The value at the nearest array index will be the percentile. If you want to get fancy, you can interpolate like my indicator does.

          Comment


            #20
            thanks for the snippet, Harry. I've been trying to get a percentile working for weeks

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by geddyisodin, Yesterday, 05:20 AM
            8 responses
            51 views
            0 likes
            Last Post NinjaTrader_Gaby  
            Started by cmtjoancolmenero, Yesterday, 03:58 PM
            10 responses
            36 views
            0 likes
            Last Post NinjaTrader_ChelseaB  
            Started by DayTradingDEMON, Today, 09:28 AM
            4 responses
            24 views
            0 likes
            Last Post DayTradingDEMON  
            Started by George21, Today, 10:07 AM
            1 response
            17 views
            0 likes
            Last Post NinjaTrader_ChristopherJ  
            Started by Stanfillirenfro, Today, 07:23 AM
            9 responses
            25 views
            0 likes
            Last Post NinjaTrader_ChelseaB  
            Working...
            X