OPEN-SOURCE SCRIPT
ที่อัปเดต:

Directional Bias, Flip & Continuation

804
█ OVERVIEW

Directional Bias, Flip & Continuation is a single decision instrument that answers one question at a time — "which side, and is this a FLIP (reversal) or a CONTINUATION?" — and draws the exact levels that define the read: Trigger, stop, and two targets. Its loudest and most frequent output is STAND ASIDE: by design it spends most of its time telling you there is no clean read, rather than manufacturing one. It issues no buy/sell order and makes no promise; the confidence it shows is an in-script, past-only forward self-test with a Wilson lower bound on THIS chart, not a trained probability.

█ HOW IT WORKS

The tool resolves ONE of four states each confirmed bar, in strict priority order, so the states never contradict each other:

STAND ASIDE (checked first, fires most) — a chaos / extreme-volatility regime, a toxic-tape reading, or price sitting mid-range with no level nearby. This is the default; it is information, not a failure.
FLIP — a confirmed swing trend-flip that occurs AT a graded major level, with order flow not strongly opposed. The side is the flip direction.
CONTINUATION — a trending regime PLUS a confirmed structural break carrying strength PLUS higher-timeframe agreement PLUS price not already stretched into a level. The side is the trend.
CONFLICT — the engines disagree; shown transparently, with no side taken.

Each stage names the method it uses, and every calibrated block shares one scale rather than being independent indicators bolted together:

Regime brain — efficiency ratio (fast vs slow) + ADX with separate trend and strong-trend floors + a self-excitation / volatility-cluster gauge + a variance-ratio random-walk test + an Ornstein-Uhlenbeck mean-reversion read. A trend must clear BOTH persistence (ER) and strength (ADX) floors, so ordinary chop never reads as a strong trend.
Flip engine — a swing-structure trend flip scored by a composite (structure, momentum, location) with a kill state that vetoes flips in the wrong regime.
Continuation engine — a convex-hull channel break, validated for strength and for higher-timeframe alignment, with a stretch guard so a break into an opposing level is not chased.
Levels & targets — a multi-anchor VWAP / anchored-volume-profile ladder that snaps the Trigger, stop and two targets to real liquidity rather than fixed multiples.
Barriers & confidence — a volatility-scaled, regime-asymmetric profit-target / stop geometry, and a forward reject-vs-continue self-test (two-barrier race) that reports each mode's hit rate with a Wilson 95% lower bound and against a matched base rate; it stays "uncalibrated / warming" until the sample is large enough.
Flow proxy — a lower-timeframe signed-volume CVD estimate (Bulk-Volume-Classification fallback) used only to veto a side that fights strong opposing flow; it abstains on no-volume symbols.

█ HOW TO USE

Read the panel top-down: the state (STAND ASIDE / FLIP / CONTINUATION / CONFLICT) and side, then the confidence line, then the four levels. When a FLIP or CONTINUATION is live, the Trigger / SL / TP1 / TP2 are the levels that define it; when the state is STAND ASIDE they read "—" on purpose. The confidence line shows that mode's own forward-tested floor with its sample size, and says "uncalibrated" until there is enough history — treat a warming or low-confidence read as a reason to wait. The dashboard defaults to Compact (state, side, confidence and the four levels only); switch Dashboard detail to Pro to add the regime, engine-agreement, flow-toxicity and free-text detail rows, and enable the backtest strip to see each mode's forward win% and average R. STAND ASIDE dominating the tape is the tool working, not failing. Horizon and position sizing are yours; it places no orders.

█ INPUTS

