#twitter-follow { border: 0;position: fixed; top: 240px; left:0;} #live-support { border: 0;position: fixed; top: 370px; left:0;} #knowledge-base { border: 0;position: fixed; top: 170px; left:0;}

### Trading Indicators using the Rank and Percentile functions

Updated on 2010-09-21

With several calculation methods, the composite function allows you to create a variety of composites, indices or market breadth indicators.

This is the forth part of a series that presents the different calculation methods available in the composite function of QuantShare. In the first, second and third posts, we have introduced six methods which are: "Count", "Sum", "Avg", "Max", "Min" and "Sdv". All these methods have something in common: they all create a unique time series that is the same for all symbols/stocks.

The Rank and Percentile function are different from the other methods in that they do not really create composites or indices but rather use data or quotes from all your symbols and return a unique value for each one of them based on how a specific value for a particular stock compares to other values from other stocks for the same date.

Rank and Percentile

The Rank function calculates the symbol's rank based on the time series you provide. Note that the symbol's rank will vary from date to date. This means that a stock could be ranked number one on a particular date and then ranked two, three or any other rank on the next day.

The Percentile function works as the Rank function. However, instead of providing ranks, the Percentile returns values that vary between 0% and 100%. A value of 100% is the equivalent of the rank number 1 and a value of 0% correspond to the worst rank a symbol or stock may have.

Let us use an example to further explain the Rank and Percentile functions. Imagine, we want to rank S&P 500 stocks based on their daily volume. The trading software will read S&P 500 stock quotes and then compare the volume time series of these stocks for each trading day. If Google had the biggest volume on August 12, 2010, then Google rank will be equal to 1. If we had used the Percentile function then Google percentile value would be equal to 100%.

In the improbable case where there is only one stock for a particular date, this stock will get a rank value of one. The stock that has the lowest volume value, for day Y, will get a rank value that is equal to the number of stocks (with quotes) for that day Y minus one.

Example of Rank and Percentile functions uses

Comp(perf(close, 1), "Rank") <= 5

The above trading rule returns the top 5 stocks that have the highest one-bar rate of return.

Comp(volume, "Percentile") >= 90

This volume-based trading rule gets stocks that are in the top 10% of stocks with the highest volume value. Unlike the above Rank function which returns only 5 stocks, the current one returns 10% of all stocks included in the analysis. If you have included 5000 stocks in your trading system then this volume rule will return 500 stocks.

We'll see advanced uses of this powerful composite function later.

 one comment (Log in)

 Search Posts Recent Posts Backtesting a Strategy Based on Bond and Stock Index ETFs Posted Yesterday 4 Links to Download Free Historical Stock Prices Data by Date Posted 8 days ago Quantitative Analysis: Price Channels Posted 13 days ago How to Download Trading Data for Certain Securities Only Posted 22 days ago Learn How to Create Your Own Technical Analysis Indicators Posted 30 days ago How to Pick the Best Trend Indicators Posted 41 days ago Update Chart Layout based on Active Ticker Symbol - Part 2 Posted 57 days ago Previous Posts Trading Indicators using the Rank and Percentile functions Posted 1003 days ago How to Create Custom Metrics for Your Trading Positions Posted 1010 days ago How to search for a trading item Posted 1017 days ago How to create market indicators using the composite function - Part 3 Posted 1024 days ago How to create market indicators using the composite function - Part 2 Posted 1031 days ago Create a Pivot Table that displays the Relative Strength Index - RSI Posted 1045 days ago 6 Stock Trading Items Related to the New York Stock Exchange - NYSE Posted 1052 days ago Pivot Tables in QuantShare Trading Software Posted 1065 days ago How to create market indicators using the composite function - Part 1 Posted 1073 days ago Optimize a trading strategy using the Sharpe ratio Posted 1080 days ago How to create a trading indicator that uses stock news Posted 1087 days ago How to create your own technical analysis indicators Posted 1094 days ago Create a stock index or a trading indicator using the composite tools Posted 1101 days ago

 Company About Us Privacy Terms of Use Copyright © 2012 QuantShare.com Social Media Follow us on Facebook Follow us on Twitter