OPEN-SOURCE SCRIPT
Updated

EMA/SMA Ribbon

116
This indicator plots a two-line moving-average ribbon built from:

15-period EMA calculated on OHLC4 (Open+High+Low+Close)/4, with no offset

22-period SMA calculated on OHLC4, plotted with an offset of +6 bars

The space between the two averages is filled to form a ribbon:

Green ribbon when the EMA is above the SMA (using the SMA’s plotted/offset position so the color matches what you see on the chart)

Red ribbon when the SMA is above the EMA

Notes / Behavior:

The indicator uses the chart timeframe (no custom timeframe logic).

Because the SMA is intentionally shifted forward by 6 bars, the ribbon color is calculated against the visually aligned SMA so the color reflects the displayed relationship between the two lines.

No crossover markers or dots are plotted (ribbon-only).

How to use:
Use the ribbon color as a quick visual trend bias:

Green generally suggests bullish bias (EMA leading above the shifted SMA)

Red generally suggests bearish bias (EMA below the shifted SMA)
Release Notes
What changed

Added 3 extra EMAs:

EMA 9 (default: orange, slim, solid)

EMA 20 (default: yellow, slim, solid)

EMA 50 (default: green, slim, solid)

Added 3 extra SMAs:

SMA 100 (default: purple, slim, dashed)

SMA 150 (default: blue, slim, dashed)

SMA 200 (default: red, normal thickness, dashed)

Customization added (for each of the 6 new MAs)

Each of the new moving averages has independent controls for:

Length (fully editable)

Color

Line thickness

Line style: Solid / Dotted / Dashed

Dotted uses a dot-style plot.

Dashed is implemented as a dash-step effect (plots the line at intervals) because TradingView plot() does not support true dashed strokes directly.

What did NOT change

The original EMA15 / SMA22 Ribbon logic is unchanged:

same sources (ohlc4)

same lengths (EMA 15 / SMA 22)

same SMA offset behavior (offset 6)

same ribbon color logic (based on what you visually see)

still no cross dot

Why this update matters

This keeps the ribbon as the main trend/condition layer, while adding standard “structure” moving averages (short EMAs + long SMAs) for multi-timeframe context and cleaner discretionary decision support.

Disclaimer

The information and publications are not meant to be, and do not constitute, financial, investment, trading, or other types of advice or recommendations supplied or endorsed by TradingView. Read more in the Terms of Use.