00 · Data & Source — price source, borrow-volume symbol for volume-less instruments.
01 · Regime brain — ER fast/slow horizons, ADX length and trend / strong-trend floors, ER floors, volatility-cluster length.
02–05 · Flip / Continuation / Structure — swing length, break validation, HTF timeframe and agreement, stretch guard.
06 · Levels & targets — VWAP / AVP anchors, ladder, snap tolerance, barrier multiples.
07 · Confidence & calibration — reject/continue barrier size, horizon, minimum sample, edge-gate window.
08 · Flow proxy — LTF granularity, classifier, toxicity gate.
09 · Display — dashboard detail (Compact default / Pro), backtest strip, regime breakdown, markers, panel position.
10 · Style — Dark / Light theme.

█ HONESTY & LIMITATIONS

This is a study, not a strategy. The confidence figure is an in-sample, descriptive, forward self-test on visible history with fixed barriers and no costs or slippage — it is not a backtest and not a probability of your next trade working. Order-flow side is an OHLCV estimate and abstains on symbols without volume. Non-repaint by construction: all higher- and lower-timeframe reads use lookahead-off; pivots confirm several bars late; the verdict, its levels, and the outcome tracking all resolve on confirmed bars only, and prior-period levels use the standard non-repainting prior-bar idiom. When the sample is small the confidence is shown as uncalibrated and the read is discounted; when there is no clean setup the tool says STAND ASIDE rather than inventing one. No edge shown is honest, not broken.

█ ORIGINALITY

One coherent decision object, not a signal stack. The original contribution is the strict-priority four-state resolution — STAND ASIDE is evaluated first and dominates, so FLIP and CONTINUATION can only fire when the regime, structure, location and flow all agree — paired with a per-mode confidence that is measured on the chart by a Wilson-bounded forward self-test rather than asserted. Each block (regime, flip, continuation, levels, barriers, flow) exists only to feed that single verdict and its levels; none is presented as a standalone indicator. That combination — a location-aware, regime-gated flip-vs-continuation decision that grades and honestly discounts its own confidence, and whose default answer is "stand aside" — is what distinguishes it from a trend filter, a breakout signal, or a bundle of oscillators.

█ CREDITS

Efficiency ratio — Kaufman. ADX / DMI — Wilder. Variance-ratio random-walk test — Lo & MacKinlay. Mean reversion — Ornstein & Uhlenbeck. Self-exciting clustering — Hawkes. Volume-weighted average price / value-area concepts — Market Profile lineage. Bulk Volume Classification — Easley, López de Prado & O'Hara. Trade-side tick rule — Lee & Ready (1991). Two-barrier forward test — López de Prado. Wilson score interval — Wilson (1927). Code written from scratch; no external script reused.

This script is for analysis and education. It is not financial advice.
Release Note
v0.3 — two order-flow reads folded into the decision core. (1) FLOW/PRICE LEAD-LAG (Lévy area, group 06): the signed area of the joint flow/price path reads WHO MOVES FIRST — FLOW leads (participation precedes price; breakouts better backed) vs PRICE leads (flow chasing; squeeze / stop-run). Shown on the panel, and used to suppress a "Chase break" continuation when price is leading — the failed-break trap. (2) MTF FLOW ALIGNMENT LADDER (group 10): a 3-rung agreement stack (chart + 3× + 5× multiples) of robust-z net-buying pressure with a fused 0–100 conviction — a proper multi-timeframe agreement read, richer than the two HTF bias frames. A flip or continuation is suppressed when the ladder is strongly opposed to it ("trade with the multi-timeframe flow"), shown as an "MTF flow" panel row and an M flag on the Agreement row. Both are single-instrument, self-calibrated and non-repainting (HTF pulled lookahead-off; Lévy on confirmed bars). Everything else — the four-state decision core, regime brain, flip and continuation engines, AEGIS barriers, Wilson confidence, levels and backtest strip — is unchanged. VPIN toxicity was already present and was not re-added. Reconstructed from LTF/HTF volume — an estimate, not the true tape; no Level-2 feed.

Educational / informational only — not financial advice, not a signal service, not a guarantee. Confidence and backtest figures are in-sample, fixed-barrier, no-cost readouts on this chart's own history — context, not a verified backtest.

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

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