OPEN-SOURCE SCRIPT
Cập nhật

DAMA OSC - Directional Adaptive MA Oscillator

217
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:
  • 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.
Phát hành các Ghi chú
Chart updates, default value for display updated.

Thông báo miễn trừ trách nhiệm

Thông tin và ấn phẩm không có nghĩa là và không cấu thành, tài chính, đầu tư, kinh doanh, hoặc các loại lời khuyên hoặc khuyến nghị khác được cung cấp hoặc xác nhận bởi TradingView. Đọc thêm trong Điều khoản sử dụng.