Indicator · Pine Script v5 · On the chart

Noob's MTF EMA Clouds

by InNoobWeTrust

Noob's MTF EMA Clouds computes and overlays multi-timeframe Exponential Moving Average (EMA) pairs across up to five user-selected timeframes directly on the price chart.

View on GitHub

GitHub stars4on the repository
Pine versionv5runs as is
Lines of code180
Settings16inputs
LicenceNone statedfile: MPL-2.0
Last updatetoday28 Oct 2026

Add It to Your TradingView Chart

  1. 1Copy the scriptPress Copy script above, or the copy button on the code below.
  2. 2Open the Pine EditorOpen a TradingView chart and choose Pine Editor at the bottom of the screen.
  3. 3Paste over the templateCreate a new indicator, select all of the template text and paste. Press Save and give it a name.
  4. 4Add it to the chartPress Add to chart, then adjust the settings with the gear icon next to its name.

Source Code

180 lines of Pine Script v5 from .innoobwetrust/life_hacks/tradingview/mtf_ema_clouds.pine, published under MPL-2.0 (file header). Keep the author's credit and licence lines when you reuse it.

mtf_ema_clouds.pine
// This Pine Script™ code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © InNoobWeTrust

//@version=5
indicator("Noob's MTF EMA clouds", overlay=true)
import TradingView/ta/8

//=============================================================================
// EMA clouds indicator
//=============================================================================

// Input
//-----------------------------------------------------------------------------{
ema_src = input.source(close, title = "EMA source")

ema_fast_length = input.int(34, title = "EMA fast")
ema_slow_length = input.int(89, title = "EMA slow")

tf_inline = "Timeframes"
tf1 = input.timeframe("1", title = "Timeframes", inline = tf_inline)
tf2 = input.timeframe("5", title = "", inline = tf_inline)
tf3 = input.timeframe("30", title = "", inline = tf_inline)
tf4 = input.timeframe("240", title = "", inline = tf_inline)
tf5 = input.timeframe("D", title = '', inline = tf_inline)
max_tf = input.int(5, 'Max timeframes', minval=2, maxval=5)

ema_gradients_inline = "EMA gradient"
ema_gradients_start = input.color(color.blue, title = "EMA gradient", inline = ema_gradients_inline)
ema_gradients_end = input.color(color.orange, title = "", inline = ema_gradients_inline)

cloud_up_gradients_inline = "Cloud upward gradient"
cloud_up_gradients_start = input.color(color.aqua, title = "Cloud upward gradient", inline = cloud_up_gradients_inline)
cloud_up_gradients_end = input.color(color.teal, title = "", inline = cloud_up_gradients_inline)
cloud_down_gradients_inline = "Cloud downward gradient"
cloud_down_gradients_start = input.color(color.orange, title = "Cloud downward gradient", inline = cloud_down_gradients_inline)
cloud_down_gradients_end = input.color(color.maroon, title = "", inline = cloud_down_gradients_inline)
cloud_transp = input.int(80, minval=0, maxval=100, title = "Cloud's tranparency")
//-----------------------------------------------------------------------------}

// Calculation
//-----------------------------------------------------------------------------{
type EmaTf
    float ema_fast
    float ema_fast_merged
    float ema_slow
    float ema_slow_merged
    int trend
    color fast_clr
    color slow_clr

ema_tf(string tf, int len, simple bool merge = false) =>
    request.security(syminfo.tickerid, tf, ta.ema(ema_src, len), gaps = merge ? barmerge.gaps_on : barmerge.gaps_off)

up_down_structure(src1, src2, src3) =>
    // Return 1 if up, -1 if down, 0 otherwise
    math.sign(src1 - src2) * (math.sign(src1 - src2) * math.sign(src2 - src3) + 1) / 2

