Identifying Trending and Ranging Markets (Python Tutorial)
Plot generated with Plotly
Identifying the type of market is important for picking the right trading strategy and can make the difference between making a profit or a loss.
For example, a grid trading strategy against the trend can be profitable in a ranging market whereas a grid trading strategy with the trend can result in profits in a trending market.
If you would like to find out how to assess the current market choppiness or trendiness, this post is for you.
This story is solely for general information purposes, and should not be relied upon for trading recommendations or financial advice. Source code and information is provided for educational purposes only, and should not be relied upon to make an investment decision. Please review my full cautionary guidance before continuing.
What is the Choppiness Index?
In order to determine if a market is currently ranging or trending, the Choppiness Index can be used.
According to incrediblecharts.com, the Choppiness Index is a volatility indicator developed by Australian commodity trader Bill Dreiss.
The Choppiness index is not meant to predict future market direction, it is used to quantify the current market ‘choppiness’. According to investopedia.com a choppy market is a market in which prices move up and down considerably.
The Choppiness index is based on the Average True Range (ATR) index, which uses differences between high/low and low/close prices of current and previous period as a measure of volatility.
The formula for calculating the Choppiness Index is as follows:
Chop = 100 * Log 10(Sum(ATR(1), n) / ( Max High(n) - Min Low(n) ) ) / Log 10(n)
n = User defined period length.
Log 10(n) = Base 10 Log of n
ATR(1) = Average True Range (Period of 1)
Sum(ATR(1), n) = Sum of the Average True Range over past n bars Max High(n) = The highest high over past n bars
If you would like to find out in detail how the Choppiness Index is calculated, check out these posts by Nikhil Adithyan and Sofien Kaabar.
The Choppiness Index provides values with a range between 0 and 100.
An index above 61.8% indicates a ranging market that is about to change to a trending period.
An index below 38.2% indicates a trending market that is about to stabilize and change to a ranging period.