OPEN-SOURCE SCRIPT

Schrodinger Zone Probability [JOAT]

2 366
SCHRÖDINGER ZONE PROBABILITY [JOAT]

The most quantitatively ambitious indicator in the JOAT suite. Detects Fair Value Gaps and Order Blocks the way a serious SMC engine should — and then, before they are touched, treats each one as a superposition zone with two simultaneous probabilities: P_S (the probability it will act as Support when revisited) and P_R (the probability it will act as Resistance). The two probabilities sum to one. The zone exists in a superposition of both states until price actually touches it; at that moment the wavefunction collapses to a single classical state — S or R — driven by the bars-after-touch confirmation logic. Then the script tags the zone with the committed direction and archives the collapse.

สแนปชอต

Detection — FVGs and OBs done properly

Two independent zone types feed the superposition engine:

  • Fair Value Gaps — the standard 3-candle imbalance definition, ATR-filtered (minimum gap = configurable × ATR, default 0.30×) so only meaningful gaps qualify. Bull and bear FVGs both detected.
  • Order Blocks — three methods exposed:
    • Last Opposite — latest opposite-color candle before displacement.
    • Extreme Opposite — most extreme (lowest low / highest high) candle in the walk-back window.
    • Strict Volume — Last Opposite filtered by volume above MA.


Displacement (the move that creates the zone) requires a body of displacement ATR multiple × ATR (default 1.20×). A configurable walk-back window controls how far back to search for the OB origin. Configurable mitigation rule (Wick = any pierce, Close = bar must close beyond).

The headline math — three-factor superposition probability

The collapse probabilities P_S / P_R are computed as a weighted blend of three orthogonal factors:

  • Distance factor — distance from current price to the zone, decayed exponentially with a configurable half-life in ATR units (default 2.0 ATR). Closer zones have higher commit probability.
  • Direction factor — which side of the zone current price is on. Above the zone leans the read toward Support collapse; below leans toward Resistance.
  • Flow factor — EMA-slope alignment over a configurable flow window (default 20 bars). Bullish flow biases toward Support; bearish flow biases toward Resistance.


Each factor's weight is independently tunable. Defaults (0.45 distance / 0.30 direction / 0.25 flow) are the script's institutional calibration. The output is two probabilities that sum to 1.

A zone with P_S ≈ P_R ≈ 0.5 is in pure superposition — the model is genuinely undecided. A zone with P_S = 0.85 / P_R = 0.15 is in a state nearly committed to Support; the wavefunction has already partly collapsed.

Wavefunction collapse — the engine's headline event

When price enters the zone within a configurable touch tolerance (default 0.05 × ATR slack) and holds inside for the configurable holdBars window (default 3 bars), the zone collapses to a single classical state:

  • Collapse to S — price bounced; the zone acted as Support. Marker prints "(+)→S" at the centroid.
  • Collapse to R — price was rejected from the other side; the zone acted as Resistance. Marker prints "(+)→R".


A configurable connector line is drawn at the committed level. Collapsed zones are optionally archived (default ON) so the chart shows the full history of how superpositions resolved.

Visual system — superposition rendering

  • Vertical gradient fill — each zone is rendered as a stack of N sub-boxes (configurable, default 8 slices) with progressive transparency, creating a vertical gradient that visually communicates "high probability of support at the bottom of the zone, high probability of resistance at the top". This is the script's signature visual.
  • Glow border — configurable glow intensity; becomes thicker when uncertainty is high (P_S ≈ P_R).
  • Animated superposition pulse — for zones in pure superposition (P ≈ 0.5), transparency oscillates with bar_index to indicate undecided state. Configurable period and amplitude.
  • Probability labels — P_S / P_R values printed on each active zone.
  • Zone type tags — FVG_BU, FVG_BE, OB_BU, OB_BE so origin is unambiguous.
  • Collapse markers — fancy glyphs (+)→S / (+)→R or plain S / R, configurable.
  • Show-only-superposition mode — hide collapsed and archived zones for a minimalist view.
  • Right extension — zones project a configurable number of bars to the right.


A locked institutional palette (cyan-teal bull / magenta bear) gives the chart a distinctive quantum-finance identity.

สแนปชอต

Dashboard

Monospaced table positionable to any of nine corners. Surfaces:

  • Active superposition zone count and archived count.
  • Nearest zone with its P_S / P_R values and distance.
  • Last collapse direction with bars-ago.
  • Current flow direction.
  • Detection thresholds and weights in use.
  • Mitigation rule.


Alerts

Multiple alert conditions:

  • New Superposition Zone Created (FVG or OB)
  • Collapse to Support
  • Collapse to Resistance
  • Approaching Zone (within collapse-touch tolerance)
  • High-Uncertainty Zone formed (P_S ≈ P_R ≈ 0.5)


How to read it

Three reads, in order of conviction:

  1. Collapse alert with extreme one-sided probability — e.g. a zone with P_S = 0.85 collapses to S. The model was confidently pointing at one outcome, and the market confirmed it. The highest-conviction confluence read the script produces.
  2. Approaching a zone with sharp probability bias — when P_S or P_R is dominant before touch, the model is committed to one direction. Position toward the dominant side; if the collapse confirms, you are in early.
  3. High-uncertainty zone (P ≈ 0.5) — stand-aside signal. The model is genuinely undecided; trade only with strong external confluence (HTF structure, news flow) or skip the zone entirely.


Suggested settings

Defaults (FVG ATR 0.30×, displacement 1.20×, OB Last-Opposite, 15-bar walk-back, weights 0.45 / 0.30 / 0.25, half-life 2.0 ATR, 3-bar hold) are tuned for 15m–4H on liquid markets. For lower timeframes drop displacement to 1.0× and hold to 2. For HTF raise FVG ATR to 0.50× to keep only large gaps. The weights are calibrated together — change one and the others rebalance the probabilities; experimenting with the weights is a legitimate way to specialise the script to your instrument.

Originality

The implementation — the dual-source zone detector (FVG + OB) with three OB methods, the three-factor probability blend (distance / direction / flow) with independent weights, the exponential ATR-halflife distance decay, the touch-with-hold collapse-confirmation state machine, the vertical-gradient zone render using N stacked sub-boxes, the uncertainty-modulated glow border, the animated superposition pulse for high-uncertainty zones, the archive-on-collapse logic, and the dashboard's probability-aware layout — is JOAT-original. No third-party code reused. The Schrödinger framing (superposition → collapse) is the original conceptual contribution; the math is purpose-built.

Limitations

The "probability" output is a heuristic blend of three factors that historically correlate with which side a zone acts as — it is a ranked confidence, not a true Bayesian posterior. The factor weights are exposed precisely because no single weighting is universally correct. The collapse confirmation requires the holdBars window to elapse, so collapse markers lag the actual touch by that window (intentional — single-bar pierces should not commit a zone). The animated pulse for high-uncertainty zones is purely visual.



-made with passion by jackofalltrades

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

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