StockFetcher Forums · General Discussion · How about a PERCENT RANK function?<< >>Post Follow-up
10 posts
msg #117105
Ignore pschmu
11/28/2013 10:24:58 AM

Now that we have a Max Drawdown function in SF. How about PERCENT RANK in SF? Same formula as in EXCEL. I have several custom indictors that use this basic function. Any help would be appreciated.

Here is the coding in Stratasearch

Data = parameter("Data");
Periods = parameter("Periods");

Count = 0;
x = 1;
while(x < Periods)
Count = Count + if ( Ref( Data, 0 ) > Ref( Data, -x ), 1, 0 );
x = x + 1;
PercentRank = 100 * Count / Periods;

3,832 posts
msg #117106
Ignore Kevin_in_GA
11/28/2013 11:13:22 AM

Welcome - glad to see another SS user here. Perhaps you might want to explain the way in which you use this? What is the "Data" that is used as the primary input?

I have already coded a basic RANK function in SF- it works but is clunky. Note that SF code improvement requests are hit or miss at best - not the same level of support here as Pete provides over in the Stratasearch forums.

963 posts
msg #117108
11/28/2013 12:12:40 PM

@pschmu - Thank you for the feature suggestion. We are looking into the measure that you mention. If we have any questions or updates, we'll let you know.

Thank you again!

StockFetcher Support

10 posts
msg #117113
Ignore pschmu
11/28/2013 8:16:22 PM

Thanks SF Support. SF does not have the capability of loops (while statements) like SS does. Please correct me if I am wrong on that statement.


For starters, the ConnorsRSI uses this function on the daily gains portion of the indicator. Also, there are several DV indicators that use % Rank. For example, DVO , an oscillator, has shown some success when applied to the major indices like SPX and Nasdaq.

963 posts
msg #117266
12/6/2013 3:22:27 PM

We have added a first pass at a PctRank() function for StockFetcher. For example:

Fetcher[PctRank(close,20) is above 99]

We did have a quick question concerning the description/code-sample provided in your initial message. Specifically, in your message it appears that it is not possible to have PctRank of 100 as your loop is only "Periods - 1" long, resulting in a maximum "Count" of "Periods - 1". If this is intentional, please let us know and we will look into the issue further.

Please let us know if you have any questions or run into any errors with this function.

Thank you,
StockFetcher Support

10 posts
msg #117561
Ignore pschmu
12/30/2013 8:24:33 AM

Thanks SF. You are right. Your function works correct. The x should be initialized to 0 in the sample code. I think then it could go to 100.

StockFetcher Forums · General Discussion · How about a PERCENT RANK function?<< >>Post Follow-up

*** Disclaimer *** does not endorse or suggest any of the securities which are returned in any of the searches or filters. They are provided purely for informational and research purposes. does not recommend particular securities., Vestyl Software, L.L.C. and involved content providers shall not be liable for any errors or delays in the content, or for any actions taken based on the content.

Copyright 2016 - Vestyl Software L.L.C.Terms of Service | License | Questions or comments? Contact Us
EOD Data sources: DDFPlus & CSI Data Quotes delayed during active market hours. Delay times are at least 15 mins for NASDAQ, 20 mins for NYSE and Amex. Delayed intraday data provided by DDFPlus