Free: indicator teardowns, a repaint checker and open-source scripts. No buy/sell signals, ever.

Taught to TradeSystems over signals.

Explainers / Ultimate Moving Average MTF by ChrisMood

Ultimate Moving Average MTF by ChrisMoody (CM_Ultimate_MA_MTF), explained from the source

Ultimate Moving Average-Multi-TimeFrame-7 MA Types, shown on charts as CM_Ultimate_MA_MTF, is an open-source TradingView indicator by ChrisMoody, published in April 2014, with about 36,800 boosts. It draws one moving average of the close, lets you pick from seven kinds, can take the average from another timeframe, and can add a second average and mark where the two cross. This page walks through the published code in order, says what each part really does, and ends with where it fails. It does not say whether the indicator makes money, and it gives no trades.

Step 1: seven averages, one line

The first input picks the kind of average by number: 1 simple (SMA), 2 exponential (EMA), 3 weighted (WMA), 4 Hull, 5 volume-weighted (VWMA), 6 Wilder's (RMA), 7 triple exponential (TEMA). The length is 20 and the price is always the close; the source is fixed in the code and is not an input. With the default settings the indicator is a plain 20-bar simple average of the close.

Step 2: the colour rule

The line is lime when the average is at or above its own value a few bars back, and red when it is below. "A few" is the input called "Color Smoothing", 2 by default. Nothing is smoothed: the setting is how many bars back the line is compared with. At 1 it compares with the previous bar; at 10 it compares with ten bars back, so the colour changes later.

Step 3: the other timeframe

Untick "Use Current Chart Resolution" and the average is taken from the timeframe you choose, daily by default. On an hourly chart that gives a daily average drawn as steps: one value per day, repeated on every hourly bar of that day.

Two things follow from the code.

The colour stops telling you the direction. The colour compares the line with its value 2 chart bars back, not 2 days back. Inside a step the two values are equal, and equal counts as "up", so the line is lime. It can be red only on the first 2 chart bars after a step down. A daily average that falls for a month looks mostly lime on an hourly chart.

History and the live chart are not the same line. The script is written in an old version of Pine and asks for the other timeframe with no lookahead setting. TradingView's notes for moving to Pine v3 say that scripts from before v3 behave as if lookahead is on: on past bars, every chart bar shows the higher-timeframe bar's final value, including chart bars that came before that value existed. On the live bar the value moves with each tick until the higher-timeframe bar closes. We read this from the code and TradingView's documentation; we did not watch it live.

The header says the timeframe can also be set lower than the chart. A request for a lower timeframe returns one value per chart bar, the last one inside it, so most of the lower-timeframe average is thrown away.

Step 4: the second average and the crosses

"Optional 2nd Moving Average" draws a second line as circles, length 50, with its own kind. "Show Dots on Cross" puts a yellow cross where the two lines cross, and it works whether or not the second line is drawn, so the second line's settings matter even when it is hidden.

Three details in the code are easy to miss.

The second line's colour is the first line's direction. The code works out up and down once, from the first average, and uses it for both lines. The second line turns red when the first one falls.

TEMA on the second line uses the first line's length. The code builds a triple exponential average for the second length, then never uses it. If you pick 7 for the second average, it draws the first average's TEMA, with the first length. Set both lines to TEMA and they are the same line, so no cross is ever marked.

Two of the inputs do nothing. The two tick boxes whose names start with "***" are notes to the reader written as inputs. Ticking them changes nothing.

What we checked in Python

We ported the higher-timeframe mode to Python and ran it on invented random-walk prices with a typical move of 1% a bar: 24 chart bars to each higher-timeframe bar (hourly bars under a daily average), SMA 20 and SMA 50, colour setting 2, 20 runs of 2,000 higher-timeframe bars each.

The colour. The higher-timeframe average fell on about half of its steps, as you would expect from random prices. The line was red on about 4% of chart bars. The other falling bars were lime.

History against live, direction. On about 7 of every 100 higher-timeframe bars, the direction shown on the first chart bar in history was the opposite of what the live values gave at that bar.

History against live, crosses. For every 10 crosses that history shows, the live values crossed back and forth about 18 times. About 8 of every 100 history cross marks sit on a bar where, live, the two averages had not yet crossed.

These figures describe the code on invented data, not any market.

Where it fails

Educational only. Not financial advice. Nothing here is a recommendation to buy or sell anything. Ultimate Moving Average-Multi-TimeFrame-7 MA Types (CM_Ultimate_MA_MTF) is by ChrisMoody on TradingView; this page describes its published open-source code in our own words and is not affiliated with the author. Simulation figures come from synthetic random-walk prices and say nothing about how the script behaves on any market.

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, CM MacD Ultimate MTF, 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, Volume Flow Indicator by LazyBear, FVG Order Blocks by BigBeluga, CM_Williams_Vix_Fix by ChrisMoody, Bollinger + RSI Double Strategy by Chart, Fibonacci Bollinger Bands by Rashad, Candlestick Patterns Identified by repo3, MACD + SMA 200 Strategy by ChartArt, Pine Script v5 to v6, Moving Average Cross Alert, Multi-Timefr, WaveTrend Oscillator [WT] by LazyBear, WaveTrend with Crosses [LazyBear], CM_Price-Action-Bars by ChrisMoody, RSI Candles by glaz, CM RSI-2 Strategy Lower Indicator by Chr, CM Stochastic Multi-TimeFrame by ChrisMo, CM_Ultimate RSI Multi Time Frame by Chri, TonyUX EMA Scalper - Buy / Sell by tux, MACD 4C by vkno422, My Pine Script is valid. What did the va

Next steps

  • Get a script fixed. Compiles but behaves differently live, or changes after a reload? In a Pine Script Audit, an AI model reads every line and writes a report on what to fix for $49, or also fixes those problems for $149. It cannot prove a script is safe.
  • Check your own script. Paste its source into the free repaint checker. It runs in your browser and flags known patterns.
Before you trust its backtest: the Integrity Checklist, $19 one-offBack to Taught to Trade

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.