OPEN-SOURCE SCRIPT

EMA Ribbon Trend Filter [StrixEDGE]

5 150
EMA Ribbon Trend Filter is a multi-layered trend analysis system built around a triple EMA ribbon (8/21/55) enhanced with squeeze detection, a composite momentum score, multi-timeframe confluence, and dynamic slope-adaptive coloring.

This is not another moving average overlay. It is a full trend diagnostics dashboard designed to answer five questions at a glance: what is the trend, how strong is it, how long has it been running, is the ribbon compressing toward a breakout, and do higher timeframes agree.


🔹 CORE CONCEPT

Three exponential moving averages — fast (8), mid (21), and slow (55) — form a visual ribbon on the chart. When the EMAs stack in order (fast > mid > slow), the trend is bullish. When they invert, the trend is bearish. Anything else is a transitional state labeled neutral.

The ribbon is more than directional. The distance between the fastest and slowest EMA (the "spread") measures trend strength as a percentage, and the rate at which the ribbon expands or contracts reveals momentum shifts before price confirms them.

快照

🔹 WHAT MAKES THIS DIFFERENT

Most EMA ribbons stop at direction and color. This indicator adds four analytical layers that standard ribbons lack:

▸ Ribbon Squeeze Detection
The indicator continuously measures ribbon width against its own moving average. When the three EMAs converge below a configurable threshold (default: 30% of average width), the ribbon turns yellow and the dashboard flags an active squeeze. Compression precedes expansion — a squeeze ending often marks the start of a directional move. Dedicated markers appear on the chart when a squeeze releases into a bullish or bearish trend.

▸ Composite Momentum Score (0–100)
A single number synthesizing four components, each weighted equally at 25 points:
— EMA alignment: full bullish or bearish stack scores 25, mixed scores 0
— Slope agreement: all three EMAs rising or all falling scores 25, partial agreement scores 12
— Spread strength: scaled between 0–25 based on where the current spread falls relative to the user-defined weak and strong thresholds
— Price position: price above the ribbon in a bullish trend (or below in bearish) scores 25, inside the ribbon scores 10, on the wrong side scores 0
The score is color-coded: cyan (80+), teal (60–79), orange (40–59), red (below 40).

▸ Dynamic Slope-Adaptive Colors
When enabled, each EMA line independently changes color based on its own slope — rising EMAs render green, falling EMAs render red. This provides an early visual warning when individual EMAs begin to flatten or turn, even while the overall stack remains intact. A bullish stack where the slow EMA has turned red is a qualitatively different signal than one where all three are green.

▸ Multi-Timeframe Dashboard
A built-in table displays trend state, spread, and grade across five timeframes simultaneously: the current chart timeframe plus 15-minute, 1-hour, 4-hour, and daily. The active chart timeframe is marked with ► in the MTF rows if it matches one of the fixed timeframes. A confluence row at the bottom counts how many timeframes are bullish versus bearish and outputs a directional bias: Strong Bull (4–5 aligned), Bull Lean (3), Neutral (mixed), Bear Lean (3 bearish), or Strong Bear (4–5 bearish).


🔹 CROSSOVER SIGNAL HIERARCHY

Not all EMA crossovers carry equal weight. The indicator differentiates three tiers with distinct marker sizes and shapes:

▸ Fast × Mid (tiny triangles) — Early signal. The 8 EMA crossing the 21 EMA indicates short-term momentum shift. Frequent, noisy, best used as an alert rather than a trigger.

▸ Fast × Slow (standard triangles) — Confirmation signal. The 8 EMA crossing the 55 EMA has more significance and filters out minor pullbacks.

▸ Mid × Slow (diamonds) — Trend shift signal. The 21 EMA crossing the 55 EMA typically marks a genuine change in trend direction. This is the least frequent and most reliable crossover in the set.

All crossover markers can be toggled off independently.


🔹 DASHBOARD COMPONENTS

The top-right dashboard (position and size adjustable) contains:

Row 1 — TREND: Current trend state (▲ Bullish / ▼ Bearish / ◆ Neutral) with bar count showing how long the trend has been active.

快照

Row 2 — ZONE: Where price sits relative to the ribbon (Above / Inside / Below) alongside the momentum score out of 100.

快照

Row 3 — SQUEEZE: Active squeeze status with a visual strength bar (██████░░░░) showing current spread intensity relative to its recent range.

快照

Rows 4–9 — MTF OVERVIEW: Trend, spread, and grade for the current chart, 15m, 1H, 4H, and 1D timeframes.

快照

Row 10 — BIAS: Multi-timeframe confluence verdict with bull/bear count.

快照

🔹 SETTINGS

EMA Settings
▸ Fast / Mid / Slow EMA Period — Default 8/21/55. Periods must be in ascending order.
▸ Source — Close, Open, High, Low, HL2, HLC3, or OHLC4.

快照

Overlay Settings
▸ Background Transparency — Controls the intensity of the trend-colored chart background (0–99).
▸ Crossover Signals — Toggle the three-tier crossover markers.
▸ Ribbon Fill — Toggle the colored fill between EMA lines. Fill turns yellow during active squeeze.
▸ Dynamic EMA Colors — Toggle slope-based EMA coloring (green = rising, red = falling).
▸ Bar Coloring — Optional candle coloring by trend state and price position. Off by default.
▸ Squeeze Detection — Toggle squeeze markers and dashboard squeeze status.

Dashboard
▸ Table Size — Tiny, Small, Normal, or Large.
▸ Table Position — 8 positions (corners, centers, sides).

Thresholds
▸ Weak/Strong spread thresholds (%) — Define what constitutes a weak, moderate, or strong trend spread. These should be adjusted per asset class (e.g., lower for forex, higher for crypto).
▸ Squeeze Lookback — Number of bars used to calculate the average ribbon width for squeeze detection.
▸ Squeeze Ratio — The compression threshold. A ribbon narrower than this ratio × average width triggers a squeeze flag.


🔹 ALERTS

Nine configurable alert conditions:
▸ Bullish / Bearish EMA Crossover (any tier)
▸ Mid × Slow Bullish / Bearish Shift
▸ Bullish / Bearish Stack Formed
▸ Squeeze Detected (compression begins)
▸ Squeeze Released (expansion starts)
▸ High Momentum (score crosses above 80)

快照

🔹 SUGGESTED USE

This indicator works as a trend filter, not a standalone entry signal. Use it to:
▸ Confirm directional bias across timeframes before entering trades
▸ Identify compression phases where breakouts are likely
▸ Gauge trend quality and exhaustion via the momentum score and bar duration
▸ Filter crossover signals — a Fast × Mid cross during an active squeeze with MTF confluence is a higher-probability setup than the same cross in isolation

Pairs well with oscillators (RSI, Stochastic), volume-based indicators, or support/resistance tools for entry timing.

免責聲明

這些資訊和出版物並非旨在提供,也不構成TradingView提供或認可的任何形式的財務、投資、交易或其他類型的建議或推薦。請閱讀使用條款以了解更多資訊。