OPEN-SOURCE SCRIPT

Custom EMA SMA Ribbon

876

Indicator name and purpose
Custom EMA SMA Ribbon is a six-layer moving average ribbon built to show trend alignment, momentum structure, and signal readiness in a single glance. Rather than relying on one crossover, it renders a stacked relationship between fast, medium, and slow averages so the trend context is visible without extra indicators. The purpose is to make trend direction, trend stability, and momentum alignment readable at a glance, while also providing filtered entry signals and a visual status matrix that summarizes the current bias against each moving average.
Long set up
ekran görüntüsü
Short set up
ekran görüntüsü
Mixed scenario
ekran görüntüsü

What it does
Each moving average layer is colored based on whether it is above or below the next slower layer. When the ribbon is stacked with fast lines above slow lines, the structure is bullish. When fast lines fall below the slower lines, the structure is bearish. This layered coloring reveals whether the trend is cleanly aligned or mixed. The script also highlights full alignment, where all fast layers sit above or below the slowest line, which is usually the most stable trend condition. In addition to the visual ribbon, it generates trend-filtered signals: a bullish signal appears only when the slow ribbon is aligned bullish and MA1 crosses above MA2, while a bearish signal appears only when the slow ribbon is aligned bearish and MA1 crosses below MA2. A signal status matrix in the chart corner shows whether price is above or below each moving average, giving a compact snapshot of current bias without scanning every line.

How it works in detail
The indicator calculates six moving averages from a single price source. You can use EMA for a more responsive ribbon or SMA for a smoother ribbon that reduces noise. Each line’s color is determined by its position relative to the next slower line, building a visible map of internal trend health. The slowest line acts as the anchor. If all faster lines remain above it, the ribbon is fully bullish. If all faster lines remain below it, the ribbon is fully bearish. The trend-filtered signals add a momentum layer: they require a clean macro stack first, then confirm entry with the fast crossover of MA1 and MA2. Signals are plotted as tiny circles, so they do not clutter the chart. Bullish signals plot at the bottom in green, bearish signals plot at the top in red. Optional background shading emphasizes the full alignment zones, and all signal states can be confirmed on bar close with the non-repainting toggle. The signal status matrix is updated on the last bar and labels each MA as LONG or SHORT depending on whether the current close is above or below that line, allowing quick context checks during live monitoring.

Default settings
The default lengths 10, 20, 50, 100, 150, and 200 create a balanced mix of short-term, mid-term, and long-term context. The 10 and 20 lengths capture fast swings and early shifts. The 50 and 100 lengths reflect the core trend structure. The 150 and 200 lengths anchor the ribbon to the broader market bias. This combination makes it easy to see if short-term momentum is moving with the larger trend or if it is fighting it. EMA is selected by default to keep the ribbon responsive enough for intraday and swing traders, but you can switch to SMA for smoother, slower trend mapping. With the default configuration, the signal logic is naturally conservative because the faster cross must occur only after MA3, MA4, MA5, and MA6 are stacked in the same direction, filtering many counter-trend crosses. The matrix defaults to the bottom right so it stays visible without covering price action, but you can move it to any corner or center position.

How to use it on charts
Use the ribbon as a trend filter first. When most lines are green and stacked in order, the trend is bullish and pullbacks can be treated as potential continuation zones. When most lines are red and stacked downward, rallies can be treated as corrective unless the stack flips. The strongest trend environments occur when the ribbon is fully aligned above or below the slowest line. If the ribbon becomes mixed with alternating colors, that signals transition or consolidation and signals should be treated more cautiously. In those mixed states, ignore the MA1/MA2 crosses because the macro alignment filter will not allow signals, which is intentional to reduce noise. The matrix helps confirm whether price is holding above multiple layers during a bullish trend or below multiple layers during a bearish trend, which can support trade management decisions like scaling in or tightening stops.

Signal logic explained
Bullish signal requirements: MA3 above MA4, MA4 above MA5, and MA5 above MA6 must all be true, confirming a clean bullish macro stack. Once that macro alignment exists, a bullish signal is generated when MA1 crosses above MA2. This is the earliest momentum entry that still respects the larger trend. Bearish signal requirements: MA3 below MA4, MA4 below MA5, and MA5 below MA6 must all be true. Once that macro alignment exists, a bearish signal is generated when MA1 crosses below MA2. This ensures the momentum entry is taken only in the direction of the larger ribbon stack. Signals appear as tiny circles to keep the chart clean: white at the bottom for bullish signals, black at the top for bearish signals. The matrix adds a second layer of confirmation by showing whether the close remains above each MA during a bullish signal or below each MA during a bearish signal.


