OPEN-SOURCE SCRIPT
已更新 EMA/SMA Ribbon

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)
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)
發行說明
What changedAdded 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.
開源腳本
秉持TradingView一貫精神,這個腳本的創作者將其設為開源,以便交易者檢視並驗證其功能。向作者致敬!您可以免費使用此腳本,但請注意,重新發佈代碼需遵守我們的社群規範。
免責聲明
這些資訊和出版物並非旨在提供,也不構成TradingView提供或認可的任何形式的財務、投資、交易或其他類型的建議或推薦。請閱讀使用條款以了解更多資訊。
開源腳本
秉持TradingView一貫精神,這個腳本的創作者將其設為開源,以便交易者檢視並驗證其功能。向作者致敬!您可以免費使用此腳本,但請注意,重新發佈代碼需遵守我們的社群規範。
免責聲明
這些資訊和出版物並非旨在提供,也不構成TradingView提供或認可的任何形式的財務、投資、交易或其他類型的建議或推薦。請閱讀使用條款以了解更多資訊。