OPEN-SOURCE SCRIPT

Fib OTE + FVG Confluence [Viprasol]

1 265
Fib OTE + FVG Confluence [Viprasol] — high-probability ICT entries where two edges agree

═══════════════════════════════════════════════════════════
THE IDEA
═══════════════════════════════════════════════════════════

A Fair Value Gap is a good entry zone. An OTE (Optimal Trade Entry) retracement is a
good entry zone. But an FVG that sits INSIDE the OTE — that's the setup ICT traders
actually wait for. This tool maps the higher-timeframe OTE / premium-discount zone,
detects Fair Value Gaps, and does the one thing that matters: it highlights and ALERTS
you when price taps an FVG that lands inside the OTE.

═══════════════════════════════════════════════════════════
HOW IT WORKS
═══════════════════════════════════════════════════════════

1. HTF OTE MAP — From the previous candle range of your chosen higher timeframe
(non-repainting), it builds the Fibonacci map: the OTE band (default 0.618-0.786),
the equilibrium line (0.5) that splits premium from discount, and a directional bias
(Auto from the last HTF candle, or force Long/Short). In a long bias the OTE sits in
discount (below equilibrium) — where you want to buy; in a short bias it sits in
premium.

2. FAIR VALUE GAPS — Standard 3-candle imbalances (bullish `low > high[2]`, bearish
`high < low[2]`), with an optional displacement filter and a minimum-size filter to
cut noise. Each gap is drawn as a box and tracked until filled (Wick / Close /
Average mitigation).

3. CONFLUENCE — the point of the tool. A gap is "confluent" when it overlaps the OTE
band (strict) or, in the looser mode, when a bullish gap sits in discount / a bearish
gap sits in premium. Confluent gaps are highlighted with a ★. Turn on "Show ONLY
Confluent FVGs" and the chart reduces to just the high-probability zones.

4. ALERTS — Get notified when price TAPS a confluent FVG (and optionally when one
forms). One alert, delivered via app / email / SMS / webhook (Text or JSON message).

═══════════════════════════════════════════════════════════
ALERTS SETUP
═══════════════════════════════════════════════════════════

Create one alert → Condition: "Fib OTE + FVG Confluence" → "Any alert() function call",
then pick your delivery (app/email/SMS/webhook) in the dialog. Switch Message Format to
"JSON (webhook)" for bot/automation-friendly output. Messages carry direction, event
(FORMED/TAPPED), and the gap's price range.

═══════════════════════════════════════════════════════════
SETTINGS
═══════════════════════════════════════════════════════════

• HTF Fibonacci / OTE: timeframe, bias (Auto/Long/Short), OTE start/end, show map, colors.
• Fair Value Gaps: min gap %, displacement filter, fill mode, show-only-confluent, colors, box extend.
• Confluence & Alerts: confluence rule (Inside OTE / Favored half), highlight color, form/tap
alert toggles, frequency (once-per-bar-close = no repaint), Text/JSON.

═══════════════════════════════════════════════════════════
HOW TO USE
═══════════════════════════════════════════════════════════

1. Set the OTE higher timeframe (e.g. Daily on an intraday chart).
2. Let Auto bias pick direction, or force Long/Short to your plan.
3. Enable "Show ONLY Confluent FVGs" to see just gaps inside the OTE.
4. Create the alert and wait for a tap of a ★ confluent gap — that's your cue to do
your own analysis and manage risk.

═══════════════════════════════════════════════════════════
LIMITATIONS — PLEASE READ
═══════════════════════════════════════════════════════════

• This is an awareness / confluence tool, not a strategy or signal service — no buy/sell
calls. A confluent tap is a location of interest, not a guarantee.
• The OTE map uses the previous HTF candle range and updates as new HTF candles form;
it reflects current context, not a fixed historical grid.
• FVGs are detected on the chart timeframe; confluence is judged against the OTE active
when each gap forms.
• Not financial advice. Trade at your own risk.

═══════════════════════════════════════════════════════════
CREDITS & ORIGINALITY
═══════════════════════════════════════════════════════════

Fair Value Gaps, OTE, and premium/discount are public ICT concepts. All code here — the
non-repainting HTF OTE map, the FVG detection and mitigation, the confluence logic, and
the alert engine — is original Viprasol work written from the standard definitions. No
third-party Pine code is reused.

Thông báo miễn trừ trách nhiệm

Thông tin và các ấn phẩm này không nhằm mục đích, và không cấu thành, lời khuyên hoặc khuyến nghị về tài chính, đầu tư, giao dịch hay các loại khác do TradingView cung cấp hoặc xác nhận. Đọc thêm tại Điều khoản Sử dụng.