OPEN-SOURCE SCRIPT

Ineficient market

806

The setup
The 1-2-3 pattern (price-structure reversal, in the Joe Ross / Zeiierman lineage) marks three alternating pivots: an extreme, a pullback, and a second extreme that fails to exceed the first — a Higher-Low for longs, a Lower-High for shorts. Entry fires on confirmation of the 3rd pivot (no waiting for a breakout, which cuts lag). On top of that sits a volatility gate: signals only trigger when relative volatility is compressed (ATR% ≤ its own moving average). Trades resolve on a small fixed TP, a wide SL, and a time-stop.

The inefficiency
This isn't about "predicting direction" — direction is free and doesn't pay. The edge is a short-term overreaction at structure pivots: after price prints a failed extreme, it tends to give back a small, fast fraction of the move. In compressed volatility that give-back is more reliable and less noisy. The edge is statistical and regime-conditional — not a silver bullet.

Why the exit looks "wrong" (and why that's the whole point)
The counterintuitive part: small TP + wide SL + no trailing, no break-even, no touching the trade. We tested active management extensively (move to BE, trailing, tight stops at the "normal MAE") and every version destroys the edge — because 1–3% adverse excursion is normal even on winners, and any tight stop sits exactly where noise wanders. Holding through that swing is what captures the reversion. It's fire-and-forget by design, not by laziness.

How we found it (the differentiator)
This wasn't reverse-engineered from a pretty chart. It survived:
- Random-matched placebo — the same exit engine fired on random bars vs. the real signal, proving the edge lives in the signal, not the short TP.
- Path-dependent backtesting — simulating the exact order of intra-trade events, not aggregate stats (which mislead).
- Conditional MAE analysis — measuring how win probability decays as a trade digs, which set the wide SL and killed the temptation of tight stops.

Inputs: prd (pivot lookback) · ATR ratio max (volatility gate) · TP % · SL % · time-stop · direction (long/short).

Disclaimer: For research/education, not financial advice. Past performance does not guarantee future results. The edge is conditional on regime and costs — test with your own commission/slippage before any live use.

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

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