OPEN-SOURCE SCRIPT
تم تحديثه

Double Momentum - DMOM | TR

586
🎯 Overview
Double Momentum - DMOM | TR is an advanced momentum oscillator developed by Tiagorocha1989 that builds upon the classic momentum concept by applying the momentum calculation twice. This “momentum of momentum” approach amplifies trend signals, reduces lag, and helps traders identify acceleration and deceleration phases with greater clarity. The indicator offers dual‑mode operation (zero‑line or moving‑average crossovers), an extensive selection of moving average types, and rich visual customization to suit any trading style.

🔧 How It Works
Double Momentum enhances the standard momentum formula by taking the momentum of the momentum itself. This double calculation emphasises changes in the rate of price change, making it particularly effective for spotting trend strength and potential reversals early.

Core Calculation Logic:

First Momentum (MOM):
MOM = Current Price - Price n-periods ago
where n is the user-defined Length DMOM.

Double Momentum (DMOM):
DMOM = 2 × MOM - MOM of MOM
(i.e., DMOM = 2 × MOM - ta.mom(MOM, Length_DMOM))
This formula is reminiscent of a double exponential smoothing step—it reacts faster to changes in momentum while smoothing out noise.

Reference Line (Entry_DMOM):
The indicator compares DMOM to a reference line that can be either:

Zero Line (classic mode) – signals occur when DMOM crosses above or below zero.

DMOM MA (enhanced mode) – the reference line becomes a moving average of DMOM itself, providing smoother, filtered signals.

The moving average type and length are fully customizable, with support for 12 different MA variants (see Key Features).

The resulting oscillator oscillates around the chosen reference line:

DMOM above reference → upward acceleration (bullish momentum)

DMOM below reference → downward acceleration (bearish momentum)

Magnitude indicates the strength of the acceleration.

✨ Key Features
🔹 Dual Operating Modes

Zero Line Mode: Classic signals when DMOM crosses above or below zero – simple and intuitive.

DMOM MA Mode: Smoother signals when DMOM crosses its own moving average – reduces whipsaws in choppy markets.

🔹 Extensive Moving Average Selection
Choose from 12 MA types for the DMOM MA line, each with its own characteristics:
EMA, SMA, RMA, WMA, VWMA, HMA, DEMA, TEMA, TRIMA, FRAMA, SWMA, T3.
The T3 MA includes an adjustable T3 Factor for fine‑tuning smoothness.

🔹 Customizable Momentum Parameters

Length DMOM: Lookback period for both momentum calculations (default 36).

Source DMOM: Price source for the initial momentum (default Close).

🔹 Extended Range Visualization
Gradient fills are drawn between DMOM and the reference line, with fixed bounds at +30000 and -30000. These zones help visualise extreme readings, regardless of the instrument’s typical price level.

🔹 Customizable Color Themes
Eight distinct color schemes to match your chart aesthetics:

Classic, Modern, Robust, Accented, Monochrome, Moderate, Aqua, Cosmic
Each theme defines separate colors for bullish and bearish states.

🔹 Comprehensive Visual Feedback

Colored DMOM Line: Changes colour based on its position relative to the reference line.

Signal Line: Yellow line representing the zero or MA reference.

Gradient Fill Zones: Semi‑transparent fills showing extreme momentum areas.

Dynamic Zone Fills: Additional fill between DMOM and the reference line, coloured by the prevailing bias.

Color‑Coded Candles: Bars reflect the current DMOM bias (above or below reference).

Signal Markers: Triangle up/down symbols at crossover points.

Live Value Display: Current DMOM value shown in a floating label near the last bar.

Trend Table: Bullish/Bearish status displayed in a table on the chart.

🔹 Ready‑to‑Use Alerts
Built‑in alert conditions trigger LONG on bullish crossovers and SHORT on bearish crossunders, for both operating modes.

⚙️ Settings Summary
Setting Description Default
Color Choice Select from eight visual themes Classic
Length DMOM Lookback period for momentum calculations 36
Source DMOM Price source for momentum Close
Entry/Exit Signal Choose between zero‑line or DMOM MA mode 0
Length MA Moving average period for DMOM MA mode 365
Moving Average Type of moving average for the signal line (12 options) EMA
T3 Factor Factor for T3 moving average (0–1) 0.7
📈 Practical Applications
🔹 Trend Acceleration Detection
The slope and position of DMOM relative to the reference line quickly reveal whether price momentum is accelerating or decelerating. Steeply rising DMOM indicates strong bullish acceleration; steeply falling DMOM signals bearish acceleration.

