Click here to Login

Creating Stock & Market Short Interest Ratios using Historical Short Sale Data

Updated on 2011-06-07

A long strategy consists of buying stocks to profit from a price increase. The opposite strategy is called short strategy and it consists of selling stocks that you do not own in order to profit from a price decline. Traders and investors initiate short sale transactions because they believe that the price of the underlying stock will drop; they also invest in short strategies when they think that the market is bearish and therefore they want to profit from the decline of the stocks they invested in.

The process of short selling is usually managed by brokers. To put it in simple terms, when you sell short a stock, this stock will be borrowed from the broker's own inventory or from one of the broker's clients. When you decide to exit your short sale position, your broker will buy the stock and then give it back to its initial owner. You win or lose the difference between the sell price and the purchase price. This means that if during this period the stock declines then you will make a profit.

Downloading Short Sale Data

Short Selling data is provided by many stock market exchanges and it can be downloaded using one of the following items:
NYSE Arca - Daily short sale data
NASDAQ and Boston stock exchanges - Daily short sale data
Short Selling historical data
Short Selling Data

The last item gets short selling historical data for different U.S. Exchanges including NYSE, NASDAQ, AMEX and BATS from the Financial Regulatory Authority website. It then adds up the numbers and stores the result in a custom database "short_selling" that contains four fields: Date (Trading date), Short (Total number of shares that are short sold), Total (Volume or the total number of shares traded), Ratio (Short interest ratio). The data is available for the last two years.

Creating & Displaying the Short Interest Ratio

Short interest refers to the sum of the number of open short sale positions. The short interest ratio is calculated by dividing the short interest volume by the total trading volume. It is an indicator used by both technical and fundamental traders to identify the general sentiment regarding a particular stock (Bullish/Bearish degree).

Here is how to display the short interest ratio of a stock:
- Right click on a chart then click on "Create new pane"
- In the new pane, click on "Add Indicator" icon (First icon on the top of the pane)
- Select "Databases/Fields", select "short_selling" database, select "ratio" field, set "Get a value" option to "Set missing values to Zero" then click on "OK".

Here is how to create the moving average of the short interest ratio indicator:
- On the chart pane, click on "Add Indicator"
- Select "All Indicators" tab then select "SMA" (2) indicator
- Next to the close parameter, click on "Add" then add the short interest ratio as explained in the previous paragraph
- Click on "OK" to display the new trading indicator.

It is also possible to update the pane formula directly. To do so, right click on the chart then click on "Update Formula".

Here is the formula of the 14-Bar SMA of the short selling volume to total volume:

short1 = GetData("short_selling","short", Zero);
total1 = GetData("short_selling","total", Zero);
r = (sma(short1, 14) / sma(total1, 14)) * 100;
plot(r, "Short Ratio", colorGreen);

Note that you should run and download short selling historical data using the previous downloader before displaying the short interest ratio chart.

Creating a Short Interest ratio for the U.S. Market

This market sentiment indicator will calculate the ratio of the total short volume to the total volume of U.S. Stocks.

- Select "Tools" then "Composite" then open the composite manager.
- Click on "Add" to open the "Create Composite" form then click on "Next"
- In order to calculate the market sentiment ratio, we will need to create two composites then use the "Script" tool to compute the ratio.
- Type the following formula:

AddComposite("short", GetData("short_selling", "short", Zero), _CompSum);
AddComposite("total", GetData("short_selling", "total", Zero), _CompSum);
composite = 1;

- Click on "Script" then type the following CSharp code:

double[] short1 = Functions.GetVariable("short");
double[] total1 = Functions.GetVariable("total");
double[] ratio = new double[short1.Length];

for(int i=0;i < short1.Length;i++)
if(total1[i] == 0)
ratio[i] = 1;
ratio[i] = (short1[i] / total1[i]) * 100;


- Once the composite item is saved and calculation is completed, select the new composite name (Name starts with '_') in symbols list to display it on a chart.

The higher the value of this sentiment indicator, the more the number of traders with a bearish view of the market (More short positions are initialized).

no comments (Log in)

QuantShare Blog
Search Posts

Recent Posts

Create Graphs using the Grid Tool
Posted 1328 days ago

Profile Graphs
Posted 1433 days ago

Previous Posts

More Posts


Create an account
Affiliate Program
Contact Us
Trading Forum
How-to Lessons
About Us
Terms of Use

Copyright 2024
Social Media
Follow us on Facebook
Twitter Follow us on Twitter
Follow us on Google+
RSS Trading Items

Trading financial instruments, including foreign exchange on margin, carries a high level of risk and is not suitable for all investors. The high degree of leverage can work against you as well as for you. Before deciding to invest in financial instruments or foreign exchange you should carefully consider your investment objectives, level of experience, and risk appetite. The possibility exists that you could sustain a loss of some or all of your initial investment and therefore you should not invest money that you cannot afford to lose. You should be aware of all the risks associated with trading and seek advice from an independent financial advisor if you have any doubts.