OPEN-SOURCE SCRIPT
Updated DAMA OSC - Directional Adaptive MA Oscillator

Overview:
The DAMA OSC (Directional Adaptive MA Oscillator) is a highly customizable and versatile oscillator that analyzes the delta between two moving averages of your choice. It detects trend progression, regressions, rebound signals, MA cross and critical zone crossovers to provide highly contextual trading information.
Designed for trend-following, reversal timing, and volatility filtering, DAMA OSC adapts to market conditions and highlights actionable signals in real-time.
Features:
How It Works:
Histogram Logic:
The histogram measures the percentage difference between the fast and slow MA:
Trend State Logic (Green / Blue / Red):
Rebound Logic:
A rebound is detected when price:
Inputs:
Display Options:
DAMA Settings:
Rebound Settings:
Available MA type:
Notes:
Alerts Included (Fully Configurable):
Credits:
Created by Eff_Hash. This code is shared with the TradingView community and full free. do not hesitate to share your best settings and usage.
The DAMA OSC (Directional Adaptive MA Oscillator) is a highly customizable and versatile oscillator that analyzes the delta between two moving averages of your choice. It detects trend progression, regressions, rebound signals, MA cross and critical zone crossovers to provide highly contextual trading information.
Designed for trend-following, reversal timing, and volatility filtering, DAMA OSC adapts to market conditions and highlights actionable signals in real-time.
Features:
- Support for 11 custom moving average types (EMA, DEMA, TEMA, ALMA, KAMA, etc.)
- Customizable fast & slow MA periods and types
- Histogram based on percentage delta between fast and slow MA
- Trend direction coloring with “Green”, “Blue”, and “Red” zones
- Rebound detection using close or shadow logic
- Configurable thresholds: Overbought, Oversold, Underbought, Undersold
- Optional filters: rebound validation by candle color or flat-zone filter
- Full visual overlay: MA lines, crossover markers, rebound icons
- Complete alert system with 16 preconfigured conditions
How It Works:
Histogram Logic:
The histogram measures the percentage difference between the fast and slow MA:
Pine Script®
hist_value = ((FastMA - SlowMA) / SlowMA) * 100
Trend State Logic (Green / Blue / Red):
- Green_Up = Bullish acceleration
- Blue_Up (or Red_Up, depending the display settings) = Bullish deceleration
- Blue_Down (or Green_Down, depending the display settings) = Bearish deceleration
- Red_Down = Bearish acceleration
Rebound Logic:
A rebound is detected when price:
- Crosses back over a selected MA (fast or slow)
- After being away for X candles (rebound_backstep)
- Optional: filtered by histogram zones or candle color
Inputs:
Display Options:
- Show/hide MA lines
- Show/hide MA crosses
- Show/hide price rebounds
- Enable/disable blue deceleration zones
DAMA Settings:
- Fast/Slow MA type and length
- Source input (close by default)
- Overbought/Oversold levels
- Underbought/Undersold levels
Rebound Settings:
- Use Close and/or Shadow
- Rebound MA (Fast/Slow)
- Candle color validation
- Flat zone filter rebounds (between UnderSold and UnderBought)
Available MA type:
- SMA (Simple MA)
- EMA (Exponential MA)
- DEMA (Double EMA)
- TEMA (Triple EMA)
- WMA (Weighted MA)
- HMA (Hull MA)
- VWMA (Volume Weighted MA)
- Kijun (Ichimoku Baseline)
- ALMA (Arnaud Legoux MA)
- KAMA (Kaufman Adaptive MA)
- HULLMOD (Modified Hull MA, Same as HMA, tweaked for Pine v6 constraints)
Notes:
- **DEMA/TEMA** reduce lag compared to EMA, useful for faster reaction in trending markets.
- **KAMA/ALMA** are better suited to noisy or volatile environments (e.g., BTC).
- **VWMA** reacts strongly to volume spikes.
- **HMA/HULLMOD** are great for visual clarity in fast moves.
Alerts Included (Fully Configurable):
- Golden Cross:
Fast MA crosses above Slow MA - Death Cross:
Fast MA crosses below Slow MA - Bullish Rebound:
Rebound from below MA in uptrend - Bearish Rebound:
Rebound from above MA in downtrend - Bull Progression:
Transition into Green_Up with positive delta - Bear Progression:
Transition into Red_Down with negative delta - Bull Regression:
Exit from Red_Down into Blue/Green with negative delta - Bear Regression:
Exit from Green_Up into Blue/Red with positive delta - Crossover Overbought:
Histogram crosses above Overbought - Crossunder Overbought:
Histogram crosses below Overbought - Crossover Oversold:
Histogram crosses above Oversold - Crossunder Oversold:
Histogram crosses below Oversold - Crossover Underbought:
Histogram crosses above Underbought - Crossunder Underbought:
Histogram crosses below Underbought - Crossover Undersold:
Histogram crosses above Undersold - Crossunder Undersold:
Histogram crosses below Undersold
Credits:
Created by Eff_Hash. This code is shared with the TradingView community and full free. do not hesitate to share your best settings and usage.
Release Notes
Chart updates, default value for display updated.Open-source script
In true TradingView spirit, the creator of this script has made it open-source, so that traders can review and verify its functionality. Kudos to the author! While you can use it for free, remember that republishing the code is subject to our House Rules.
For quick access on a chart, add this script to your favorites — learn more here.
Disclaimer
The information and publications are not meant to be, and do not constitute, financial, investment, trading, or other types of advice or recommendations supplied or endorsed by TradingView. Read more in the Terms of Use.
Open-source script
In true TradingView spirit, the creator of this script has made it open-source, so that traders can review and verify its functionality. Kudos to the author! While you can use it for free, remember that republishing the code is subject to our House Rules.
For quick access on a chart, add this script to your favorites — learn more here.
Disclaimer
The information and publications are not meant to be, and do not constitute, financial, investment, trading, or other types of advice or recommendations supplied or endorsed by TradingView. Read more in the Terms of Use.