OPEN-SOURCE SCRIPT

Moving Average Convergence Divergence TIME

61
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.

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.