OPEN-SOURCE SCRIPT

ATC Adaptive MA Ribbon

575
What It Is

The ATC Ribbon is a four-line moving average ribbon that automatically adjusts its sensitivity to match current market conditions. Unlike standard moving average ribbons that use fixed settings regardless of what the market is doing, the ATC Ribbon detects whether the market is trending, ranging, or transitioning — and tightens or widens the ribbon accordingly. The result is a cleaner, more responsive trend tool that reduces whipsaw in choppy conditions and stays tight to price during directional moves.

This is not a signal generator. It is a visual context engine — designed to answer one question at a glance: what is the market doing right now, and how strong is it doing it?

________________________________________

Who It's Built For

The ATC Ribbon is built for active traders working intraday to swing timeframes on futures, equities, and forex. It serves traders who use moving averages as part of their directional bias toolkit but are frustrated by the classic tradeoff: fast MAs that whipsaw in ranges, or slow MAs that lag behind trends.

If you've ever wished your moving average ribbon would behave differently in a trending market than a choppy one — without you having to manually change settings — this is what that looks like.

________________________________________

Core Concept

At its foundation, the ATC Ribbon plots four moving averages: one Hull Moving Average (HMA) as the fast lead line, and three Exponential Moving Averages (EMAs) at medium, slow, and anchor lengths. This fixed architecture — HMA + EMA + EMA + EMA — never changes. The MA types stay consistent so you always know what you're reading.

What adapts is the length configuration. The indicator runs a manual ADX calculation in the background to classify the current environment into one of three regimes:

Trend — ADX is elevated, confirming strong directional movement. The ribbon tightens by applying a multiplier below 1.0 to all lengths, making the MAs more responsive and keeping them close to price during runs.

Range — ADX is low, confirming a lack of directional conviction. The ribbon widens by applying a multiplier above 1.0, smoothing out noise and reducing false crossover signals during chop.

Transition — ADX sits between the two thresholds. The ribbon uses its base (default) lengths, representing a neutral stance while the market decides its next move.

All three ribbon configurations are precomputed on every bar. The indicator doesn't recalculate on the fly — it simply selects the appropriate pre-built set based on the current regime. This eliminates the instability and repainting issues that plague most "adaptive" moving average tools.

________________________________________

ATC Ribbon Upgrades Over Standard MA Ribbons

HMA Lead Line — The fast MA uses a Hull Moving Average instead of a standard EMA or SMA. HMA delivers significantly less lag at equivalent smoothing depth, giving you an earlier read on momentum shifts without adding noise.

Regime-Adaptive Lengths — Instead of one static ribbon that traders manually adjust for different conditions, the ATC Ribbon precomputes three discrete configurations and transitions between them using hysteresis-gated ADX classification. You get one ribbon that acts like three, without ever needing to touch your settings.

Hysteresis on Everything — Both the regime state and the alignment bias label are protected by hysteresis buffers. This means the indicator won't flicker back and forth at boundary values. A regime must clear its threshold by a user-defined margin before the indicator acknowledges the transition. The same logic applies to the bullish/bearish alignment label — it must hold its new state for a configurable number of bars before the HUD updates. This is the difference between a tool you can trust and one that makes you second-guess it.

Alignment Scoring — The ribbon doesn't just show four lines. It calculates a composite alignment score (0–100) based on two components: stack order (are the MAs properly sequenced from fast to slow?) and slope agreement (are all four MAs rising or falling together?). This score drives the ribbon color intensity and gives you a single number that quantifies how clean the current trend structure is.

________________________________________
Chart Visuals — What You'll See

The Four MA Lines — The fast HMA leads in a slightly thicker line. The medium and slow EMAs follow in thinner lines. The anchor EMA plots in a distinct darker blue, thicker line — it acts as your structural reference, similar to a 200 EMA.

Gradient Ribbon Fill — Between each adjacent pair of MAs, a semi-transparent fill creates a layered gradient effect. The fill between the fast and medium MA is the most opaque; the fill between the slow and anchor MA is the most transparent. This produces a ribbon that visually "fades" from the leading edge to the structural anchor, giving you an intuitive sense of ribbon width and separation at a glance.

