OPEN-SOURCE SCRIPT
MACD Momentum Matrix [MTF]

# MACD Multi-Timeframe Confirmation — v1
A MACD confirmation tool that only signals when your chart timeframe and a
higher timeframe agree — built to demonstrate reliable, non-repainting
multi-timeframe logic.
## What it does
- Standard MACD (configurable fast/slow/signal lengths) on your chart's
timeframe
- Reads MACD trend state from a higher timeframe you choose
- Fires a confirmed signal only when both timeframes align (optional —
can be turned off to use chart-timeframe crosses alone)
- Clean triangle markers on the price chart at confirmed signals
- Live status table showing chart-timeframe state, higher-timeframe state,
and whether they're currently aligned
- Separate bullish/bearish alerts
## What it deliberately leaves out (v1 scope)
- Multiple stacked higher timeframes
- Alternate MACD variants (zero-line cross, histogram slope, etc.)
- Backtesting or strategy logic
Those become a separate "MACD Pro" build so this stays a fast, dependable
confluence tool.
## Design principles
- **Non-repainting multi-timeframe data.** Higher-timeframe MACD is pulled
with lookahead = barmerge.lookahead_off, the standard safe pattern for
MTF requests in Pine Script — no future data leaks into historical bars.
- **Confirmed on close.** Signals are based on a completed MACD line/signal
line cross, not intrabar movement.
- **Readable code.** Organized into clearly commented sections so a client
can follow exactly what triggers a signal.
## Ideal use cases
- Traders who use MACD for trend confirmation and want to filter out
lower-timeframe noise automatically
- A building block for custom strategies that need a reliable "is the
bigger picture agreeing with this move" filter
- Anyone who's been burned by repainting MTF indicators and wants one that
behaves the same live as in backtest
---
*Built by Pedro Silva — Pine Script v6 development for custom indicators,
alert systems, and backtesting tools. Open for custom work: [contact link].* fix it
MACD Momentum Matrix [MTF]
MACD Momentum Matrix is a multi-timeframe momentum confirmation tool designed to filter lower-timeframe MACD signals through broader market context.
Instead of treating every MACD crossover as an actionable event, the indicator evaluates three layers:
Chart-timeframe MACD for signal timing
Completed 5-minute MACD data for immediate momentum
Completed 15-minute MACD data for directional bias
A signal appears only when the enabled momentum, trend, candle, session, and signal-management conditions agree.
How it works
Chart-timeframe trigger
The chart-timeframe MACD crossover provides the initial bullish or bearish trigger. Signals are evaluated only after the chart candle closes.
Five-minute momentum
The completed 5-minute MACD histogram determines whether immediate momentum supports the potential signal.
Three confirmation modes are available:
Directional
Directional and Strengthening
Directional or Strengthening
Fifteen-minute bias
The completed 15-minute MACD histogram provides the broader directional context. Users may optionally require that this higher-timeframe momentum is also strengthening.
Price confirmation
Optional trend filters can require price to be positioned correctly relative to:
Session VWAP
A configurable EMA
Both VWAP and EMA
Neither filter
An additional candle-direction filter can require bullish signals to close above their open and bearish signals to close below their open.
Signal management
The indicator includes controls designed to reduce clustered or repetitive signals:
Configurable cooldown between signals
One signal per momentum leg
Optional session restriction
Confirmed-close evaluation
Independent bullish and bearish alerts
These features do not predict reversals or guarantee profitable entries. They organize MACD confirmation into a more selective multi-timeframe framework.
Non-repainting higher-timeframe logic
The 5-minute and 15-minute calculations use values from completed higher-timeframe candles.
The script requests historically confirmed values using an offset expression with barmerge.lookahead_on. This prevents an unfinished higher-timeframe candle from changing the imported momentum state while the current chart candle is developing.
Signal markers are also gated by confirmed chart-bar closes.
This means historical signals are evaluated using the same completed-candle information available during live operation.
Momentum Matrix dashboard
The compact dashboard summarizes:
Chart-timeframe trigger state
Five-minute momentum state
Fifteen-minute directional bias
Current bullish or bearish context
Filter readiness
Most recent confirmed signal
The dashboard is intended to show why a setup is active, blocked, or still waiting without covering the chart with unnecessary information.
Customization
Users can configure:
MACD fast, slow, and signal lengths
Momentum and bias timeframes
Five-minute confirmation method
Fifteen-minute bias requirements
VWAP and EMA filtering
EMA length
Candle-direction confirmation
Signal cooldown
One-signal-per-leg behavior
Signal session and timezone
Marker visibility and colors
Dashboard visibility and position
Alerts
Separate alert conditions are included for:
Bullish multi-timeframe MACD confirmation
Bearish multi-timeframe MACD confirmation
Create TradingView alerts from either condition after applying the indicator to a chart.
Recommended starting configuration
The default structure is intended primarily for short-term intraday charts:
Chart timeframe: 1 minute
Momentum timeframe: 5 minutes
Bias timeframe: 15 minutes
Trend filter: VWAP
Confirmed candle direction: Enabled
One signal per momentum leg: Enabled
Signal cooldown: 10 chart bars
These are starting values, not universal trading rules. Settings should be adjusted for the instrument, session, and trading style being evaluated.
Intended use
MACD Momentum Matrix can be used as:
An intraday momentum-confirmation tool
A filter for lower-timeframe MACD noise
A visual multi-timeframe market-state dashboard
An alert framework for discretionary traders
A foundation for custom strategy development and testing
Scope
This version does not include:
Automated order execution
Stop-loss or profit-target calculations
Position sizing
Backtesting statistics
Support and resistance detection
Reversal prediction
It is a confirmation indicator, not a complete trading system. Signals should be evaluated alongside market structure, meaningful price levels, risk management, and the user’s own tested trading plan.
Built by Pedro Silva in Pine Script v6. Available for custom indicators, alert systems, backtesting tools, and Pine Script development.
A MACD confirmation tool that only signals when your chart timeframe and a
higher timeframe agree — built to demonstrate reliable, non-repainting
multi-timeframe logic.
## What it does
- Standard MACD (configurable fast/slow/signal lengths) on your chart's
timeframe
- Reads MACD trend state from a higher timeframe you choose
- Fires a confirmed signal only when both timeframes align (optional —
can be turned off to use chart-timeframe crosses alone)
- Clean triangle markers on the price chart at confirmed signals
- Live status table showing chart-timeframe state, higher-timeframe state,
and whether they're currently aligned
- Separate bullish/bearish alerts
## What it deliberately leaves out (v1 scope)
- Multiple stacked higher timeframes
- Alternate MACD variants (zero-line cross, histogram slope, etc.)
- Backtesting or strategy logic
Those become a separate "MACD Pro" build so this stays a fast, dependable
confluence tool.
## Design principles
- **Non-repainting multi-timeframe data.** Higher-timeframe MACD is pulled
with lookahead = barmerge.lookahead_off, the standard safe pattern for
MTF requests in Pine Script — no future data leaks into historical bars.
- **Confirmed on close.** Signals are based on a completed MACD line/signal
line cross, not intrabar movement.
- **Readable code.** Organized into clearly commented sections so a client
can follow exactly what triggers a signal.
## Ideal use cases
- Traders who use MACD for trend confirmation and want to filter out
lower-timeframe noise automatically
- A building block for custom strategies that need a reliable "is the
bigger picture agreeing with this move" filter
- Anyone who's been burned by repainting MTF indicators and wants one that
behaves the same live as in backtest
---
*Built by Pedro Silva — Pine Script v6 development for custom indicators,
alert systems, and backtesting tools. Open for custom work: [contact link].* fix it
MACD Momentum Matrix [MTF]
MACD Momentum Matrix is a multi-timeframe momentum confirmation tool designed to filter lower-timeframe MACD signals through broader market context.
Instead of treating every MACD crossover as an actionable event, the indicator evaluates three layers:
Chart-timeframe MACD for signal timing
Completed 5-minute MACD data for immediate momentum
Completed 15-minute MACD data for directional bias
A signal appears only when the enabled momentum, trend, candle, session, and signal-management conditions agree.
How it works
Chart-timeframe trigger
The chart-timeframe MACD crossover provides the initial bullish or bearish trigger. Signals are evaluated only after the chart candle closes.
Five-minute momentum
The completed 5-minute MACD histogram determines whether immediate momentum supports the potential signal.
Three confirmation modes are available:
Directional
Directional and Strengthening
Directional or Strengthening
Fifteen-minute bias
The completed 15-minute MACD histogram provides the broader directional context. Users may optionally require that this higher-timeframe momentum is also strengthening.
Price confirmation
Optional trend filters can require price to be positioned correctly relative to:
Session VWAP
A configurable EMA
Both VWAP and EMA
Neither filter
An additional candle-direction filter can require bullish signals to close above their open and bearish signals to close below their open.
Signal management
The indicator includes controls designed to reduce clustered or repetitive signals:
Configurable cooldown between signals
One signal per momentum leg
Optional session restriction
Confirmed-close evaluation
Independent bullish and bearish alerts
These features do not predict reversals or guarantee profitable entries. They organize MACD confirmation into a more selective multi-timeframe framework.
Non-repainting higher-timeframe logic
The 5-minute and 15-minute calculations use values from completed higher-timeframe candles.
The script requests historically confirmed values using an offset expression with barmerge.lookahead_on. This prevents an unfinished higher-timeframe candle from changing the imported momentum state while the current chart candle is developing.
Signal markers are also gated by confirmed chart-bar closes.
This means historical signals are evaluated using the same completed-candle information available during live operation.
Momentum Matrix dashboard
The compact dashboard summarizes:
Chart-timeframe trigger state
Five-minute momentum state
Fifteen-minute directional bias
Current bullish or bearish context
Filter readiness
Most recent confirmed signal
The dashboard is intended to show why a setup is active, blocked, or still waiting without covering the chart with unnecessary information.
Customization
Users can configure:
MACD fast, slow, and signal lengths
Momentum and bias timeframes
Five-minute confirmation method
Fifteen-minute bias requirements
VWAP and EMA filtering
EMA length
Candle-direction confirmation
Signal cooldown
One-signal-per-leg behavior
Signal session and timezone
Marker visibility and colors
Dashboard visibility and position
Alerts
Separate alert conditions are included for:
Bullish multi-timeframe MACD confirmation
Bearish multi-timeframe MACD confirmation
Create TradingView alerts from either condition after applying the indicator to a chart.
Recommended starting configuration
The default structure is intended primarily for short-term intraday charts:
Chart timeframe: 1 minute
Momentum timeframe: 5 minutes
Bias timeframe: 15 minutes
Trend filter: VWAP
Confirmed candle direction: Enabled
One signal per momentum leg: Enabled
Signal cooldown: 10 chart bars
These are starting values, not universal trading rules. Settings should be adjusted for the instrument, session, and trading style being evaluated.
Intended use
MACD Momentum Matrix can be used as:
An intraday momentum-confirmation tool
A filter for lower-timeframe MACD noise
A visual multi-timeframe market-state dashboard
An alert framework for discretionary traders
A foundation for custom strategy development and testing
Scope
This version does not include:
Automated order execution
Stop-loss or profit-target calculations
Position sizing
Backtesting statistics
Support and resistance detection
Reversal prediction
It is a confirmation indicator, not a complete trading system. Signals should be evaluated alongside market structure, meaningful price levels, risk management, and the user’s own tested trading plan.
Built by Pedro Silva in Pine Script v6. Available for custom indicators, alert systems, backtesting tools, and Pine Script development.
Script open-source
Nello spirito di TradingView, l'autore di questo script lo ha reso open source, in modo che i trader possano esaminarne e verificarne la funzionalità. Complimenti all'autore! Sebbene sia possibile utilizzarlo gratuitamente, ricordiamo che la ripubblicazione del codice è soggetta al nostro Regolamento.
Declinazione di responsabilità
Le informazioni e le pubblicazioni non sono intese come, e non costituiscono, consulenza o raccomandazioni finanziarie, di investimento, di trading o di altro tipo fornite o approvate da TradingView. Per ulteriori informazioni, consultare i Termini di utilizzo.
Script open-source
Nello spirito di TradingView, l'autore di questo script lo ha reso open source, in modo che i trader possano esaminarne e verificarne la funzionalità. Complimenti all'autore! Sebbene sia possibile utilizzarlo gratuitamente, ricordiamo che la ripubblicazione del codice è soggetta al nostro Regolamento.
Declinazione di responsabilità
Le informazioni e le pubblicazioni non sono intese come, e non costituiscono, consulenza o raccomandazioni finanziarie, di investimento, di trading o di altro tipo fornite o approvate da TradingView. Per ulteriori informazioni, consultare i Termini di utilizzo.