Choppiness_Index
Download scriptThis script introduces a specialized trading indicator called the Choppiness Index. Its primary purpose is to measure how "noisy" or "sideways" a financial market is, helping traders distinguish between periods of clear trending movement and periods of consolidation where the price is moving back and forth without establishing a significant direction.
Core Logic and Methodology
The script determines market conditions by analyzing the relationship between the actual price movement and the expected volatility. Here is the step-by-step breakdown of how it arrives at its conclusions:
1. Volatility Measurement The tool utilizes an Average True Range (ATR) calculation as a foundation. This helps the script understand the typical "swing" or range of the price over a specific timeframe.
2. Range Analysis For every point on the chart, the script looks back over a user-defined period to identify:
- The highest price reached.
- The lowest price reached.
- The current average price (Simple Moving Average).
3. The "Choppiness" Calculation The logic compares the distance between the high and low prices against the current average movement.
- If the price is covering a wide range but not moving significantly in one direction, the index identifies this as high "choppiness."
- It uses a logarithmic scale to translate these movements into a numerical value.
4. Visual Feedback and Thresholds The indicator plots a line on a separate window, which provides three distinct visual zones based on specific levels:
- Trend Level (Low Values): When the index is low, it suggests that the price is moving efficiently in a specific direction. This is typically the "green light" for trend-following strategies.
- Choppiness Level (Medium Values): As the value rises into this zone, it warns the user that the market is becoming erratic and less predictable.
- Consolidation Level (High Values): When the index reaches its peak, it indicates a highly "choppy" or sideways market where price action is confined to a tight range with no clear breakout.
Summary for Traders
Instead of telling you which direction the price will go, this script tells you how the price is behaving. It is designed to help you filter out "fake" signals during messy, sideways markets (High Choppiness) and identify periods where the market is smooth enough to support a trend (Low Choppiness).
ÿþ/ / + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +
/ / | C h o p p i n e s s _ I n d e x . m q 5 |
/ / | C o p y r i g h t 2 0 1 8 , M e t a Q u o t e s S o f t w a r e C o r p . |
/ / | h t t p s : / / m q l 5 . c o m |
/ / + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +
# p r o p e r t y c o p y r i g h t "