Color — The entire ribbon shifts color based on the current alignment bias. Green when the stack and slope structure favors bullish. Red when it favors bearish. Blue when the alignment is neutral or transitional. The color intensity scales with the alignment score — a strong, well-ordered trend produces rich, saturated color; a weak or mixed alignment produces a muted, faded ribbon.

Regime Background Wash — A subtle background tint appears during confirmed Trend and Range regimes. In Trend, the background takes on the current ribbon color at very low opacity. In Range, it shifts to a neutral blue tint. This ambient visual cue lets you see the regime classification without looking at the HUD.

Regime Change Pulse — When the market transitions from one regime to another, a single-bar accent-colored background pulse fires. This is your visual alert that the ribbon just switched configurations.

________________________________________

The HUD — Your Dashboard at a Glance

The HUD is a compact table displayed in your chosen chart corner (default: top right) that reports five real-time data points:

Regime — Displays the current regime label (Trend, Range, or Transition) alongside the live ADX value. This tells you both what the indicator thinks the market is doing and why it thinks that.

Alignment — Shows the current directional bias: Bullish, Bearish, or Neutral. Color-coded to match the ribbon.

Score — The composite alignment score expressed as a value out of 100. A +87/100 in bullish alignment means 87% of the stack order and slope criteria favor upside. This number lets you gauge trend quality, not just trend direction.

Config — Displays the active regime multiplier and the four MA lengths currently in use (e.g., 0.70x | 6/15/35/140). This makes the adaptive behavior completely transparent — you always know exactly what settings the ribbon is running.

Price — Reports whether the current close is Above Anchor, Below Anchor, or Neutral relative to the anchor EMA. This is a fast structural reference — above anchor generally favors longs, below anchor generally favors shorts.

________________________________________

Logic Layers — How the Indicator Thinks

Layer 1: ADX Regime Detection — The indicator runs a full manual ADX calculation (not a black-box wrapper) and classifies the result against two user-defined thresholds. Below the Range threshold, the market is classified as ranging. Above the Trend threshold, it's classified as trending. Between the two, it's in Transition. A hysteresis buffer prevents the regime from flickering at the boundary.

Layer 2: Precomputed Ribbon Selection — All three ribbon configurations (Trend, Transition, Range) are computed on every bar. When the regime state changes, the indicator simply swaps which set of MA values it displays. There is no recalculation lag, no repainting, and no series-length instability.

Layer 3: Alignment Scoring — Eight binary criteria are evaluated: four for stack order (is fast above medium? medium above slow? slow above anchor? fast above anchor?) and four for slope (is each MA rising or falling compared to its prior bar?). Bullish criteria accumulate into a bull score, bearish criteria into a bear score. The higher score determines the bias, and the magnitude drives color intensity.

Layer 4: Hysteresis Gating — Both the regime label and the alignment bias label pass through hysteresis filters before updating. The regime requires ADX to clear its threshold by a configurable buffer before flipping. The alignment bias requires the new state to persist for a configurable number of bars before the HUD acknowledges it. This ensures that everything you see on the chart represents a confirmed state, not a marginal one.

________________________________________

Alerts

The ATC Ribbon includes seven configurable alert conditions:

• Entered Trend Regime — Fires when the market transitions into a confirmed Trend state.

• Entered Range Regime — Fires when the market transitions into a confirmed Range state.


• Entered Transition Regime — Fires when the market moves into the neutral Transition zone.

• Bullish Alignment — Fires when the ribbon alignment flips to Bullish after hysteresis confirmation.


• Bearish Alignment — Fires when the ribbon alignment flips to Bearish after hysteresis confirmation.

• Price Crossed Above Anchor — Fires when the close crosses above the anchor EMA.


• Price Crossed Below Anchor — Fires when the close crosses below the anchor EMA.

All alerts are one-per-event — they fire on the bar where the state change is confirmed, not on every bar where the condition is true.

________________________________________

How to Trade with the ATC Ribbon

Step 1 — Read the Regime. Before anything else, check the HUD or the background wash. If the market is in Trend regime, you're looking for continuation setups. If it's in Range regime, you're looking for mean-reversion or waiting for a breakout. If it's in Transition, stay patient — the market hasn't committed yet.

