OPEN-SOURCE SCRIPT
Moving Average Convergence Divergence TIME

Overview
This is a customized MACD (Moving Average Convergence Divergence) indicator for TradingView, labeled "MACDH" on the chart, with a few enhancements beyond the stock MACD.
Core Components
MACD Calculation
Uses a fast moving average (default 12) and slow moving average (default 26), both configurable as EMA or SMA
MACD line = Fast MA − Slow MA
Signal line = moving average of the MACD line (default 9-period, EMA or SMA)
Histogram = MACD line − Signal line
Multi-Timeframe Support
You can calculate the MACD on a different timeframe than the chart itself (e.g., view 5-minute chart but calculate MACD on 1-hour data) via request.security
A "Wait for timeframe closes" toggle lets you choose between using the confirmed (closed) value of the higher timeframe or the live, repainting value
Color-Coded Histogram
Dark teal: histogram is positive and rising
Light teal: histogram is positive but falling
Light red: histogram is negative but rising
Dark red: histogram is negative and falling
This gives a quick visual read on momentum direction, not just above/below zero
Plots
Histogram as columns
MACD line
Signal line (orange)
Zero line for reference
Alerts
Fires when the histogram crosses from positive to negative ("rising to falling")
Fires when the histogram crosses from negative to positive ("falling to rising")
Timeframe Watermark
Displays a small label on the chart (e.g., "1H", "4H", "1D") showing which timeframe the MACD is actually being calculated on — useful since it can differ from the chart's own timeframe
Position (corner) and font size are both configurable
In short: it's a standard MACD with configurable multi-timeframe calculation, momentum-based histogram coloring, crossover alerts, and an on-chart label confirming which timeframe is driving the calculation.
This is a customized MACD (Moving Average Convergence Divergence) indicator for TradingView, labeled "MACDH" on the chart, with a few enhancements beyond the stock MACD.
Core Components
MACD Calculation
Uses a fast moving average (default 12) and slow moving average (default 26), both configurable as EMA or SMA
MACD line = Fast MA − Slow MA
Signal line = moving average of the MACD line (default 9-period, EMA or SMA)
Histogram = MACD line − Signal line
Multi-Timeframe Support
You can calculate the MACD on a different timeframe than the chart itself (e.g., view 5-minute chart but calculate MACD on 1-hour data) via request.security
A "Wait for timeframe closes" toggle lets you choose between using the confirmed (closed) value of the higher timeframe or the live, repainting value
Color-Coded Histogram
Dark teal: histogram is positive and rising
Light teal: histogram is positive but falling
Light red: histogram is negative but rising
Dark red: histogram is negative and falling
This gives a quick visual read on momentum direction, not just above/below zero
Plots
Histogram as columns
MACD line
Signal line (orange)
Zero line for reference
Alerts
Fires when the histogram crosses from positive to negative ("rising to falling")
Fires when the histogram crosses from negative to positive ("falling to rising")
Timeframe Watermark
Displays a small label on the chart (e.g., "1H", "4H", "1D") showing which timeframe the MACD is actually being calculated on — useful since it can differ from the chart's own timeframe
Position (corner) and font size are both configurable
In short: it's a standard MACD with configurable multi-timeframe calculation, momentum-based histogram coloring, crossover alerts, and an on-chart label confirming which timeframe is driving the calculation.
Open-source Skript
Ganz im Sinne von TradingView hat dieser Autor sein/ihr Script als Open-Source veröffentlicht. Auf diese Weise können nun auch andere Trader das Script rezensieren und die Funktionalität überprüfen. Vielen Dank an den Autor! Sie können das Script kostenlos verwenden, aber eine Wiederveröffentlichung des Codes unterliegt unseren Hausregeln.
Haftungsausschluss
Die Informationen und Veröffentlichungen sind nicht als Finanz-, Anlage-, Handels- oder andere Arten von Ratschlägen oder Empfehlungen gedacht, die von TradingView bereitgestellt oder gebilligt werden, und stellen diese nicht dar. Lesen Sie mehr in den Nutzungsbedingungen.
Open-source Skript
Ganz im Sinne von TradingView hat dieser Autor sein/ihr Script als Open-Source veröffentlicht. Auf diese Weise können nun auch andere Trader das Script rezensieren und die Funktionalität überprüfen. Vielen Dank an den Autor! Sie können das Script kostenlos verwenden, aber eine Wiederveröffentlichung des Codes unterliegt unseren Hausregeln.
Haftungsausschluss
Die Informationen und Veröffentlichungen sind nicht als Finanz-, Anlage-, Handels- oder andere Arten von Ratschlägen oder Empfehlungen gedacht, die von TradingView bereitgestellt oder gebilligt werden, und stellen diese nicht dar. Lesen Sie mehr in den Nutzungsbedingungen.