Indicator · Pine Script v6 · On the chart

EMA Cloud

by rubbermetal· code credited to claygrace74

EMA Cloud draws a ribbon of eighteen exponential moving averages from 5 to 200 periods, with fills between neighbouring lines colored by which average sits higher.

View on GitHub

GitHub stars1on the repository
Pine versionv6current
Lines of code121
Settings7inputs
LicenceMPL-2.0
Last update4 months ago10 Jun 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

121 lines of Pine Script v6 from EMA Cloud.pine, published under MPL-2.0. Keep the author's credit and licence lines when you reuse it.

EMA Cloud.pine
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © claygrace74

//@version=6
indicator("EMA Cloud", shorttitle="EMA_C", overlay=true)

// ==================== Settings ====================
var ema_group = "EMA Ribbon Settings"
src = input.source(close, "Source", group=ema_group)
bool i_showRibbon = input.bool(true, "Show EMA Ribbon", group=ema_group)

var disp_group = "Display Settings"
bool i_showTarBaby  = input.bool(true, "Show Tar Baby (RMA 120)", group=disp_group)
bool i_showSignals  = input.bool(true, "Show Trend Shift Signals", group=disp_group)
bool i_showExpComp  = input.bool(true, "Show Expansion/Compression", group=disp_group)
upFill   = input.color(color.new(color.green, 75), "Bullish Fill", group=disp_group)
downFill = input.color(color.new(color.red, 75), "Bearish Fill", group=disp_group)

// ==================================================================================
// EMA Calculations (18 EMAs: 5 to 200)
// ==================================================================================
A = ta.ema(src, 5)
B = ta.ema(src, 10)
C = ta.ema(src, 15)
D = ta.ema(src, 20)
E = ta.ema(src, 25)
F = ta.ema(src, 30)
G = ta.ema(src, 35)
H = ta.ema(src, 40)
I = ta.ema(src, 45)
J = ta.ema(src, 50)
K = ta.ema(src, 55)
L = ta.ema(src, 60)
M = ta.ema(src, 65)
N = ta.ema(src, 70)
O = ta.ema(src, 75)
P = ta.ema(src, 80)
Q = ta.ema(src, 100)
R = ta.ema(src, 200)
tarBaby = ta.rma(ohlc4, 120)

// Fill direction helper
fillThis(m1, m2, upclr, downclr) =>
    m1 > m2 ? upclr : m1 < m2 ? downclr : color(na)

// Ribbon spread (expansion/compression detection)
spread = A - R
spreadSma = ta.sma(math.abs(spread), 20)
compressed = math.abs(spread) < spreadSma * 0.5
expanding  = math.abs(spread) > spreadSma * 1.5

// Trend signals
bullShift = ta.crossover(A, R)   // Fastest crosses above slowest
bearShift = ta.crossunder(A, R)
goldenCross = ta.crossover(J, R)  // EMA 50 crosses EMA 200
deathCross  = ta.crossunder(J, R)

// ==================================================================================
// Plots
// ==================================================================================

// EMA ribbon lines (transparent — fills provide the visual)
EMA1  = plot(i_showRibbon ? A : na, 'EMA 5',   color=color.new(color.yellow, 80), linewidth=1)
EMA2  = plot(i_showRibbon ? B : na, 'EMA 10',  color=color.new(color.purple, 80), linewidth=1)
EMA3  = plot(i_showRibbon ? C : na, 'EMA 15',  color=color.new(color.purple, 80), linewidth=1)
EMA4  = plot(i_showRibbon ? D : na, 'EMA 20',  color=color.new(color.purple, 80), linewidth=1)
EMA5  = plot(i_showRibbon ? E : na, 'EMA 25',  color=color.new(color.fuchsia, 80), linewidth=1)
EMA6  = plot(i_showRibbon ? F : na, 'EMA 30',  color=color.new(color.fuchsia, 80), linewidth=1)
EMA7  = plot(i_showRibbon ? G : na, 'EMA 35',  color=color.new(color.fuchsia, 80), linewidth=1)
EMA8  = plot(i_showRibbon ? H : na, 'EMA 40',  color=color.new(color.fuchsia, 80), linewidth=1)
EMA9  = plot(i_showRibbon ? I : na, 'EMA 45',  color=color.new(color.fuchsia, 80), linewidth=1)
EMA10 = plot(i_showRibbon ? J : na, 'EMA 50',  color=color.new(color.fuchsia, 80), linewidth=1)
EMA11 = plot(i_showRibbon ? K : na, 'EMA 55',  color=color.new(color.fuchsia, 80), linewidth=1)
EMA12 = plot(i_showRibbon ? L : na, 'EMA 60',  color=color.new(color.fuchsia, 80), linewidth=1)
EMA13 = plot(i_showRibbon ? M : na, 'EMA 65',  color=color.new(color.fuchsia, 80), linewidth=1)
EMA14 = plot(i_showRibbon ? N : na, 'EMA 70',  color=color.new(color.fuchsia, 80), linewidth=1)
EMA15 = plot(i_showRibbon ? O : na, 'EMA 75',  color=color.new(color.fuchsia, 80), linewidth=1)
EMA16 = plot(i_showRibbon ? P : na, 'EMA 80',  color=color.new(color.red, 80), linewidth=1)
EMA17 = plot(i_showRibbon ? Q : na, 'EMA 100', color=color.new(color.red, 80), linewidth=1)
EMA18 = plot(i_showRibbon ? R : na, 'EMA 200', color=color.new(color.red, 80), linewidth=1)

