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

Volatility Squeeze Oscillator

334
Volatility Squeeze Oscillator

A volatility-regime tool that answers two questions in one pane: is the market coiled (a squeeze — volatility compressed and likely to expand), and when it releases, which way does it go? It measures compression as how low current volatility sits versus its own recent range, reads the release direction from where price sits in the band, and forward-calibrates whether squeeze releases actually pay on the chart you're viewing.

Why these parts are combined (not a mashup for show). A squeeze without a direction is half a tool; a direction without a squeeze is just momentum. Compression uses an exponentially-weighted volatility estimate (more weight on recent moves, so it reacts faster than a simple average) ranked against its own recent history — when it sits in the low percentile, volatility is unusually compressed. A relative test like this stays genuinely intermittent on any instrument; an absolute band-vs-band test drifts to "always on" or "never on" depending on the symbol. Release direction comes from a smoothed read of where price sits within an EWMA band. And forward calibration measures whether releases in each direction actually followed through on this symbol.

How it works. An EWMA volatility estimate is ranked against its own recent history; Squeeze ON = that rank is in the low percentile. The histogram is a smoothed read of where price sits inside an EWMA band (its sign = likely release direction). A signal fires when a squeeze releases in the histogram's direction. Each signal is labelled by a triple barrier — a profit target and equal stop in ATR units plus a time limit — split into in-sample and recent out-of-sample, with a confidence interval and a multiple-testing check.

How to use. Read the Verdict (Squeeze ON / Long release / Short release / Wait) and the Conviction, which reads "High" only when releases in that direction survive the test here — otherwise it openly says so. Histogram above zero = upward pressure inside the band; gold dots on the zero line mark squeeze-ON bars. Non-repainting. Best used with your own entry and risk plan, not alone.

Disclaimer: for research and education only. Not financial advice. Trading carries risk of loss; manage your own positions.
Release Note
Minor Update
Release Note
v1.1 — Calibration accuracy, performance, and a coil-duration read

More accurate short-side edge. The down-side base rate was previously approximated as 100 − up%. Because an ATR target and stop can both be touched on the same bar, that complement counted ties as "down" and understated the short edge. Down-outcomes are now counted independently from the same triple barrier, so the up and down edges are measured on identical terms. (Up% and Dn% may now sum to slightly under 100 — the small gap is the genuine tie fraction.)
Lighter and faster. The buy/sell branches were recomputing the exact triple barrier the base rate had already computed (same entry and ATR). They now reuse that single result, removing redundant work on every signal bar.
New: squeeze age + depth. The State row now shows how long the coil has held and how compressed it is (e.g. coiled 14b · p8) — a longer, deeper coil is the more notable setup. Also added as a SqueezeAge Data-Window export.
No changes to signals, inputs, or defaults; behaviour is otherwise identical.
Release Note
v1.1 — Finishing pass (no engine change)

- Added a Data Window (EXP_) export bus so the squeeze state, release direction and edge can feed
other scripts via input.source().
- Added a cost model: a new "Round-trip cost (R)" input and a Net R row. Conviction now requires a
squeeze release to BOTH beat its base rate (Wilson) AND survive costs — a gross edge that costs
eat through is not tradeable, and the panel now says so.
- Added the MPL-2.0 licence header.
- No change to the squeeze detection, release-direction logic or forward calibration — everyday
behaviour is identical.

Descriptive research tooling, in-sample statistics, not investment advice.

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

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