About the MACD Calculator
Calculate MACD (Moving Average Convergence Divergence) from your own prices: the MACD line, the signal line and the histogram for every bar. Paste closing prices or load a CSV export, keep the standard 12, 26 and 9 settings or change them, and see the latest values with a chart.
The page tells you whether MACD is above or below its signal line and above or below zero on the last bar, and whether the two lines crossed on that bar.
How it works
The MACD line is the 12-bar exponential moving average of the close minus the 26-bar one. When the shorter average is above the longer, MACD is positive, which happens when prices have been rising.
The signal line is a 9-bar exponential moving average of the MACD line itself, started from the simple average of the first nine MACD values. The histogram is MACD minus the signal line, so it is positive when MACD is above its signal.
Because the 26-bar average needs 26 closes and the signal needs nine MACD values, the first complete reading appears on the 34th bar. On a price rising by the same amount every bar, MACD settles at 7 times that amount: the gap between the two averages' lags.
Assumptions and limits
- Prices must be in date order, oldest first; dated files listed newest first are reordered automatically.
- Exponential averages are seeded with simple averages, the method most charting platforms use.
- MACD is in price units, so its size depends on the market's price; compare it with its own history, not between markets.
- MetaTrader's built-in MACD draws the signal line as a simple rather than exponential average, so its signal values differ from this page and from TradingView.
Worked examples
A steady rise
On closes rising by 1 every bar, MACD(12, 26, 9) settles at exactly 7 and the histogram at 0.
Flat prices
When the price doesn't change, both averages equal it and MACD, signal and histogram are all 0.
A crossover
If the histogram was negative on the previous bar and is positive now, MACD has just crossed above its signal line.
How to use the MACD Calculator
- Add your prices. At least 34 closes for the standard settings.
- Set the periods. 12, 26 and 9 unless you use others.
- Read MACD. The line, signal and histogram for every bar.
Frequently asked questions
How is MACD calculated?
Take the 12-period EMA of the closing price and subtract the 26-period EMA to get the MACD line. The signal line is a 9-period EMA of the MACD line, and the histogram is the MACD line minus the signal line.
What does a MACD crossover mean?
When MACD crosses above its signal line, short-term momentum has turned up relative to the recent past; crossing below means it has turned down. Crossovers happen often in sideways markets, so many traders also check the trend.
What does MACD above zero mean?
It means the 12-period average is above the 26-period average, so prices have been rising over that window. Below zero means the shorter average is under the longer one, a sign of a recent fall.
How many prices do I need for MACD?
With the standard 12, 26, 9 settings the first full reading, with a signal line, appears on the 34th bar. For values that match a trading platform closely, give it a few hundred bars.
Can I change the MACD settings?
Yes. Some traders use faster settings such as 5, 35, 5 or 8, 17, 9. The fast period must be shorter than the slow one, and each must be a whole number of bars.
This tool runs entirely in your browser. What you enter or upload stays on your device and is never sent to our servers.