OPEN-SOURCE SCRIPT

Regime Pressure Trail [ArisCodes]

419
REGIME PRESSURE TRAIL

This script is a regime-arbitrated trading framework, not a stack of two indicators. The core idea is that no single signal logic performs well across all market conditions — trend-following systems whipsaw in low volatility chop, while pressure-reading systems lag in clean directional trends. They have opposite failure modes, which means they have opposite ideal conditions. This script formalizes that observation by using a volatility regime classifier as a meta-controller that decides which of two child engines has authority to fire on any given bar.

━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

WHY ONE ENGINE IS NOT ENOUGH

Volatility is non-stationary. Markets cycle through quiet accumulation phases, expansive trending phases, and chaotic news-driven phases. A signal logic that performs well in one phase often produces its worst trades in another. Most retail attempts to solve this stack two indicators and let them fire independently — which is what this script explicitly avoids. Stacking creates conflicting signals and double-counts confluence. Arbitration solves it by making the regime itself the gatekeeper.

The trail-following child uses an ATR-based Chandelier exit with a self-adjusting multiplier (tight in quiet markets, wide in volatile markets) gated by a composite trend-strength score combining RSI slope acceleration, volume surge ratio, and ATR expansion. This logic targets clean directional moves with structural follow-through.

The pressure child uses cumulative delta volume crossing a moving average of itself, gated by a composite pressure score combining delta dominance, volume relative to its moving average, and candle body conviction. This logic targets institutional accumulation and distribution events that are often invisible to price-only signals.

━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

HOW THE COMPONENTS INTEGRATE

The volatility regime classifier computes the ratio of current ATR to its 50-bar simple moving average. This ratio places the market into one of three bins: LOW (ratio below 0.8 default), MEDIUM (between 0.8 and 1.4), or HIGH (above 1.4). The thresholds are user-tunable.

The arming logic translates regime to engine authority through three mutually exclusive modes. In Regime Arms mode, the LOW regime arms only the pressure engine because trend signals in contracting volatility are typically false flips. The HIGH regime arms only the trail engine because pressure crossovers in expanding volatility are typically lagging noise. The MEDIUM regime arms both, which lets either engine fire on the merits of its own scoring gate. In Confluence Required mode, both engines must produce the same direction signal on the same bar — a high-conviction filter that produces fewer trades. In Either Fires mode, the regime gating is disabled and the two engines compete on a first-come-first-served basis, which serves as a baseline for comparison.

When a signal fires, the entry routing is also engine-aware. Trail-engine entries use ATR-multiplier targets and inherit the trail line as a dynamic stop, with a force-exit if the trail flips against the position. Pressure-engine entries use fixed percentage targets and tighter stops because the edge they capture is shorter-duration. Confluence entries take whichever engine has the higher score at fire-time. This per-engine trade management is a deliberate design choice — it prevents the tighter-stop pressure logic from degrading trail-engine wins, and prevents the wider trail logic from giving back pressure-engine quick scalps.

━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

WHAT IS ORIGINAL HERE

The novel contribution is the arbitration layer, not the underlying engines. Both engines individually use components that are public knowledge — ATR Chandelier exits and cumulative volume delta have decades of literature behind them. What this script adds is the explicit codification of a meta-decision: which logic is allowed to operate in which regime, and why.

Specifically, the lines that prove this is arbitration rather than a stack are visible in source: a single boolean evaluates whether each engine's regime is currently armed, and signal logic is gated by those booleans before any other condition is checked. Two engines cannot fire on the same bar in Regime Arms mode by design. The script also tags each fired trade with its source engine, which allows post-hoc attribution analysis to verify the arbitration logic empirically.

━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

HOW TO USE

Begin with the default HYBRID mode and Regime Arms hybrid logic. Watch the dashboard for several sessions before changing inputs. The ARMED cell shows which engine has authority right now. The REGIME cell shows why. The TREND SCORE and PRESSURE SCORE cells show whether the armed engine has met its scoring gate.

When a signal fires, the entry label identifies which engine fired it (TRAIL, PRESSURE, or CONFLUENCE). This is critical for understanding the script. Over time, traders should observe that trail entries cluster in higher volatility regimes and pressure entries cluster in lower volatility regimes — that pattern confirms the arbitration is working as designed.

