All work
Pine Script

ICT OTE + FVG Backtester with Bias Engines and Filters

A client's ICT rulebook (4H optimal-trade-entry fib, fair-value gaps, bias tiers, news and SMT filters) as a Pine v6 strategy with a design pass.

All rules written once in direction space, non-repainting higher-timeframe reads, an NFP/FOMC news filter where Pine has no calendar, a second bias engine ported from the client's own script, blocked-trade labels and a sectioned dashboard across three versions.

ICT OTE + FVG Backtester with Bias Engines and Filters — illustration
What makes it serious
  • Direction-space rules: one implementation for long and short
  • Non-repainting HTF reads throughout
  • Second bias engine ported 1:1 from the client's script, v1 trades preserved
  • Filter-blocked setups labelled on chart

The client's document described an ICT-style system: a 4-hour optimal-trade-entry Fibonacci zone, fair-value gaps, a weekly and daily bias engine, killzone sessions, and news and smart-money-divergence filters. It asked for Pine v5; v6 was delivered. Every long and short rule is written once in "direction space" (price times direction), which halves the code and the bugs. Higher-timeframe functions return the prior bar and are read with lookahead so nothing repaints.

Pine has no economic calendar, so the news filter is explicit: a first-Friday NFP rule, hard-coded FOMC dates through 2026 and a custom date list input, and the client was told plainly that this is the limit. Interpretations that the brief left open (percent-of-range targets, the deep-zone toggle, what happens when a limit is touched while filters block) are listed so the client can change them.

Version three added a design pass with fills, right-edge tags, "no trade: blocked by filter" labels and a sectioned dashboard, plus a second bias engine ported one-to-one from the client's own script (weekly body DNA, daily external and internal change-of-character with tiered thresholds). The original engine remains selectable and reproduces the first version's trades exactly. Two Pine traps are recorded: strategies only draw last-bar blocks on confirmed history, and a concurrent automation session can hijack the first chart tab, so pushes are guarded by checking the editor header.

How it works

  1. Bias engine sets direction from weekly and daily structure
  2. 4H OTE zone and FVGs are located in direction space
  3. Session, news and SMT filters gate the setup
  4. Limit entry, stop and tiered targets manage the trade
  5. Dashboard and labels explain every taken and blocked setup
Stack
Pine Script v6TradingView DesktopCDP

Software and automation are infrastructure, not financial advice. No performance guarantees. Every live system needs staged testing, risk limits, and owner approval.

#pine-script#ict#fvg#strategy#client#backtesting