calc_cloud(int idx, string tf, simple int len_fast, simple int len_slow) =>
    ema_fast = ema_tf(tf, len_fast)
    ema_fast_merged = ema_tf(tf, len_fast, true)
    ema_slow = ema_tf(tf, len_slow)
    ema_slow_merged = ema_tf(tf, len_slow, true)
    fast_clr = color.new(color.from_gradient(0, 0, 1, ema_gradients_start, ema_gradients_end), transp = cloud_transp)
    slow_clr = color.new(color.from_gradient(1, 0, 1, ema_gradients_start, ema_gradients_end), transp = cloud_transp)
    up_down_at_cross = ta.valuewhen(ta.cross(ema_fast, ema_slow), up_down_structure(close, ema_fast, ema_slow), 0)
    close_vs_ema_fast = ta.valuewhen(ta.cross(close, ema_fast), math.sign(close - ema_fast), 0)
    trend = switch
        up_down_at_cross > 0 and close_vs_ema_fast > 0 => 1
        up_down_at_cross < 0 and close_vs_ema_fast < 0 => -1
        => 0
    if idx < max_tf
        EmaTf.new(ema_fast, ema_fast_merged, ema_slow, ema_slow_merged, trend, fast_clr, slow_clr)
    else
        EmaTf.new(na, na, na, na, na, color(na), color(na))

// clouds
EmaTf[] mtf_emas = array.new<EmaTf>()
mtf_emas.push(calc_cloud(0, tf1, ema_fast_length, ema_slow_length))
mtf_emas.push(calc_cloud(1, tf2, ema_fast_length, ema_slow_length))
mtf_emas.push(calc_cloud(2, tf3, ema_fast_length, ema_slow_length))
mtf_emas.push(calc_cloud(3, tf4, ema_fast_length, ema_slow_length))
mtf_emas.push(calc_cloud(4, tf5, ema_fast_length, ema_slow_length))

pair_tf_structure(ema_fast, ema_slow, higher_ema_fast, higher_ema_slow) =>
    ta.valuewhen(ta.cross(ema_slow, higher_ema_slow), math.sign(ema_slow - higher_ema_slow), 0)

phase(int idx) =>
    ema_fast = mtf_emas.get(idx).ema_fast
    ema_slow = mtf_emas.get(idx).ema_slow
    trend = mtf_emas.get(idx).trend
    higher_ema_fast = mtf_emas.get(idx + 1).ema_fast
    higher_ema_slow = mtf_emas.get(idx + 1).ema_slow
    higher_trend = mtf_emas.get(idx + 1).trend

    if trend > 0 and higher_trend > 0 and pair_tf_structure(ema_fast, ema_slow, higher_ema_fast, higher_ema_slow) > 0
        1
    else if trend < 0 and higher_trend < 0 and pair_tf_structure(ema_fast, ema_slow, higher_ema_fast, higher_ema_slow) < 0
        -1
    else
        0

phase_color(int trend, simple int idx) =>
    switch trend
        1 => color.new(color.from_gradient(idx, 0, max_tf - 1, cloud_up_gradients_start, cloud_up_gradients_end), transp = cloud_transp)
        -1 => color.new(color.from_gradient(idx, 0, max_tf - 1, cloud_down_gradients_start, cloud_down_gradients_end), transp = cloud_transp)
        0 => na

fmt_countdown(simple string tf) =>
    if barstate.isrealtime and timeframe.in_seconds(timeframe.period) < timeframe.in_seconds(tf)
        time_left = int((time_close(tf) - timenow) / 1000)
        hh = int(time_left / 3600)
        mm = int((time_left % 3600) / 60)
        ss = int(time_left % 60)
        str.format('ETA: {0,number,00}:{1,number,00}:{2,number,00}', hh,mm,ss)
    else
        'ETA: -- : -- : --'

trend_txt(int trend) =>
    switch trend
        1 => '⬆︎' // Up
        -1 => '⬇︎' // Down
        0 => '〰︎' // Tangled

tb_txt_color(int trend) =>
    switch trend
        1 => #26a69a
        -1 => #ef5350
        0 => color.gray