Adjust regime thresholds first if you find the script is firing too many trail signals (raise lowThresh to push more bars into LOW regime where trail is disarmed) or too few (lower lowThresh). Adjust score minimums second to filter quality. Adjust target percentages last and only after you have a clear picture of which engine is doing most of the work on your instrument and timeframe.

━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

INPUTS OVERVIEW

ENGINE SELECTION
Master mode (TRAIL ONLY, PRESSURE ONLY, HYBRID) and the hybrid arming logic (Regime Arms, Confluence Required, Either Fires).

TRAIL ENGINE
ATR length and source, regime classifier lookback, three vol-regime multipliers (LOW, MED, HIGH), two regime thresholds, minimum trend-strength score, RSI slope length, volume MA length.

PRESSURE ENGINE
Delta MA length, volume MA length, minimum pressure score, RSI length, RSI overbought and oversold filters.

TRADE MANAGEMENT
Independent TP and SL percentages per engine, ATR multiplier for trail-engine targets, max bars in trade, cooldown bars, trail-flip force-exit toggle.

VISUALS
Trail line plot, regime background tint, pressure-based candle coloring, gradient fill between price and VWAP, trade boxes, dashboard.

━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

DASHBOARD

The dashboard is the diagnostic display for the entire arbitration system. It sits at the bottom-center of the chart and updates only on the last bar to keep the chart clean. Reading it correctly is essential to understanding how the script makes decisions in real time.

The dashboard is organized as a 5-row table with 9 columns. Each row tells a different part of the story.

━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

ROW 1 — PRIMARY STATE

MODE — Shows your selected master engine mode: TRAIL ONLY, PRESSURE ONLY, or HYBRID. Color-coded — purple for HYBRID, teal for trail-only, gold for pressure-only.

ARMED — The most important cell on the dashboard. Tells you which engine is currently allowed to fire signals. Shows TRAIL, PRESSURE, BOTH, or NONE. In HYBRID mode this changes as volatility regime shifts.

REGIME — Current volatility regime: LOW ▼ (ratio under 0.8), MED ● (0.8 to 1.4), or HIGH ▲ (above 1.4). Includes the current ATR multiplier in use (1.5x, 2.5x, or 3.5x by default).

TREND SCORE — Composite score for the trail engine, displayed as an 8-segment gauge plus the numeric value 0-100. Combines RSI slope acceleration (40%), volume surge ratio (35%), and ATR expansion (25%). Below the minimum threshold the trail engine cannot fire.

PRESSURE — Composite score for the pressure engine, also 8-segment gauge plus 0-100 number. Combines delta dominance (40%), volume relative to MA (35%), and candle body conviction (25%). Below the minimum threshold the pressure engine cannot fire.

TRAIL — Current trail direction: BULL ▲ or BEAR ▼. This is the underlying ATR Chandelier state, independent of whether the trail engine is armed.

DELTA — Current bar's delta volume direction and percentage. BUY +X% means buyers dominated this bar, SELL -X% means sellers did.

POSITION — Current trade state: FLAT, LONG ●, or SHORT ●. When in a trade, also shows which engine fired it: TRAIL, PRESS, or BOTH.

STATUS — Cooldown / readiness state. READY means ready to fire, IN TRADE means active position, CD #b means waiting cooldown bars.

━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

ROW 2 — DETAIL VALUES

Mirrors row 1 with current values: actual mode name, armed engine name, regime label with multiplier, score gauges with numbers, trail direction with current trail price, delta percentage, position with engine tag, status text.

━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

ROW 3 — CONTEXT

HYBRID MODE — Which arming logic is active: Regime Arms / Confluence Required / Either Fires.

ARMING DETAIL — Shows current armed status of both engines as ON/OFF (Trail ON Press OFF means only trail engine has authority right now).

ATR RATIO — Numeric ratio of current ATR to its 50-bar moving average. The number that drives regime classification.

SCORE RATING — Trend score quality bucket: WEAK ░ / MEDIUM ◉ / STRONG ✦. With the current minimum threshold for reference.

PRESSURE RATING — Pressure state bucket: STRONG BULL ✦ / BULL ▲ / NEUTRAL ◉ / BEAR ▼ / STRONG BEAR ✦.

TRAIL PRICE — Current numeric trail level (the actual chart price).

