OPEN-SOURCE SCRIPT
Cập nhật Momentum Adaptive EMA | RakoQuant

Momentum Adaptive EMA is a trend-following moving average system designed to dynamically adjust its responsiveness based on market momentum.
Instead of using a fixed smoothing speed like a normal EMA, this indicator becomes fast in strong moves and slow in choppy conditions, producing a cleaner adaptive trend structure.
This version also introduces a secondary POT Moving Average for smooth regime confirmation.
Core Idea
This indicator answers one key question:
Is momentum accelerating enough to justify a faster trend response?
By adapting the EMA’s smoothing factor in real time, the indicator avoids the two classic problems of moving averages:
Lag in strong trends
Whipsaws in sideways markets
How It Works
1. Momentum-Based Adaptivity Engine
The indicator measures momentum using a Rate-of-Change style move:
ROC = current price − price N bars ago
That momentum is normalized by volatility:
Momentum Strength = |ROC| ÷ stdev(ROC)
This produces a clean, scale-independent momentum score.
2. Adaptive EMA (Dynamic Alpha)
Instead of a constant EMA alpha, smoothing is adjusted between:
Alpha Min → slow mode (stable markets)
Alpha Max → fast mode (strong trend markets)
Adaptivity is controlled by:
k (Strength Parameter)
High momentum → EMA reacts faster
Low momentum → EMA smooths more
3. POT Moving Average (Weighted Trend Anchor)
A second moving average is calculated using a Power-Weighted POT MA, where the most recent values receive heavier weight:
Stronger emphasis on recent trend shifts
Smooth confirmation without volatility bands
This creates a clean dual-average regime filter:
Adaptive EMA = fast regime line
POT MA = slower structure anchor
Regime Signals
Trend regime is defined by crossovers:
Bullish regime: Adaptive EMA crosses above POT MA
Bearish regime: Adaptive EMA crosses below POT MA
Optional persistence keeps regimes stable instead of flipping constantly.
Visual System
Bull regime → Ice Blue trend state
Bear regime → Navy trend state
Candle painting optionally matches the active regime
The result is a clean institutional trend overlay with adaptive behavior.
Alerts Included
Bull Break Alert → Adaptive EMA crosses ABOVE POT MA
Bear Break Alert → Adaptive EMA crosses BELOW POT MA
Useful for automation or confirmation systems.
How to Use
✅ Trend filter for directional trading
✅ Adaptive MA replacement for classic EMA systems
✅ Works well on higher timeframes (4H / 1D)
✅ Combine with breakouts, momentum triggers, or volume tools for entries
Inputs Summary
Momentum Length → speed of momentum detection
Normalization Length → volatility scaling window
Alpha Min / Alpha Max → slow vs fast response bounds
Adaptivity Strength (k) → aggressiveness of adaptation
POT Length + Power → smoothing of the confirmation MA
Persistent Regime Toggle → stability vs live switching
Candle Paint Toggle → visual regime clarity
Screenshot Placement
📸 Example chart / screenshot: (insert image here)
Tip: show a strong bull trend + one bearish flip so users understand the adaptive behavior.
Instead of using a fixed smoothing speed like a normal EMA, this indicator becomes fast in strong moves and slow in choppy conditions, producing a cleaner adaptive trend structure.
This version also introduces a secondary POT Moving Average for smooth regime confirmation.
Core Idea
This indicator answers one key question:
Is momentum accelerating enough to justify a faster trend response?
By adapting the EMA’s smoothing factor in real time, the indicator avoids the two classic problems of moving averages:
Lag in strong trends
Whipsaws in sideways markets
How It Works
1. Momentum-Based Adaptivity Engine
The indicator measures momentum using a Rate-of-Change style move:
ROC = current price − price N bars ago
That momentum is normalized by volatility:
Momentum Strength = |ROC| ÷ stdev(ROC)
This produces a clean, scale-independent momentum score.
2. Adaptive EMA (Dynamic Alpha)
Instead of a constant EMA alpha, smoothing is adjusted between:
Alpha Min → slow mode (stable markets)
Alpha Max → fast mode (strong trend markets)
Adaptivity is controlled by:
k (Strength Parameter)
High momentum → EMA reacts faster
Low momentum → EMA smooths more
3. POT Moving Average (Weighted Trend Anchor)
A second moving average is calculated using a Power-Weighted POT MA, where the most recent values receive heavier weight:
Stronger emphasis on recent trend shifts
Smooth confirmation without volatility bands
This creates a clean dual-average regime filter:
Adaptive EMA = fast regime line
POT MA = slower structure anchor
Regime Signals
Trend regime is defined by crossovers:
Bullish regime: Adaptive EMA crosses above POT MA
Bearish regime: Adaptive EMA crosses below POT MA
Optional persistence keeps regimes stable instead of flipping constantly.
Visual System
Bull regime → Ice Blue trend state
Bear regime → Navy trend state
Candle painting optionally matches the active regime
The result is a clean institutional trend overlay with adaptive behavior.
Alerts Included
Bull Break Alert → Adaptive EMA crosses ABOVE POT MA
Bear Break Alert → Adaptive EMA crosses BELOW POT MA
Useful for automation or confirmation systems.
How to Use
✅ Trend filter for directional trading
✅ Adaptive MA replacement for classic EMA systems
✅ Works well on higher timeframes (4H / 1D)
✅ Combine with breakouts, momentum triggers, or volume tools for entries
Inputs Summary
Momentum Length → speed of momentum detection
Normalization Length → volatility scaling window
Alpha Min / Alpha Max → slow vs fast response bounds
Adaptivity Strength (k) → aggressiveness of adaptation
POT Length + Power → smoothing of the confirmation MA
Persistent Regime Toggle → stability vs live switching
Candle Paint Toggle → visual regime clarity
Screenshot Placement
📸 Example chart / screenshot: (insert image here)
Tip: show a strong bull trend + one bearish flip so users understand the adaptive behavior.
Phát hành các Ghi chú
V2Mã nguồn mở
Theo đúng tinh thần TradingView, tác giả của tập lệnh này đã công bố nó dưới dạng mã nguồn mở, để các nhà giao dịch có thể xem xét và xác minh chức năng. Chúc mừng tác giả! Mặc dù bạn có thể sử dụng miễn phí, hãy nhớ rằng việc công bố lại mã phải tuân theo Nội quy.
Thông báo miễn trừ trách nhiệm
Thông tin và các ấn phẩm này không nhằm mục đích, và không cấu thành, lời khuyên hoặc khuyến nghị về tài chính, đầu tư, giao dịch hay các loại khác do TradingView cung cấp hoặc xác nhận. Đọc thêm tại Điều khoản Sử dụng.
Mã nguồn mở
Theo đúng tinh thần TradingView, tác giả của tập lệnh này đã công bố nó dưới dạng mã nguồn mở, để các nhà giao dịch có thể xem xét và xác minh chức năng. Chúc mừng tác giả! Mặc dù bạn có thể sử dụng miễn phí, hãy nhớ rằng việc công bố lại mã phải tuân theo Nội quy.
Thông báo miễn trừ trách nhiệm
Thông tin và các ấn phẩm này không nhằm mục đích, và không cấu thành, lời khuyên hoặc khuyến nghị về tài chính, đầu tư, giao dịch hay các loại khác do TradingView cung cấp hoặc xác nhận. Đọc thêm tại Điều khoản Sử dụng.