Click here to Login

4 original breadth indicators you should consider in your market timing strategy

Updated on 2011-10-19

The composite plug-in and the "composite" function are two important features in QuantShare. They both allow you to create composites or market indicators from a list of stocks, ETFs or any other securities.

We will present you here four original market indicators you can use in your trading system or portfolio and we will show you how to implement them using both the composite tool the composite function.

For each market breadth indicator, we will show you how to define each of the following points:
Composite Settings: This is a brief description of the composite settings. Create a new composite by selecting "Tools" then "Composite"; in the composite form, click on "Add".
Composite Formula: You should enter this formula in "Create Composite" form in the "Formula" tab.
Composite Function: This is how to implement the index using the "comp" function. The "comp" function allows you to create market indicators on fly. For more information, please refer to the following articles: How to create market indicators using the composite function - Part 1, Part 2 and Part 3.

Ratio of oversold to overbought stocks

The term overbought refers to the price of a security being too high and susceptible to a decline, while oversold is the opposite and refers to a stock whose price is too low and ready for a rally.

The ratio of oversold to overbought stocks measures the total number of stocks whose relative strength index (RSI) is below 30 and then divides it by the number of stocks whose RSI is above 70.

Below 0.7, the market is considered overbought and above 1.3 it is considered oversold. As with the relative strength index interpretation, prices within overbought and oversold areas may signal a change in the security trend.

Composite Formula:
This composite is implemented here: Percent Oversold to Overbought Stocks - Market Breadh Indicator

Composite Function:
a = comp(rsi(14) > 70, "sum") / comp(rsi(14) < 30, "sum");

Percentage of Stocks trading above the upper Bollinger band

Here is another composite indicator that tells you the percentage of stocks that are trading above their upper Bollinger band compared to stocks trading below their lower Bollinger band.

The higher the value the more stocks are trading above their upper Bollinger band. Consequently, a high value should be considered as a bullish signal.

Composite Settings:
Calculation Method = Avg
Multiply by 100

Composite Formula:
up1 = close >= BbandsUpper(30, 2, _MaSma);
down1 = close <= BbandsLower(30, 2, _MaSma);
composite = up1;
filter = up1 or down1;

By specifying the filter rule, we have instructed the composite engine to include only stocks that are above/below their upper/lower Bollinger band. The composite calculation will be based on these stocks only and therefore we specified (Close >= upper band) as composite formula and "Average" as calculation method. This means that for each bar, the composite will return the number of stocks that are trading above their upper band divided by the total number of stocks that meet the filter criteria.

Composite Function:
cup1 = comp(close >= BbandsUpper(30, 2, _MaSma), "sum");
cdown1 = comp(close <= BbandsLower(30, 2, _MaSma), "sum");
a = cup1 / (cup1 + cdown1);

Individual Put/Call Sentiment

Unlike the popular put/call ratio that sums the total put volume and divides it by the total call volume, this indicator makes use of the put and call data at the stock level. For each stock, it compares the put and call volume and counts the number of stocks that have more put volume traded than call volume for a particular day. The result is then divided by the total number stocks.

In order to create this sentiment indicator, you have to download put and call volume data for optionable stocks listed on U.S. exchanges. The data can be retrieved using the following item: Individual Stocks Put and Call Volume.
Once the data is downloaded, you will use the "GetData" function to reference external database data (Put/call volume will be stored in an external database whose name is "putcall_volume").

Composite Settings:
Calculation Method = Avg
Multiply by 100

Composite Formula:
composite = GetData("putcall_volume", "put_total", Zero) > GetData("putcall_volume", "call_total", Zero);

Composite Function:
pc = GetData("putcall_volume", "put_total", Zero) > GetData("putcall_volume", "call_total", Zero);
a = comp(pc, "avg");

A value higher than one indicates that there are more stocks with higher put volume (compared to call volume) than stocks with higher call volume.

Moving average Ratio

Finally, our last market breadth indicator makes use of two simple moving averages: a short term and a long-term one. It measures the proportion of stocks whose short-term moving average is above the long-term one. If we consider that, a stock is trending up if its short term MA is above the long term MA, this indicator computes then the percentage of stocks that are trending up.

Composite Settings:
Calculation Method = Avg
Multiply by 100

Composite Formula:
composite = sma(10) > sma(90);

Composite Function:
a = comp(sma(10) > sma(90), "avg");

Filter Rule

Generally, you don't want to include thinly traded and micro-cap stocks in the composite calculation. You may also want to ignore assets with particular settings.

This can be done by adding a filter in the composite formula. Both composite tools allow you to enter a filter rule.

Composite Plug-in example:
composite = ma(10) > sma(90);
filter = close > 2 and close * sma(volume, 10) > 10000;
// Include only stocks whose average daily volume is higher than 10,000 and price above 2.

Composite function example:
filter = close > 2 and close * sma(volume, 10) > 10000;
a = comp(ma(10) > sma(90), "avg", 1, filter)

2 comments (Log in)

QuantShare Blog
Search Posts

Recent Posts

Create Graphs using the Grid Tool
Posted 1291 days ago

Profile Graphs
Posted 1396 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.