RSI — Pressure engine's RSI value. Color-coded: bear if overbought, bull if oversold, neutral otherwise.

ENGINE USED — When in a trade, confirms which engine fired it. Useful for post-trade attribution.

COOLDOWN STATUS — Shows cooldown bars and max bars in trade for reference.

━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

ROW 4 — TRADE MANAGEMENT

POSITION — Repeats current direction for clarity in the trade row.

ENTRY — Exact entry price when in a trade.

TP — Take profit price (matches the chart line).

SL — Stop loss price (matches the chart line).

BARS — Bars elapsed since entry, plus max bars allowed.

ATR — Current ATR value in price units.

VWAP — Current session VWAP price (the gradient fill anchor).

REGIME — Active regime + current ATR multiplier (redundant for at-a-glance trade context).

━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

LEGEND OF SYMBOLS USED IN DASHBOARD

▲ ▼ — direction indicators (up/down, bull/bear)
● — active trade or filled state
◉ — medium/armed state
✦ — strong/active state
░ — weak state or empty gauge segment
█ — filled gauge segment
◈ — section divider in cell labels

━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

HOW TO READ THE DASHBOARD AT A GLANCE

1. Look at ARMED first — this tells you which engine has authority right now.
2. Look at REGIME — this tells you why the armed engine has authority.
3. Look at TREND SCORE and PRESSURE SCORE — these tell you whether the armed engine has met its scoring gate to fire.
4. Look at POSITION and STATUS — these tell you whether you are in a trade and which engine fired it.

If these four cells all line up cleanly, you understand the script's current state in under three seconds.

━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

snapshot

ENTRY LABELS — READING A FIRED SIGNAL

When a signal fires, an information-dense label appears at the entry bar showing every parameter of the trade in two lines. Reading the label is how you know what just happened without checking the dashboard.

LINE 1 — THE HEADER

▼ SELL PRESSURE 1:0.4 RR

▼ or ▲ — direction arrow (down for short, up for long)
SELL/BUY — trade direction in plain text
PRESSURE — the engine that fired this signal (TRAIL, PRESSURE, or CONFLUENCE)
1:X.X RR — risk-to-reward ratio at entry, calculated as |TP - entry| / |SL - entry|

LINE 2 — THE PRICE LEVELS

TP 27328.50 IN 27383.25 SL 27520.25

TP — the take profit price (matches the chart's TP line)
IN — the entry fill price (bar's close at signal fire)
SL — the stop loss price (matches the chart's SL line)

The label is color-coded by direction. Bear red background with bright bear text for SHORT entries. Bull green background with bright bull text for LONG entries. The same label format is used by every signal regardless of which engine fired it — only the engine tag in the header changes. That consistency means you can read any entry on the chart and immediately understand who fired, why, and at what risk.

━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

WHAT ELSE IS VISIBLE IN THE FRAME

The cyan stair-step line with node markers is the ATR trail line (Engine 1). Even when a trade is fired by the Pressure engine, the trail line remains plotted at all times so traders can see what the OTHER engine is doing in parallel. This is intentional — it lets you visually verify whether the two engines agree or disagree at any moment, and it shows the trail's chandelier behavior independently of whether it's currently armed.

The teal gradient fill between price and VWAP shows the cumulative pressure bias on the chart. A thicker fill above price means bull pressure is dominant. A thicker fill below price means bear pressure is dominant. The fill's intensity fades as conviction weakens.

Candles are tinted by their per-bar pressure score, with five intensity states ranging from STRONG BULL (bright teal) through BULL, NEUTRAL, BEAR, to STRONG BEAR (saturated red). This per-candle coloring lets you see institutional pressure at the bar level even when no signal has fired.

The bear or bull vertical line at the entry bar marks exactly when the signal fired. Combined with the small SELL or BUY pin under or above the candle, it creates a visual anchor point for the trade that's visible at any zoom level.

━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

NON-REPAINTING

All signals confirm on bar close. Volatility regime classification, both scoring engines, arming decisions, and entry/exit logic evaluate on confirmed bars only. Trade labels and state changes only fire after the bar has fully closed.

━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

DISCLAIMER

This script is for educational and informational purposes only. It is not financial advice. Past performance does not guarantee future results. Always use proper risk management and do your own research before making any trading decisions.

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.