pschmu 12 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;
|
Kevin_in_GA 4,599 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.
|
stockfetcher 980 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
|
pschmu 12 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.
Kevin,
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.
|
stockfetcher 980 posts msg #117266 |
12/6/2013 3:22:27 PM
We have added a first pass at a PctRank() function for StockFetcher. For example:
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
|
pschmu 12 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.
|