OPEN-SOURCE SCRIPT
Adaptive MACD+ [MACD]

Adaptive MACD+ is a self-optimizing momentum indicator that dynamically selects the most effective MACD parameters
Instead of relying on fixed fast and slow EMA lengths, this indicator continuously evaluates a range of combinations and automatically selects the pair that has been performing best on recent price action — delivering a MACD that adapts to changing market conditions and momentum cycles.
🔶 HOW IT WORKS
Traditional MACD uses fixed parameters, which may lag in fast markets or produce noise during consolidation. Adaptive MACD+ solves this by testing multiple fast and slow EMA combinations in parallel.
The process:
A range of fast EMAs (short-term) and slow EMAs (long-term) are calculated
Each combination generates its own MACD line
A performance scoring system evaluates how well each responds to momentum shifts
On every bar:
The best-performing fast and slow pair is selected
The MACD line is calculated using this optimal combination
A signal line (EMA of MACD) and histogram are derived as usual
This results in a MACD that continuously adapts its sensitivity to match current market momentum.
🔶 USAGE
🔹 MACD Structure
MACD Line (Blue/Red) — Represents momentum direction based on the adaptive EMA pair
Signal Line (Orange) — Smoothed version of the MACD line used for crossover signals
Histogram — Difference between MACD and signal line, showing momentum strength
Green histogram — Bullish momentum
Red histogram — Bearish momentum
🔹 Trade Signals
Green triangle (▲) — Bullish crossover. MACD crosses above the signal line, indicating potential upward momentum
Red triangle (▼) — Bearish crossover. MACD crosses below the signal line, indicating potential downward momentum
Because the EMA lengths are dynamically selected, these signals reflect momentum conditions that are optimized for recent price behavior — not fixed parameters.
🔶 SETTINGS
🔹 Calculation Settings
Source — Price used for calculations (default: close)
Min Fast Length — Lower bound for fast EMA range (more responsive)
Max Fast Length — Upper bound for fast EMA range (smoother)
Min Slow Length — Lower bound for slow EMA range
Max Slow Length — Upper bound for slow EMA range
Signal Length — EMA length applied to the MACD line to create the signal line
🔹 Visual Settings
Show Histogram — Toggle histogram display
Show Signal — Toggle signal line display
🔶 NOTES
Suitable for all markets and timeframes.
Works best as a momentum confirmation and trend-strength tool.
Adaptive EMA selection helps reduce lag during strong trends and noise during consolidation.
Can be combined with trend indicators for higher-probability setups.
Past performance of any selected EMA combination does not guarantee future results — always apply proper risk management.
Instead of relying on fixed fast and slow EMA lengths, this indicator continuously evaluates a range of combinations and automatically selects the pair that has been performing best on recent price action — delivering a MACD that adapts to changing market conditions and momentum cycles.
🔶 HOW IT WORKS
Traditional MACD uses fixed parameters, which may lag in fast markets or produce noise during consolidation. Adaptive MACD+ solves this by testing multiple fast and slow EMA combinations in parallel.
The process:
A range of fast EMAs (short-term) and slow EMAs (long-term) are calculated
Each combination generates its own MACD line
A performance scoring system evaluates how well each responds to momentum shifts
On every bar:
The best-performing fast and slow pair is selected
The MACD line is calculated using this optimal combination
A signal line (EMA of MACD) and histogram are derived as usual
This results in a MACD that continuously adapts its sensitivity to match current market momentum.
🔶 USAGE
🔹 MACD Structure
MACD Line (Blue/Red) — Represents momentum direction based on the adaptive EMA pair
Signal Line (Orange) — Smoothed version of the MACD line used for crossover signals
Histogram — Difference between MACD and signal line, showing momentum strength
Green histogram — Bullish momentum
Red histogram — Bearish momentum
🔹 Trade Signals
Green triangle (▲) — Bullish crossover. MACD crosses above the signal line, indicating potential upward momentum
Red triangle (▼) — Bearish crossover. MACD crosses below the signal line, indicating potential downward momentum
Because the EMA lengths are dynamically selected, these signals reflect momentum conditions that are optimized for recent price behavior — not fixed parameters.
🔶 SETTINGS
🔹 Calculation Settings
Source — Price used for calculations (default: close)
Min Fast Length — Lower bound for fast EMA range (more responsive)
Max Fast Length — Upper bound for fast EMA range (smoother)
Min Slow Length — Lower bound for slow EMA range
Max Slow Length — Upper bound for slow EMA range
Signal Length — EMA length applied to the MACD line to create the signal line
🔹 Visual Settings
Show Histogram — Toggle histogram display
Show Signal — Toggle signal line display
🔶 NOTES
Suitable for all markets and timeframes.
Works best as a momentum confirmation and trend-strength tool.
Adaptive EMA selection helps reduce lag during strong trends and noise during consolidation.
Can be combined with trend indicators for higher-probability setups.
Past performance of any selected EMA combination does not guarantee future results — always apply proper risk management.
开源脚本
秉承TradingView的精神,该脚本的作者将其开源,以便交易者可以查看和验证其功能。向作者致敬!您可以免费使用该脚本,但请记住,重新发布代码须遵守我们的网站规则。
Pine Script Developer • Market Analysis
免责声明
这些信息和出版物并非旨在提供,也不构成TradingView提供或认可的任何形式的财务、投资、交易或其他类型的建议或推荐。请阅读使用条款了解更多信息。
开源脚本
秉承TradingView的精神,该脚本的作者将其开源,以便交易者可以查看和验证其功能。向作者致敬!您可以免费使用该脚本,但请记住,重新发布代码须遵守我们的网站规则。
Pine Script Developer • Market Analysis
免责声明
这些信息和出版物并非旨在提供,也不构成TradingView提供或认可的任何形式的财务、投资、交易或其他类型的建议或推荐。请阅读使用条款了解更多信息。