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.
오픈 소스 스크립트
트레이딩뷰의 진정한 정신에 따라, 이 스크립트의 작성자는 이를 오픈소스로 공개하여 트레이더들이 기능을 검토하고 검증할 수 있도록 했습니다. 작성자에게 찬사를 보냅니다! 이 코드는 무료로 사용할 수 있지만, 코드를 재게시하는 경우 하우스 룰이 적용된다는 점을 기억하세요.
면책사항
해당 정보와 게시물은 금융, 투자, 트레이딩 또는 기타 유형의 조언이나 권장 사항으로 간주되지 않으며, 트레이딩뷰에서 제공하거나 보증하는 것이 아닙니다. 자세한 내용은 이용 약관을 참조하세요.
오픈 소스 스크립트
트레이딩뷰의 진정한 정신에 따라, 이 스크립트의 작성자는 이를 오픈소스로 공개하여 트레이더들이 기능을 검토하고 검증할 수 있도록 했습니다. 작성자에게 찬사를 보냅니다! 이 코드는 무료로 사용할 수 있지만, 코드를 재게시하는 경우 하우스 룰이 적용된다는 점을 기억하세요.
면책사항
해당 정보와 게시물은 금융, 투자, 트레이딩 또는 기타 유형의 조언이나 권장 사항으로 간주되지 않으며, 트레이딩뷰에서 제공하거나 보증하는 것이 아닙니다. 자세한 내용은 이용 약관을 참조하세요.