OPEN-SOURCE SCRIPT
BACAP PRICE STRUCTURE 21 EMA TREND

21dma-STRUCTURE
Overview
The 21dma-STRUCTURE indicator is a sophisticated overlay indicator that visualizes price action relative to a triple 21-period exponential moving average structure. Originally developed by BalarezoCapital and enhanced by PrimeTrading, this indicator provides clear visual cues for trend direction and momentum through dynamic bar coloring and EMA structure analysis.
Key Features
Triple EMA Structure
- 21 EMA High: Tracks the exponential moving average of high prices
- 21 EMA Close: Tracks the exponential moving average of closing prices
- 21 EMA Low: Tracks the exponential moving average of low prices
- Dynamic Cloud: Gray fill between high and low EMAs for visual structure reference
Smart Bar Coloring System
- Blue Bars: Price closes above all three EMAs (strong bullish momentum)
- Pink Bars: Daily high falls below the lowest EMA (strong bearish signal)
- Gray Bars: Neutral conditions or transitional phases
- Color Memory: Maintains previous color until new condition is met
Dynamic Center Line
- Trend-Following Color: Green when all EMAs are rising, red when all are falling
- Color Persistence: Maintains trend color during sideways movement
- Visual Clarity: Thicker center line for easy trend identification
Customizable Visual Elements
- Adjustable line thickness for all EMA plots
- Customizable colors for bullish and bearish conditions
- Configurable trend colors for uptrend and downtrend phases
- Optional bar color changes with toggle control
How to Use
Trend Identification
- Rising Green Center Line: All EMAs trending upward (bullish structure)
- Falling Red Center Line: All EMAs trending downward (bearish structure)
- Flat Center Line: Maintains last trend color during consolidation
Momentum Analysis
- Blue Bars: Strong bullish momentum with price above entire EMA structure
- Pink Bars: Strong bearish momentum with high below lowest EMA
- Gray Bars: Neutral or transitional momentum phases
Entry and Exit Signals
- Bullish Setup: Look for blue bars during green center line periods
- Bearish Setup: Look for pink bars during red center line periods
- Exit Consideration: Watch for color changes as potential momentum shifts
Structure Trading
- Support/Resistance: Use EMA cloud as dynamic support and resistance zones
- Breakout Confirmation: Bar color changes can confirm structure breakouts
- Trend Continuation: Color persistence suggests ongoing momentum
Settings
Visual Customization
- Change Bar Color: Toggle to enable/disable bar coloring
- Line Size: Adjust thickness of EMA lines (default: 3)
- Bullish Candle Color: Customize blue bar color
- Bearish Candle Color: Customize pink bar color
Trend Colors
- Uptrend Color: Color for rising EMA center line (default: green)
- Downtrend Color: Color for falling EMA center line (default: red)
- Cloud Color: Fill color between high and low EMAs (default: gray)
Advanced Features
Modified Bar Logic
Unlike traditional EMA systems, this indicator uses refined conditions:
- Bullish signals require close above ALL three EMAs
- Bearish signals require high below the LOWEST EMA
- Enhanced precision reduces false signals compared to single EMA systems
Trend Memory System
- Intelligent color persistence during sideways movement
- Reduces noise from minor EMA fluctuations
- Maintains trend context during consolidation periods
Performance Optimization
- Efficient calculation methods for real-time performance
- Clean visual design that doesn't clutter charts
- Compatible with all timeframes and instruments
Best Practices
Multi-Timeframe Analysis
- Use higher timeframes to identify overall trend direction
- Apply on multiple timeframes for confluence
- Combine with weekly/monthly charts for position trading
Risk Management
- Use bar color changes as early warning signals
- Consider position sizing based on EMA structure strength
- Set stops relative to EMA support/resistance levels
Combination Strategies
- Pair with volume indicators for confirmation
- Use alongside RSI or MACD for momentum confirmation
- Combine with key support/resistance levels
Market Context
- More effective in trending markets than choppy conditions
- Consider overall market environment and sector strength
- Adjust expectations during high volatility periods
Technical Specifications
- Based on 21-period exponential moving averages
- Uses Pine Script v6 for optimal performance
- Overlay indicator that works with any chart type
- Maximum 500 lines for clean performance
Ideal Applications
- Swing trading on daily charts
- Position trading on weekly charts
- Intraday momentum trading (adjust timeframe accordingly)
- Trend following strategies
- Structure-based trading approaches
Disclaimer
This indicator is for educational and informational purposes only. It should not be used as the sole basis for trading decisions. Always combine with other forms of analysis, proper risk management, and consider your individual trading plan and risk tolerance.
Compatible with Pine Script v6 | Works on all timeframes | Optimized for trending markets
Overview
The 21dma-STRUCTURE indicator is a sophisticated overlay indicator that visualizes price action relative to a triple 21-period exponential moving average structure. Originally developed by BalarezoCapital and enhanced by PrimeTrading, this indicator provides clear visual cues for trend direction and momentum through dynamic bar coloring and EMA structure analysis.
Key Features
Triple EMA Structure
- 21 EMA High: Tracks the exponential moving average of high prices
- 21 EMA Close: Tracks the exponential moving average of closing prices
- 21 EMA Low: Tracks the exponential moving average of low prices
- Dynamic Cloud: Gray fill between high and low EMAs for visual structure reference
Smart Bar Coloring System
- Blue Bars: Price closes above all three EMAs (strong bullish momentum)
- Pink Bars: Daily high falls below the lowest EMA (strong bearish signal)
- Gray Bars: Neutral conditions or transitional phases
- Color Memory: Maintains previous color until new condition is met
Dynamic Center Line
- Trend-Following Color: Green when all EMAs are rising, red when all are falling
- Color Persistence: Maintains trend color during sideways movement
- Visual Clarity: Thicker center line for easy trend identification
Customizable Visual Elements
- Adjustable line thickness for all EMA plots
- Customizable colors for bullish and bearish conditions
- Configurable trend colors for uptrend and downtrend phases
- Optional bar color changes with toggle control
How to Use
Trend Identification
- Rising Green Center Line: All EMAs trending upward (bullish structure)
- Falling Red Center Line: All EMAs trending downward (bearish structure)
- Flat Center Line: Maintains last trend color during consolidation
Momentum Analysis
- Blue Bars: Strong bullish momentum with price above entire EMA structure
- Pink Bars: Strong bearish momentum with high below lowest EMA
- Gray Bars: Neutral or transitional momentum phases
Entry and Exit Signals
- Bullish Setup: Look for blue bars during green center line periods
- Bearish Setup: Look for pink bars during red center line periods
- Exit Consideration: Watch for color changes as potential momentum shifts
Structure Trading
- Support/Resistance: Use EMA cloud as dynamic support and resistance zones
- Breakout Confirmation: Bar color changes can confirm structure breakouts
- Trend Continuation: Color persistence suggests ongoing momentum
Settings
Visual Customization
- Change Bar Color: Toggle to enable/disable bar coloring
- Line Size: Adjust thickness of EMA lines (default: 3)
- Bullish Candle Color: Customize blue bar color
- Bearish Candle Color: Customize pink bar color
Trend Colors
- Uptrend Color: Color for rising EMA center line (default: green)
- Downtrend Color: Color for falling EMA center line (default: red)
- Cloud Color: Fill color between high and low EMAs (default: gray)
Advanced Features
Modified Bar Logic
Unlike traditional EMA systems, this indicator uses refined conditions:
- Bullish signals require close above ALL three EMAs
- Bearish signals require high below the LOWEST EMA
- Enhanced precision reduces false signals compared to single EMA systems
Trend Memory System
- Intelligent color persistence during sideways movement
- Reduces noise from minor EMA fluctuations
- Maintains trend context during consolidation periods
Performance Optimization
- Efficient calculation methods for real-time performance
- Clean visual design that doesn't clutter charts
- Compatible with all timeframes and instruments
Best Practices
Multi-Timeframe Analysis
- Use higher timeframes to identify overall trend direction
- Apply on multiple timeframes for confluence
- Combine with weekly/monthly charts for position trading
Risk Management
- Use bar color changes as early warning signals
- Consider position sizing based on EMA structure strength
- Set stops relative to EMA support/resistance levels
Combination Strategies
- Pair with volume indicators for confirmation
- Use alongside RSI or MACD for momentum confirmation
- Combine with key support/resistance levels
Market Context
- More effective in trending markets than choppy conditions
- Consider overall market environment and sector strength
- Adjust expectations during high volatility periods
Technical Specifications
- Based on 21-period exponential moving averages
- Uses Pine Script v6 for optimal performance
- Overlay indicator that works with any chart type
- Maximum 500 lines for clean performance
Ideal Applications
- Swing trading on daily charts
- Position trading on weekly charts
- Intraday momentum trading (adjust timeframe accordingly)
- Trend following strategies
- Structure-based trading approaches
Disclaimer
This indicator is for educational and informational purposes only. It should not be used as the sole basis for trading decisions. Always combine with other forms of analysis, proper risk management, and consider your individual trading plan and risk tolerance.
Compatible with Pine Script v6 | Works on all timeframes | Optimized for trending markets
Skrip open-source
Dengan semangat TradingView yang sesungguhnya, penulis skrip ini telah menjadikannya sumber terbuka, sehingga para trader dapat meninjau dan memverifikasi fungsinya. Hormat untuk penulisnya! Meskipun anda dapat menggunakannya secara gratis, ingatlah bahwa penerbitan ulang kode tersebut tunduk pada Tata Tertib kami.
Pernyataan Penyangkalan
Informasi dan publikasi tidak dimaksudkan untuk menjadi, dan bukan merupakan saran keuangan, investasi, perdagangan, atau rekomendasi lainnya yang diberikan atau didukung oleh TradingView. Baca selengkapnya di Persyaratan Penggunaan.
Skrip open-source
Dengan semangat TradingView yang sesungguhnya, penulis skrip ini telah menjadikannya sumber terbuka, sehingga para trader dapat meninjau dan memverifikasi fungsinya. Hormat untuk penulisnya! Meskipun anda dapat menggunakannya secara gratis, ingatlah bahwa penerbitan ulang kode tersebut tunduk pada Tata Tertib kami.
Pernyataan Penyangkalan
Informasi dan publikasi tidak dimaksudkan untuk menjadi, dan bukan merupakan saran keuangan, investasi, perdagangan, atau rekomendasi lainnya yang diberikan atau didukung oleh TradingView. Baca selengkapnya di Persyaratan Penggunaan.