tb_bg_color(int trend) =>
    switch trend
        1 => color.new(#26a69a,80)
        -1 => color.new(#ef5350,80)
        0 => color.new(color.gray,80)

// Clouds over clouds
int[] mtf_phases = array.new<int>()
int[] cloud_phases = array.new<int>()
color[] cloud_clrs = array.new<color>()
cloud_phases.push(phase(0))
cloud_clrs.push(phase_color(cloud_phases.get(0), 0))
cloud_phases.push(phase(1))
cloud_clrs.push(phase_color(cloud_phases.get(1), 1))
cloud_phases.push(phase(2))
cloud_clrs.push(phase_color(cloud_phases.get(2), 2))
cloud_phases.push(phase(3))
cloud_clrs.push(phase_color(cloud_phases.get(3), 3))
//-----------------------------------------------------------------------------}

// Plot
//-----------------------------------------------------------------------------{
c1plt2 = plot(mtf_emas.get(0).ema_slow, color = color(na), style = plot.style_line, force_overlay =  true)
plot(mtf_emas.get(0).ema_slow_merged, color = mtf_emas.get(0).slow_clr, style = plot.style_line, force_overlay =  true)

c2plt2 = plot(mtf_emas.get(1).ema_slow, color = color(na), style = plot.style_line, force_overlay =  true)
plot(mtf_emas.get(1).ema_slow_merged, color = mtf_emas.get(1).slow_clr, style = plot.style_line, force_overlay =  true)

c3plt2 = plot(mtf_emas.get(2).ema_slow, color = color(na), style = plot.style_line, force_overlay =  true)
plot(mtf_emas.get(2).ema_slow_merged, color = mtf_emas.get(2).slow_clr, style = plot.style_line, force_overlay =  true)

c4plt2 = plot(mtf_emas.get(3).ema_slow, color = color(na), style = plot.style_line, force_overlay =  true)
plot(mtf_emas.get(3).ema_slow_merged, color = mtf_emas.get(3).slow_clr, style = plot.style_line, force_overlay =  true)

c5plt2 = plot(mtf_emas.get(4).ema_slow, color = color(na), style = plot.style_line, force_overlay =  true)
plot(mtf_emas.get(4).ema_slow_merged, color = mtf_emas.get(4).slow_clr, style = plot.style_line, force_overlay =  true)

fill(c1plt2, c2plt2, color = cloud_clrs.get(0))
fill(c2plt2, c3plt2, color = cloud_clrs.get(1))
fill(c3plt2, c4plt2, color = cloud_clrs.get(2))
fill(c4plt2, c5plt2, color = cloud_clrs.get(3))

trend_tb = table.new(position.top_right, 3, max_tf, force_overlay = true)
if barstate.islast
    mtf = array.from(tf1,tf2,tf3,tf4,tf5)
    countdowns = array.from(fmt_countdown(tf1),fmt_countdown(tf2),fmt_countdown(tf3),fmt_countdown(tf4),fmt_countdown(tf5))
    for idx = 0 to max_tf - 1
        trend = mtf_emas.get(idx).trend
        table.cell(trend_tb,0,idx,mtf.get(idx),text_color = color.gray,bgcolor = na)
        table.cell(trend_tb,1,idx,trend_txt(trend),text_color = tb_txt_color(trend),bgcolor = tb_bg_color(trend))
        table.cell(trend_tb,2,idx,countdowns.get(idx),text_color = color.gray,bgcolor = na)
//-----------------------------------------------------------------------------}

Overview

Noob's MTF EMA Clouds calculates fast and slow EMAs to render shaded clouds that visualize trend direction and momentum across multiple horizons. Trend status is evaluated from EMA crossovers and price positioning relative to the fast EMA. Users can customize the EMA source, lengths, timeframes, gradient color schemes, and cloud transparency. Higher-timeframe values update intrabar on the real-time candle until the higher timeframe closes.

Details

Published by

InNoobWeTrust on GitHub

Type

Indicator, Pine Script v5

Draws

On the price chart

Category

Moving averages, Trend

Markets

Any symbol

Timeframes

Any timeframe

Risk Notes

No repainting, lookahead or stacked entries were found in its code or README. That says nothing about how well it works: test it first.

Topics

dotfiles

Settings

The inputs you can change from the gear icon on the chart. Defaults are the author's.

SettingTypeDefaultVariable
EMA sourcesourcecloseema_src
EMA fastint34ema_fast_length
EMA slowint89ema_slow_length
Timeframestimeframe1tf1
tf2timeframe5tf2
tf3timeframe30tf3
tf4timeframe240tf4
tf5timeframeDtf5
Max timeframesint5max_tf
EMA gradientcolorcolor.blueema_gradients_start
ema_gradients_endcolorcolor.orangeema_gradients_end
Cloud upward gradientcolorcolor.aquacloud_up_gradients_start
Show all 16 settings
SettingTypeDefaultVariable
cloud_up_gradients_endcolorcolor.tealcloud_up_gradients_end
Cloud downward gradientcolorcolor.orangecloud_down_gradients_start
cloud_down_gradients_endcolorcolor.marooncloud_down_gradients_end
Cloud's tranparencyint80cloud_transp
Third-party code. ForexR did not write, test or endorse this script, and the summary above was generated automatically from its code and README. Indicators describe the past, and a strategy's backtest can look better than live trading, especially when a script repaints. Check it in the Strategy Tester and on a demo account before you rely on it.

Similar Pine Scripts

948 stars

The Adaptive Laguerre Filter calculates a smoothed, dynamically adjusted trendline plotted directly on the main price chart. It dynamically adjusts its damping factor (alpha) based on recent price range variations and median percentile calculations over a spec

Indicator v4 TrendMoving averages
Updated 10 days ago · GPL-3.0 GitHub repository of Adaptive Laguerre Filter
330 stars

This script plots three moving averages on the price chart: a fast EMA or SMA with 10 periods, a slow EMA or SMA with 20 periods, and a trend EMA or SMA with 100 periods. It signals trend changes by drawing a white cross when the fast moving average crosses ab

Indicator v4 TrendMoving averages
Updated 2 months ago · None stated GitHub repository of 3 EMA/SMA + Cross [Alorse]
318 stars

This indicator plots four customizable moving averages directly on the main price chart using default lengths of 3, 8, 21, and 50 periods. It fills the space between adjacent averages in green or maroon depending on trend alignment. Additionally, it computes B

Indicator v5 Moving averagesTrend
Updated 2 months ago · MIT GitHub repository of Multiple Moving Averages

NVDA Trend Ribbon

by longsurf-ai
277 stars

This indicator plots three exponential moving averages and ATR volatility envelopes on the price chart. It compares the fast and slow EMAs to shade a trend ribbon and marks confirmed upward and downward crossovers with triangle labels. Settings change the thre

Indicator v6 TrendMoving averages
Updated yesterday · MIT GitHub repository of NVDA Trend Ribbon
257 stars

Donald SPX - Options Trading is an overlay indicator designed for intraday SPX analysis. It plots a 200-period Weighted Moving Average (WMA) on the price chart while evaluating multi-timeframe market structure across Daily, 15-minute, 5-minute, and 2-minute ba

Indicator v5 Moving averagesTrend Repaints
Updated 6 weeks ago · None stated GitHub repository of Donald SPX - Options Trading

60K均線

by TaichiS
219 stars

This multi-timeframe indicator calculates and plots 20-period and 60-period simple moving averages from the 60-minute timeframe directly onto the price chart. The 20-period average displays as a green line, while the 60-period average appears in blue. It serve

Indicator v4 Moving averagesTrend Repaints
Updated 5 years ago · None stated GitHub repository of 60K均線

More indicators

Trade Your Charts With a Regulated Broker

Compare brokers that connect to TradingView, with spreads, minimum deposits and leverage side by side.

Compare brokers