OPEN-SOURCE SCRIPT
EMA Slope Angle

# EMA Slope Angle Indicator
A professional, non-repainting overlay indicator that visualizes EMA slope strength as an angle in degrees, providing instant visual feedback through dynamic EMA coloring and comprehensive trend analysis.
## ORIGINALITY
This indicator is original in its approach to slope measurement:
- **Angle-based calculation**: Uses arctangent to calculate slope as an angle in degrees (not percentage), providing a more intuitive measure of trend strength
- **Dynamic visual feedback**: Combines real-time EMA line coloring with regime detection, creating a continuous visual representation of market conditions
- **Comprehensive analysis**: Integrates angle-based trend shift signals with optional statistical analysis in a single, cohesive tool
- **Non-repainting design**: All calculations use confirmed bars only, ensuring reliable, deterministic output
## HOW IT WORKS
The indicator calculates the EMA slope angle using trigonometric functions:
```
Angle = arctan((EMA_current - EMA_past) / lookback_bars) × 180/π
```
This provides an intuitive measure where:
- **Steep angles** = strong trends (visualized with saturated colors)
- **Shallow angles** = weak trends (visualized with lighter colors)
- **Near-zero angles** = flat/consolidation (visualized in gray)
The EMA line color dynamically reflects:
- **Direction**: Green shades for uptrends, red shades for downtrends
- **Strength**: Color intensity based on normalized angle (stronger slopes = more saturated colors)
- **Regime**: Gray for flat conditions when angle is below threshold
## KEY FEATURES
### Dynamic EMA Coloring
- EMA line color changes continuously based on slope strength
- Color intensity reflects trend strength (50-100% opacity range)
- Instant visual feedback without cluttering the chart
### Regime Detection
- Automatically classifies market conditions: **RISING**, **FALLING**, or **FLAT**
- Configurable angle thresholds for regime classification
- Real-time regime updates on confirmed bars only
### Trend-Shift Signals
- Detects transitions from FLAT to RISING/FALLING regimes
- Visual arrows on chart when significant trend shifts occur
- Prevents signal spam by only triggering from FLAT state
- Configurable trigger thresholds for signal sensitivity
### KPI Dashboard
- Real-time angle display (rounded to 1 decimal place)
- Current regime status with color coding
- Last signal tracking (UP/DOWN/NONE)
- Positioned in top-right corner for easy reference
### Advanced Angle Statistics (Optional)
- Detailed breakdown of angle distribution across 9 granular buckets:
- 0-0.2°, 0.2-0.5°, 0.5-1°, 1-1.5°, 1.5-2°, 2-3°, 3-5°, 5-10°, >10°
- Shows count and percentage for each bucket
- Automatically resets on symbol/timeframe changes
- Useful for analyzing historical slope patterns
## SETTINGS
### Main Settings
- **EMA Length**: Period for exponential moving average (default: 50)
- **Slope Lookback Bars**: Number of bars to compare for slope calculation (default: 5)
### Angle Settings
- **Flat Angle Threshold**: Maximum angle for FLAT regime classification (default: 2.0°)
- **Rising Angle Trigger**: Minimum angle to trigger RISING regime and UP signals (default: 1.0°)
- **Falling Angle Trigger**: Maximum angle to trigger FALLING regime and DOWN signals (default: -1.0°)
- **Max Angle for Color Saturation**: Maximum angle for full color intensity (default: 30.0°)
### Display Options
- **Uptrend Color**: Color for rising trends (default: dark green)
- **Downtrend Color**: Color for falling trends (default: dark red)
- **Flat Color**: Color for flat conditions (default: gray)
- **Show Trend-Shift Signals**: Toggle signal arrows on/off (default: true)
- **Show Angle Statistics**: Toggle statistics dashboard on/off (default: false)
## NON-REPAINTING GUARANTEE
- All calculations use confirmed bars only (`barstate.isconfirmed`)
- No future bar references
- No higher timeframe calls using `request.security()`
- Deterministic output - what you see is what you get
- Reliable for backtesting and live trading
## USE CASES
- **Trend Identification**: Instantly identify trend strength and direction at a glance
- **Reversal Detection**: Spot trend reversals early through regime changes
- **Trade Filtering**: Filter trades based on slope strength and regime
- **Consolidation Monitoring**: Identify flat market conditions for range trading
- **Pattern Analysis**: Study historical angle distributions to understand market behavior
- **Momentum Assessment**: Gauge trend momentum through visual color intensity
## LIMITATIONS
- Angle calculation depends on EMA length and lookback period settings
- Regime classification is based on configurable thresholds - adjust to match your trading style
- Signals only trigger when transitioning from FLAT state to prevent spam
- Statistics reset on symbol/timeframe changes (by design)
- Color intensity is normalized to max angle setting - adjust for your market's typical ranges
## TECHNICAL NOTES
- Uses Pine Script v6
- Overlay indicator (plots on price chart)
- No external dependencies
- Compatible with all TradingView chart types
- Works on all timeframes and symbols
## DISCLAIMER
This indicator is designed for visual trend analysis and educational purposes. Always combine with other technical analysis tools, fundamental analysis, and proper risk management strategies. Past performance does not guarantee future results. Trading involves risk of loss.
---
**Perfect for**: Swing traders, day traders, trend followers, and market analysts seeking intuitive trend strength visualization.
A professional, non-repainting overlay indicator that visualizes EMA slope strength as an angle in degrees, providing instant visual feedback through dynamic EMA coloring and comprehensive trend analysis.
## ORIGINALITY
This indicator is original in its approach to slope measurement:
- **Angle-based calculation**: Uses arctangent to calculate slope as an angle in degrees (not percentage), providing a more intuitive measure of trend strength
- **Dynamic visual feedback**: Combines real-time EMA line coloring with regime detection, creating a continuous visual representation of market conditions
- **Comprehensive analysis**: Integrates angle-based trend shift signals with optional statistical analysis in a single, cohesive tool
- **Non-repainting design**: All calculations use confirmed bars only, ensuring reliable, deterministic output
## HOW IT WORKS
The indicator calculates the EMA slope angle using trigonometric functions:
```
Angle = arctan((EMA_current - EMA_past) / lookback_bars) × 180/π
```
This provides an intuitive measure where:
- **Steep angles** = strong trends (visualized with saturated colors)
- **Shallow angles** = weak trends (visualized with lighter colors)
- **Near-zero angles** = flat/consolidation (visualized in gray)
The EMA line color dynamically reflects:
- **Direction**: Green shades for uptrends, red shades for downtrends
- **Strength**: Color intensity based on normalized angle (stronger slopes = more saturated colors)
- **Regime**: Gray for flat conditions when angle is below threshold
## KEY FEATURES
### Dynamic EMA Coloring
- EMA line color changes continuously based on slope strength
- Color intensity reflects trend strength (50-100% opacity range)
- Instant visual feedback without cluttering the chart
### Regime Detection
- Automatically classifies market conditions: **RISING**, **FALLING**, or **FLAT**
- Configurable angle thresholds for regime classification
- Real-time regime updates on confirmed bars only
### Trend-Shift Signals
- Detects transitions from FLAT to RISING/FALLING regimes
- Visual arrows on chart when significant trend shifts occur
- Prevents signal spam by only triggering from FLAT state
- Configurable trigger thresholds for signal sensitivity
### KPI Dashboard
- Real-time angle display (rounded to 1 decimal place)
- Current regime status with color coding
- Last signal tracking (UP/DOWN/NONE)
- Positioned in top-right corner for easy reference
### Advanced Angle Statistics (Optional)
- Detailed breakdown of angle distribution across 9 granular buckets:
- 0-0.2°, 0.2-0.5°, 0.5-1°, 1-1.5°, 1.5-2°, 2-3°, 3-5°, 5-10°, >10°
- Shows count and percentage for each bucket
- Automatically resets on symbol/timeframe changes
- Useful for analyzing historical slope patterns
## SETTINGS
### Main Settings
- **EMA Length**: Period for exponential moving average (default: 50)
- **Slope Lookback Bars**: Number of bars to compare for slope calculation (default: 5)
### Angle Settings
- **Flat Angle Threshold**: Maximum angle for FLAT regime classification (default: 2.0°)
- **Rising Angle Trigger**: Minimum angle to trigger RISING regime and UP signals (default: 1.0°)
- **Falling Angle Trigger**: Maximum angle to trigger FALLING regime and DOWN signals (default: -1.0°)
- **Max Angle for Color Saturation**: Maximum angle for full color intensity (default: 30.0°)
### Display Options
- **Uptrend Color**: Color for rising trends (default: dark green)
- **Downtrend Color**: Color for falling trends (default: dark red)
- **Flat Color**: Color for flat conditions (default: gray)
- **Show Trend-Shift Signals**: Toggle signal arrows on/off (default: true)
- **Show Angle Statistics**: Toggle statistics dashboard on/off (default: false)
## NON-REPAINTING GUARANTEE
- All calculations use confirmed bars only (`barstate.isconfirmed`)
- No future bar references
- No higher timeframe calls using `request.security()`
- Deterministic output - what you see is what you get
- Reliable for backtesting and live trading
## USE CASES
- **Trend Identification**: Instantly identify trend strength and direction at a glance
- **Reversal Detection**: Spot trend reversals early through regime changes
- **Trade Filtering**: Filter trades based on slope strength and regime
- **Consolidation Monitoring**: Identify flat market conditions for range trading
- **Pattern Analysis**: Study historical angle distributions to understand market behavior
- **Momentum Assessment**: Gauge trend momentum through visual color intensity
## LIMITATIONS
- Angle calculation depends on EMA length and lookback period settings
- Regime classification is based on configurable thresholds - adjust to match your trading style
- Signals only trigger when transitioning from FLAT state to prevent spam
- Statistics reset on symbol/timeframe changes (by design)
- Color intensity is normalized to max angle setting - adjust for your market's typical ranges
## TECHNICAL NOTES
- Uses Pine Script v6
- Overlay indicator (plots on price chart)
- No external dependencies
- Compatible with all TradingView chart types
- Works on all timeframes and symbols
## DISCLAIMER
This indicator is designed for visual trend analysis and educational purposes. Always combine with other technical analysis tools, fundamental analysis, and proper risk management strategies. Past performance does not guarantee future results. Trading involves risk of loss.
---
**Perfect for**: Swing traders, day traders, trend followers, and market analysts seeking intuitive trend strength visualization.
오픈 소스 스크립트
트레이딩뷰의 진정한 정신에 따라, 이 스크립트의 작성자는 이를 오픈소스로 공개하여 트레이더들이 기능을 검토하고 검증할 수 있도록 했습니다. 작성자에게 찬사를 보냅니다! 이 코드는 무료로 사용할 수 있지만, 코드를 재게시하는 경우 하우스 룰이 적용된다는 점을 기억하세요.
면책사항
해당 정보와 게시물은 금융, 투자, 트레이딩 또는 기타 유형의 조언이나 권장 사항으로 간주되지 않으며, 트레이딩뷰에서 제공하거나 보증하는 것이 아닙니다. 자세한 내용은 이용 약관을 참조하세요.
오픈 소스 스크립트
트레이딩뷰의 진정한 정신에 따라, 이 스크립트의 작성자는 이를 오픈소스로 공개하여 트레이더들이 기능을 검토하고 검증할 수 있도록 했습니다. 작성자에게 찬사를 보냅니다! 이 코드는 무료로 사용할 수 있지만, 코드를 재게시하는 경우 하우스 룰이 적용된다는 점을 기억하세요.
면책사항
해당 정보와 게시물은 금융, 투자, 트레이딩 또는 기타 유형의 조언이나 권장 사항으로 간주되지 않으며, 트레이딩뷰에서 제공하거나 보증하는 것이 아닙니다. 자세한 내용은 이용 약관을 참조하세요.