OPEN-SOURCE SCRIPT
DMI ADX Bollinger Bands

This Pine Script code merges the classic DMI (Directional Movement Index) and ADX (Average Directional Index) indicators with Bollinger Bands, but with a unique twist: the Bollinger Bands are applied to the ADX line itself rather than the price.
This structure allows you to analyze not just the strength of the trend, but the volatility of that trend's momentum.
1. Components of the Indicator
+DI (Navy Line): Represents the strength of the bullish (upward) momentum.
-DI (Red Line): Represents the strength of the bearish (downward) momentum.
ADX (Green Line): Measures the absolute strength of the trend.
Bollinger Bands (Gray Lines & Blue Shading): Measure the volatility of the ADX line (i.e., how rapidly the trend is gaining or losing momentum).
2. How to Interpret the Signals
A. Trend Direction (DMI)
+DI > -DI: The market is trending upward.
-DI > +DI: The market is trending downward.
B. Trend Strength (ADX Levels)
Below 20: The market lacks a clear trend or is in a "ranging" (sideways) state.
20 – 40: A trend is forming and gaining strength. This is usually the prime area for trend-following strategies.
Above 40: The trend is very strong, but it also indicates the market is becoming "overextended" or at risk of exhaustion.
C. Trend Momentum (ADX + Bollinger Bands)
This is the core feature of your script:
ADX crosses above the Upper Band: The trend is gaining momentum explosively. This often indicates a strong breakout or an acceleration in the current price move.
ADX nears the Lower Band: The trend is losing steam or entering a consolidation/sideways phase.
ADX is between the bands: The trend is moving at a consistent, sustainable pace.
3. Trading Strategies
Trend-Following (Entry)
Entry: Look for a cross where +DI > -DI (for long) or -DI > +DI (for short), while the ADX is above 20.
Confirmation: Ideally, you want to see the ADX line moving upward, ideally heading toward the Upper Bollinger Band, confirming that the momentum is building.
Profit Taking / Reversal (Exhaustion)
When the ADX reaches the 40–50 level and touches or exceeds the Upper Bollinger Band, the trend is likely "overextended." This is a strong signal to consider taking profits or tightening your stop-loss, as the market may be due for a correction.
Identifying Ranging Markets
If the ADX line drops below the Lower Bollinger Band, the market has officially entered a low-volatility/sideways phase. Avoid trend-following strategies in this zone and consider strategies better suited for choppy markets.
This structure allows you to analyze not just the strength of the trend, but the volatility of that trend's momentum.
1. Components of the Indicator
+DI (Navy Line): Represents the strength of the bullish (upward) momentum.
-DI (Red Line): Represents the strength of the bearish (downward) momentum.
ADX (Green Line): Measures the absolute strength of the trend.
Bollinger Bands (Gray Lines & Blue Shading): Measure the volatility of the ADX line (i.e., how rapidly the trend is gaining or losing momentum).
2. How to Interpret the Signals
A. Trend Direction (DMI)
+DI > -DI: The market is trending upward.
-DI > +DI: The market is trending downward.
B. Trend Strength (ADX Levels)
Below 20: The market lacks a clear trend or is in a "ranging" (sideways) state.
20 – 40: A trend is forming and gaining strength. This is usually the prime area for trend-following strategies.
Above 40: The trend is very strong, but it also indicates the market is becoming "overextended" or at risk of exhaustion.
C. Trend Momentum (ADX + Bollinger Bands)
This is the core feature of your script:
ADX crosses above the Upper Band: The trend is gaining momentum explosively. This often indicates a strong breakout or an acceleration in the current price move.
ADX nears the Lower Band: The trend is losing steam or entering a consolidation/sideways phase.
ADX is between the bands: The trend is moving at a consistent, sustainable pace.
3. Trading Strategies
Trend-Following (Entry)
Entry: Look for a cross where +DI > -DI (for long) or -DI > +DI (for short), while the ADX is above 20.
Confirmation: Ideally, you want to see the ADX line moving upward, ideally heading toward the Upper Bollinger Band, confirming that the momentum is building.
Profit Taking / Reversal (Exhaustion)
When the ADX reaches the 40–50 level and touches or exceeds the Upper Bollinger Band, the trend is likely "overextended." This is a strong signal to consider taking profits or tightening your stop-loss, as the market may be due for a correction.
Identifying Ranging Markets
If the ADX line drops below the Lower Bollinger Band, the market has officially entered a low-volatility/sideways phase. Avoid trend-following strategies in this zone and consider strategies better suited for choppy markets.
开源脚本
秉承TradingView的精神,该脚本的作者将其开源,以便交易者可以查看和验证其功能。向作者致敬!您可以免费使用该脚本,但请记住,重新发布代码须遵守我们的网站规则。
免责声明
这些信息和出版物并非旨在提供,也不构成TradingView提供或认可的任何形式的财务、投资、交易或其他类型的建议或推荐。请阅读使用条款了解更多信息。
开源脚本
秉承TradingView的精神,该脚本的作者将其开源,以便交易者可以查看和验证其功能。向作者致敬!您可以免费使用该脚本,但请记住,重新发布代码须遵守我们的网站规则。
免责声明
这些信息和出版物并非旨在提供,也不构成TradingView提供或认可的任何形式的财务、投资、交易或其他类型的建议或推荐。请阅读使用条款了解更多信息。