🔹 Zero‑Line Crossovers
In Zero Line mode, crossovers provide clear signals:

Crossover above zero → bullish acceleration, potential trend reversal up.

Crossunder below zero → bearish acceleration, potential trend reversal down.

🔹 Signal‑Line Crossovers
In DMOM MA mode, crossovers between DMOM and its moving average generate filtered signals that work well in trending markets:

DMOM crosses above its MA → bullish signal.

DMOM crosses below its MA → bearish signal.

🔹 Divergence Trading
Double Momentum is excellent for spotting divergences:

Bullish Divergence: Price makes a lower low while DMOM forms a higher low → possible upside reversal.

Bearish Divergence: Price makes a higher high while DMOM forms a lower high → possible downside reversal.
Divergences are most reliable after extended trends or at extreme levels.

🔹 Momentum Confirmation
The magnitude of DMOM confirms trend strength:

Large positive values → strong bullish acceleration.

Large negative values → strong bearish acceleration.

Values nearing the reference line → momentum slowing, potential trend change.

🔹 Centerline Rejections
When DMOM approaches the reference line (zero or MA) but reverses before crossing, it can signal trend continuation – a common pattern in strong trends.

🔹 Multiple Timeframe Analysis
Compare DMOM readings across timeframes: higher‑timeframe DMOM defines the primary trend, while lower‑timeframe DMOM helps pinpoint entry and exit timing.

🎯 Ideal For
✅ Trend Traders seeking confirmation of trend strength and direction.
✅ Momentum Traders wanting an early view of acceleration and deceleration.
✅ Divergence Traders looking for leading reversal signals.
✅ Swing Traders capturing medium‑term momentum shifts.
✅ System Developers needing a robust, customisable crossover‑based strategy.
✅ Beginner Traders who appreciate clear visual signals and multiple learning modes.

📌 Key Takeaways
Double Momentum Logic: Applying momentum twice amplifies trend signals and reduces lag compared to standard momentum.

Dual‑Mode Flexibility: Choose zero‑line simplicity for clear entries or MA‑smoothed signals for filtered trades.

Unbounded Nature: Like standard momentum, DMOM has no upper/lower limits, making it suitable for strongly trending instruments.

Extensive MA Options: 12 moving average types give you complete control over the smoothness and responsiveness of the signal line.

Rich Visuals: Colour themes, gradient fills for extreme zones, candle colouring, and live value labels provide immediate market context.

Divergence Capability: The double calculation often reveals divergences earlier than simple momentum.

Alert‑Ready: Pre‑built alerts for both LONG and SHORT signals across both operating modes.

⚠️ Important Notes
Because DMOM is unbounded, its scale can vary significantly between instruments and timeframes. The gradient fills at ±30000 are arbitrary reference points and may not represent actual overbought/oversold conditions for all instruments.

The default Length DMOM of 36 offers a medium‑term perspective. Shorter lengths (9–14) produce more responsive signals, while longer lengths (e.g., 50–100) are better for identifying major trends.

The default Length MA of 365 in DMOM MA mode is designed for a long‑term context on daily charts; adjust it to match your trading horizon.

Divergences are most reliable when they occur after extended trends and are confirmed by other tools.

Always combine Double Momentum with proper risk management and additional confirmation before live deployment.

Disclaimer: This indicator is provided for educational and informational purposes only. Past performance does not guarantee future results. Always test thoroughly and align with your personal risk management strategy.
ملاحظات الأخبار
Resolution Previous Problem
ملاحظات الأخبار
Color Mode – Added 'Heat' option ([#ff0000, #87cefb]).

Dynamic Fill Transparency – Calculates Momentum and Norm_Momentum to set a variable transparency (Fill_Transp) for the overbought/oversold fills, replacing the fixed 0/100 values.

Gradient Candle Colors – Computes a normalized and uses color.from_gradient() to color candles with a smooth transition between down and up colors.

Persistent Trend State – Introduces Trend_ (1 for bull, -1 for bear) that holds the trend direction, used in:

The third fill() (now based on Trend_ instead of a direct.

bgcolor() (now uses Trend_ instead of isBull_/isBear_).

The table and label (display and color based on Trend_).

Label Color – Simplified to use Trend_ colors without transparency.

إخلاء المسؤولية

لا يُقصد بالمعلومات والمنشورات أن تكون، أو تشكل، أي نصيحة مالية أو استثمارية أو تجارية أو أنواع أخرى من النصائح أو التوصيات المقدمة أو المعتمدة من TradingView. اقرأ المزيد في شروط الاستخدام.