Practical usage examples
Trend continuation example: price rises, the ribbon is fully bullish, and fast lines stay above the slowest line during pullbacks. When MA1 crosses back above MA2 after a shallow pullback, the green circle appears at the bottom, indicating a momentum continuation aligned with the macro structure. If the matrix also shows LONG across most rows, it confirms that price remains above the key layers. Trend reversal example: the ribbon compresses, fast lines cross down, and the full alignment flips bearish after several mixed states. Once MA3 to MA6 are stacked bearish, the red top circle appears when MA1 crosses below MA2, signaling the first momentum entry in the new trend direction. If the matrix shifts to SHORT across multiple rows, it confirms the shift in control.

All Long signals on matrix
ekran görüntüsü
Mixed signals on matrix
ekran görüntüsü

How the components work together
The layered coloring shows immediate, mid, and macro alignment in one view. The full alignment state acts as a high confidence filter for trend bias. Optional background shading gives a quick visual signal of those high confidence zones. The trend-filtered MA1/MA2 cross signals provide a concise momentum trigger that only fires when the broader ribbon is aligned. The signal status matrix summarizes price position versus each MA, helping traders quickly gauge whether momentum entries are supported by broader structure. Together these components provide a complete trend map, entry framework, and state dashboard without overloading the chart.

What makes this script original
This ribbon is not a simple fast slow crossover. Each layer is colored relative to its adjacent layer, which exposes the internal order of the ribbon and the health of the trend rather than only the outer edges. The macro alignment filter combined with a fast crossover creates a structured momentum signal that is stricter than most ribbons, helping avoid counter trend entries. The added status matrix provides a compact decision aid that shows whether price is above or below each layer in real time, which most ribbons do not include. The non-repainting toggle ensures the behavior is consistent between historical and live data. The indicator focuses on structural clarity and disciplined signals rather than generic crossover spam.

Markets, timeframes, and trading styles
This indicator is suitable for any liquid market including Forex, Crypto, Stocks, Commodities, and Indices. For scalping on 1m to 5m charts, keep lengths shorter or use EMA to maintain responsiveness, and focus on quick momentum continuation after macro alignment while using the matrix to confirm price remains above the faster layers. For day trading on 5m to 1H charts, the default lengths provide a balanced view of trend and pullback structure. For swing trading on 1H to daily charts, the default lengths remain effective and reduce noise. For position trading or investing on weekly charts, consider increasing all lengths proportionally to match the longer holding horizon and only take signals that align with the macro stack and matrix bias.

Settings guidance
Shorter lengths create faster signals but more noise; longer lengths create smoother signals but more lag. EMA reacts faster and suits active styles, while SMA smooths the ribbon for broader trend interpretation. Line styles and thickness controls let you emphasize the layers you care about most. Background shading is best kept subtle to preserve chart readability and should be used primarily to highlight full alignment states. Signal markers can be toggled off if you want a purely visual ribbon without entries. The matrix position can be moved to any corner or center area of the chart to avoid overlapping price action or other annotations.

Alerts
The script includes alerts for full bullish alignment, full bearish alignment, fast crosses between MA1 and MA2, and the trend-filtered bullish and bearish cross signals. All alerts respect the non-repainting toggle, so they fire on confirmed bars only when that option is enabled. Messages include symbol, timeframe, and price placeholders for automation or logging.

Non-repainting behavior
When non-repainting mode is enabled, all signal conditions and background states are confirmed on closed bars. This avoids signals appearing and disappearing mid bar and ensures live behavior mirrors historical behavior. Disabling the toggle makes the ribbon update in real time but signals should be treated as provisional until the bar closes.

Disclaimer
This indicator is a technical analysis tool and does not constitute financial advice. Always test settings on your chosen market and timeframe, use risk management, and confirm signals with additional context. No indicator is perfect; use this ribbon as one component of a broader trading plan.


Feragatname

Bilgiler ve yayınlar, TradingView tarafından sağlanan veya onaylanan finansal, yatırım, alım satım veya diğer türden tavsiye veya öneriler anlamına gelmez ve teşkil etmez. Kullanım Koşulları bölümünde daha fazlasını okuyun.