Step 2 — Check the Alignment. A Bullish alignment with a high score (above 70) tells you the ribbon is well-ordered and all four MAs are rising together. That's a clean trend structure. A Bearish alignment with a high score tells you the same thing to the downside. Neutral or low-score readings mean the trend structure is messy — be selective or wait.

Step 3 — Use the Anchor EMA as Your Structural Line. The anchor EMA (default 200-period, adjusted by regime) serves as your macro bias filter. Price above the anchor favors long setups. Price below favors shorts. This is not a signal — it's a filter that keeps you on the right side of the larger structure.

Step 4 — Look for Pullbacks into the Ribbon. In a confirmed Trend regime with strong alignment, the highest-probability entries come when price pulls back into the ribbon (toward the medium or slow EMA) and then resumes in the direction of the alignment. The ribbon acts as a dynamic support/resistance zone during trends.

Step 5 — Respect Range Regime Behavior. When the ribbon is in Range mode, it automatically widens to filter out noise. During these periods, the ribbon is telling you that directional conviction is low. Use this as a signal to reduce position sizing, tighten stops, or wait for a regime change. Forcing trend trades during a confirmed Range regime is fighting the indicator.

Step 6 — Watch for Regime Change Pulses. The single-bar background pulse that fires on regime transitions is one of the most actionable features. A shift from Range to Trend, confirmed by rising alignment score, is often the early signal that a new directional move is underway. These transitions are where the best risk/reward setups tend to form.

Step 7 — Combine with Your Edge. The ATC Ribbon is a context and bias tool, not a standalone entry signal. It's designed to be layered with your existing strategy — whether that's price action, volume analysis, key levels, or other indicators. Let the ribbon tell you what kind of market you're in and which direction it favors, then use your primary method to time the entry.

________________________________________

Settings Reference

Source — The price series used for all four MAs. Default: Close.

Base Lengths (Transition Regime) — The default MA lengths used during the Transition regime. Fast HMA: 9. Medium EMA: 21. Slow EMA: 50. Anchor EMA: 200. These are the "home base" settings that the Trend and Range multipliers adjust from.

ADX Length — The smoothing period for the ADX calculation. Default: 14. Higher values produce a slower, smoother regime classification.

Range Threshold — ADX below this value classifies the market as Range. Default: 15.0.

Trend Threshold — ADX above this value classifies the market as Trend. Default: 25.0.

ADX Hysteresis Buffer — The additional ADX distance required to exit a confirmed regime. Default: 2.0. Higher values make regime states stickier and reduce flicker.

Trend Regime Multiplier — Applied to all base lengths during Trend regime. Default: 0.70 (tightens the ribbon by 30%).

Range Regime Multiplier — Applied to all base lengths during Range regime. Default: 1.30 (widens the ribbon by 30%).

Alignment Hysteresis — Number of bars a new alignment bias must persist before the HUD and color update. Default: 2. Set to 0 for immediate updates.

Visual Toggles — Show/hide ribbon fill, MA lines, and regime background independently. All default to on.

________________________________________

Recommended Instruments and Timeframes

The ATC Ribbon is built and tested for: ES, NQ, YM, CL, GC, SPY, QQQ, major FX pairs, and large-cap stocks.

Recommended timeframes: 15-minute, 1-hour, 4-hour, and Daily. The regime detection and alignment scoring are calibrated for these intervals. Lower timeframes (1m, 5m) will produce more frequent regime changes and may require adjusted ADX thresholds. Higher timeframes (Weekly, Monthly) will work but regime transitions will be infrequent.

คำจำกัดสิทธิ์ความรับผิดชอบ

ข้อมูลและบทความไม่ได้มีวัตถุประสงค์เพื่อก่อให้เกิดกิจกรรมทางการเงิน, การลงทุน, การซื้อขาย, ข้อเสนอแนะ หรือคำแนะนำประเภทอื่น ๆ ที่ให้หรือรับรองโดย TradingView อ่านเพิ่มเติมใน ข้อกำหนดการใช้งาน