Explainers / CM MacD Ultimate MTF
CM MacD Ultimate MTF, explained from the source
CM MacD Custom Indicator - Multiple Time Frame by ChrisMoody is one of the most-boosted indicators on TradingView, with more than 80,000 boosts. It shows up on charts as CM_Ult_MacD_MTF: a MACD with a four-colour histogram, a line that changes colour, and dots where the lines cross, with an option to read the MACD from another timeframe. It was written in 2014 in the first version of Pine. Two things in that short source matter more than any setting: its signal line is not the one most MACDs use, and its higher-timeframe history shows values earlier than a live chart could have shown them.
What it calculates
- MACD line: the 12-bar EMA of the close minus the 26-bar EMA. This part is standard.
- Signal line: a 9-bar simple average of the MACD line. Most MACDs, including TradingView's built-in one, use a 9-bar EMA here.
- Histogram: MACD minus signal.
So with the same 12, 26, 9 numbers, this indicator's signal line, histogram and crosses will not line up exactly with a standard MACD. A simple average reacts later to a turn and then drops old values all at once; in our simulation it crossed the MACD about 5% more often than an EMA signal did. Neither is "right"; they are different tools, and comparing settings between them only works if you know which one you are looking at.
The colours and the dots
| What you see | What it means in the code |
|---|---|
| Histogram, bright colour above zero | above zero and higher than the previous bar |
| Histogram, darker colour above zero | above zero and lower than the previous bar |
| Histogram, red below zero | at or below zero and lower than the previous bar |
| Histogram, maroon below zero | at or below zero and higher than the previous bar |
| MACD line green / red | MACD above / below the signal line |
| Dot | the MACD line crossed the signal line on that bar, drawn at the signal value |
There are no alert conditions in the script. An alert on this indicator is one you build yourself on one of its plots.
At the default it is not multi-timeframe
The first setting, "Use Current Chart Resolution?", is ticked by default. With it ticked, the script asks for the chart's own timeframe, which changes nothing: you get a plain MACD with an SMA signal on whatever chart you are on. The multi-timeframe part only starts when you untick it and choose another timeframe (the default choice is 60 minutes).
Does CM MacD MTF repaint?
On the chart's own timeframe: closed bars do not change. The live bar moves with price, like any MACD, so a dot or a colour can appear during the bar and be gone at the close.
On a higher timeframe: yes, and history is the bigger problem. The script is written in Pine version 1 and gives no lookahead setting to its higher-timeframe requests. TradingView's own migration guide for Pine version 3 says that the older default looked "into the future" on historical bars, and that version 3 switched it off. In practice, on old bars every lower-timeframe bar inside an hour (or a day) shows that hour's final MACD values, from the first bar onwards. On a live chart those values are still forming and keep changing until the hour closes.
What that does to the picture, from our simulation (random-walk prices, 200,000 bars, this script's rules re-implemented, three seeds):
| 15-minute chart, 1-hour MACD | 1-hour chart, daily MACD | |
|---|---|---|
| How early a cross dot sits in history | 3 bars before it could be final | 23 bars before it could be final |
| Crosses seen live that were gone when the higher bar closed | about 24% | about 33% |
| Histogram colour on the first bar of a higher bar that differs from what history shows | about 23% | about 26% |
So a back-scroll of this indicator on a higher timeframe shows clean dots at the start of each move. Live, the same dot could only be confirmed at the end of the higher bar, and about a quarter to a third of the crosses you would have seen forming never happened. If you use it on another timeframe, judge it on live behaviour or on a version that requests only closed higher-timeframe bars. More in what repainting is and how to check a script yourself.
Where it fails
- The higher-timeframe history is not what you would have seen live. Dots and colours sit at the start of each higher bar in history, but could only be known at its end.
- Live crosses on a higher timeframe come and go. In our simulation a quarter to a third of them were undone before the higher bar closed.
- The signal line is an SMA. It will not match a standard 12/26/9 MACD, so settings and screenshots from other MACDs do not carry over.
- No alerts and no test. The script has no alert conditions and no record of how any setting performed.
- MACD itself only follows price. Every part of it is built from past closes, so it describes what happened; it does not know what comes next.
Also explained: WaveTrend · Squeeze Momentum · QQE MOD · Repainting
Educational only. Not financial advice. Nothing here is a recommendation to buy or sell anything. CM MacD Custom Indicator - Multiple Time Frame is by ChrisMoody on TradingView; this page explains its published open-source code and is not affiliated with the author. Simulation figures come from synthetic random-walk prices and say nothing about how the indicator trades.
Also explained: Repaint checker, VWAP, Supertrend, RSI, UT Bot Alerts, Nadaraya-Watson Envelope, Squeeze Momentum, What is repainting on TradingView?, Is TradingView backtesting accurate?, Chandelier Exit, WaveTrend Oscillator, QQE MOD, Pivot highs and lows, Hull Suite, Range Filter, Twin Range Filter, HalfTrend, ZigZag++, SSL Hybrid, Volume Profile / Fixed Range, ADX and DI, Support Resistance Channels, Market Structure Break & Order Block, Order Block Finder, Pivot Point SuperTrend, Trendlines with Breaks [LuxAlgo], Divergence for Many Indicators, TradingView script selling terms, Support and Resistance Levels with Break, Liquidity Swings [LuxAlgo], Pine Script errors, Breakout Probability (Expo), Did ChatGPT or Claude write your Pine Sc, Lorentzian Classification, SuperTrend AI (Clustering), Machine Learning Adaptive SuperTrend, Dynamic Swing Anchored VWAP, Support and Resistance Power Channel by , Support and Resistance (High Volume Boxe, Trendline Breakouts With Targets by Char, Breakout Finder by LonesomeTheBlue
Get the next teardown by email
One short email when a new teardown or free tool goes live, about twice a month. No signals, no hype. Unsubscribe in one click.
Almost done. Check your inbox and click the confirmation link.
Sent with Kit. Your address is used only for these emails. Privacy
No TradingView account yet? This affiliate link gives you a $15 coupon toward a paid plan, and we earn a commission if you buy one. The free plan is enough to follow this page.