OPEN-SOURCE SCRIPT
已更新 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:
Pine Script®
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:
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.
版本注释
Chart updates, default value for display updated.开源脚本
本着TradingView的真正精神,此脚本的创建者将其开源,以便交易者可以查看和验证其功能。向作者致敬!虽然您可以免费使用它,但请记住,重新发布代码必须遵守我们的网站规则。
免责声明
这些信息和出版物并不意味着也不构成TradingView提供或认可的金融、投资、交易或其它类型的建议或背书。请在使用条款阅读更多信息。
开源脚本
本着TradingView的真正精神,此脚本的创建者将其开源,以便交易者可以查看和验证其功能。向作者致敬!虽然您可以免费使用它,但请记住,重新发布代码必须遵守我们的网站规则。
免责声明
这些信息和出版物并不意味着也不构成TradingView提供或认可的金融、投资、交易或其它类型的建议或背书。请在使用条款阅读更多信息。