// Ribbon fills
fill(EMA1, EMA2,   color=fillThis(A, B, upFill, downFill))
fill(EMA2, EMA3,   color=fillThis(A, C, upFill, downFill))
fill(EMA3, EMA4,   color=fillThis(A, D, upFill, downFill))
fill(EMA4, EMA5,   color=fillThis(A, E, upFill, downFill))
fill(EMA5, EMA6,   color=fillThis(A, F, upFill, downFill))
fill(EMA6, EMA7,   color=fillThis(A, G, upFill, downFill))
fill(EMA7, EMA8,   color=fillThis(A, H, upFill, downFill))
fill(EMA8, EMA9,   color=fillThis(A, I, upFill, downFill))
fill(EMA9, EMA10,  color=fillThis(A, J, upFill, downFill))
fill(EMA10, EMA11, color=fillThis(A, K, upFill, downFill))
fill(EMA11, EMA12, color=fillThis(A, L, upFill, downFill))
fill(EMA12, EMA13, color=fillThis(A, M, upFill, downFill))
fill(EMA13, EMA14, color=fillThis(A, N, upFill, downFill))
fill(EMA14, EMA15, color=fillThis(A, O, upFill, downFill))
fill(EMA15, EMA16, color=fillThis(A, P, upFill, downFill))
fill(EMA16, EMA17, color=fillThis(A, Q, upFill, downFill))
fill(EMA17, EMA18, color=fillThis(A, R, upFill, downFill))

// Tar Baby
plot(i_showTarBaby ? tarBaby : na, "Tar Baby", color=color.new(color.white, 0), linewidth=2)

// Compression/expansion background
bgcolor(i_showExpComp and compressed ? color.new(color.yellow, 92) : na, title="Compression Warning")

// Trend shift signals
plotshape(i_showSignals and goldenCross, style=shape.diamond, location=location.belowbar, color=color.new(#FFD700, 0), text="Golden", textcolor=color.new(#FFD700, 0), size=size.small, title="Golden Cross")
plotshape(i_showSignals and deathCross,  style=shape.diamond, location=location.abovebar, color=color.new(color.purple, 0), text="Death", textcolor=color.new(color.purple, 0), size=size.small, title="Death Cross")
plotshape(i_showSignals and bullShift and not goldenCross, style=shape.triangleup,   location=location.belowbar, color=color.green, size=size.tiny, title="Bull Shift")
plotshape(i_showSignals and bearShift and not deathCross,  style=shape.triangledown, location=location.abovebar, color=color.red,   size=size.tiny, title="Bear Shift")

// ==================================================================================
// Alert Conditions
// ==================================================================================
alertcondition(goldenCross, "Golden Cross",       "EMA 50 crossed above EMA 200")
alertcondition(deathCross,  "Death Cross",        "EMA 50 crossed below EMA 200")
alertcondition(bullShift,   "Bullish Trend Shift","EMA 5 crossed above EMA 200")
alertcondition(bearShift,   "Bearish Trend Shift","EMA 5 crossed below EMA 200")
alertcondition(compressed,  "Ribbon Compressed",  "EMA ribbon is compressed — breakout likely")
alertcondition(expanding,   "Ribbon Expanding",   "EMA ribbon is expanding — strong trend")

Overview

EMA Cloud adds a 120-period RMA line, markers where the fastest EMA crosses the 200 EMA, golden and death crosses of the 50 and 200 EMAs, and flags for ribbon expansion or compression. Toggles switch each layer on or off. It draws on the price chart.

Details

Published by

rubbermetal on GitHub

Code credit

claygrace74, as written in the script's header

Draws

On the price chart

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.

Settings

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

SettingTypeDefaultVariable
Sourcesourceclosesrc
Show EMA Ribbonbooltruei_showRibbon
Show Tar Baby (RMA 120)booltruei_showTarBaby
Show Trend Shift Signalsbooltruei_showSignals
Show Expansion/Compressionbooltruei_showExpComp
Bullish Fillcolorcolor.new(color.green, 75)upFill
Bearish Fillcolorcolor.new(color.red, 75)downFill
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

947 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 12 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
280 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 3 days ago · 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 7 weeks ago · None stated GitHub repository of Donald SPX - Options Trading
228 stars

This indicator computes moving average and RSI bias signals across the current timeframe and four higher timeframes. It sums biases from the MA and RSI to derive an overall bullish or bearish signal. The results appear in a configurable table that displays eac

Indicator v6 TrendMoving averages
Updated 3 months ago · None stated GitHub repository of Multi-Timeframe Analysis Template

More Trend scripts

Related on ForexR

Trade Your Charts With a Regulated Broker

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

Compare brokers