Strategy · Pine Script v6 · On the chart

PF probe liquidity-sweep-probe-03-reentry-on-sweep

by pineforge-4pass· code credited to PineForge contributors 2026

This strategy tracks liquidity sweeps across pivot highs and lows to trigger delayed reversal entries.

View on GitHub

GitHub stars1on the repository
Pine versionv6current
Lines of code73
Settings2inputs
LicenceApache-2.0
Last update5 days ago23 Oct 2026

Add It to Your TradingView Chart

  1. 1Copy the scriptPress Copy script above, or the copy button on the code below.
  2. 2Open the Pine EditorOpen a TradingView chart and choose Pine Editor at the bottom of the screen.
  3. 3Paste over the templateCreate a new strategy, select all of the template text and paste. Press Save and give it a name.
  4. 4Add it to the chartPress Add to chart. The trades and results appear in the Strategy Tester tab; adjust the settings with the gear icon.

Source Code

73 lines of Pine Script v6 from validation/composite-liqsweep-wait-one-continuation-01/strategy.pine, published under Apache-2.0. Keep the author's credit and licence lines when you reuse it.

strategy.pine
// This Pine Script® code is licensed under Apache-2.0
// SPDX-License-Identifier: Apache-2.0
// © PineForge contributors 2026
//
// PF probe liquidity-sweep-probe-03-reentry-on-sweep — wait-one + continuation
// Clean-room: written from validation goal, not from source.
//
// Purpose: isolates a delayed entry after a sweep confirms — detect the
// sweep on bar N, wait one bar, enter on the continuation bar (N+2) only
// if its close confirms the sweep direction. The engine surfaces under
// test are pivot retention plus a small `var int` countdown latch that
// expires after one bar; this validates both `var` state semantics and
// the engine's handling of multi-bar entry preconditions.
//
// Validation goal: bit-exact entries placed exactly two bars after a
// sweep (sweep at N, wait one bar at N+1, continuation entry at N+2 if
// the continuation candle confirms direction). Pass = identical trade
// list vs TradingView.
//
// TV setup: 15m chart, ETH-USDT-USDT (Binance USDT-M Perpetual). Full window
// matching corpus/data/ohlcv_ETH-USDT-USDT_15m.csv. Strategy properties:
// leave defaults from script header. Export "List of trades" → tv_trades.csv.
//@version=6
strategy("PF probe liquidity-sweep-probe-03-reentry-on-sweep", shorttitle="PF_lsp03_REE",
     overlay=true, initial_capital=1000000,
     commission_type=strategy.commission.percent, commission_value=0,
     slippage=0, default_qty_type=strategy.fixed, default_qty_value=1,
     pyramiding=1, process_orders_on_close=false)

// ---- inputs --------------------------------------------------------
int i_left  = input.int(5, "Pivot left bars",  minval=1)
int i_right = input.int(5, "Pivot right bars", minval=1)

// ---- pivot tracking -----------------------------------------------
float ph = ta.pivothigh(high, i_left, i_right)
float pl = ta.pivotlow(low,   i_left, i_right)

var float last_ph = na
var float last_pl = na

if not na(ph)
    last_ph := ph
if not na(pl)
    last_pl := pl

// ---- sweep detection ----------------------------------------------
bool sweep_high = not na(last_ph) and high > last_ph and close < last_ph
bool sweep_low  = not na(last_pl) and low  < last_pl and close > last_pl

// ---- one-bar wait latches -----------------------------------------
var int wait_long  = 0
var int wait_short = 0

if sweep_low
    wait_long := 1
else if wait_long > 0
    wait_long := wait_long - 1

if sweep_high
    wait_short := 1
else if wait_short > 0
    wait_short := wait_short - 1

// ---- continuation gates (fire when latch was just decremented to 0)
bool fire_long  = wait_long  == 0 and wait_long[1]  == 1 and close > open
bool fire_short = wait_short == 0 and wait_short[1] == 1 and close < open

// ---- order routing -------------------------------------------------
if fire_long and strategy.position_size <= 0
    strategy.entry("L", strategy.long, qty=1, comment="reentry long")

if fire_short and strategy.position_size >= 0
    strategy.entry("S", strategy.short, qty=1, comment="reentry short")

Overview

PF probe liquidity-sweep-probe-03-reentry-on-sweep identifies pivots based on configurable left and right bar lengths and records sweeps when the price breaches a pivot but closes back inside it. Upon detecting a sweep, the strategy counts down a one-bar delay and enters a position on the following candle if the candle's close confirms the sweep's direction. Entries execute on the price chart, reversing any active opposing positions without defined stop-loss or take-profit orders.

Details

Published by

pineforge-4pass on GitHub

Code credit

PineForge contributors 2026, as written in the script's header

Type

Strategy, Pine Script v6

Draws

On the price chart

Category

SMC / ICT / price action, Support & resistance, Mean reversion

Markets

Any symbol

Timeframes

Any timeframe

Risk Notes

  • The strategy enters trades without a stop loss

Topics

algorithmic-tradingbacktestingparitypine-scriptpinescriptquantitative-financetest-corpustradingview

Settings

The inputs you can change from the gear icon on the chart. Defaults are the author's.

SettingTypeDefaultVariable
Pivot left barsint5i_left
Pivot right barsint5i_right
Third-party code. ForexR did not write, test or endorse this script, and the summary above was generated automatically from its code and README. Indicators describe the past, and a strategy's backtest can look better than live trading, especially when a script repaints. Check it in the Strategy Tester and on a demo account before you rely on it.

Similar Pine Scripts

FairValueGap E003

by ruckard
13 stars

Calculates the distance between the current price and the opposite end of the latest fair value gap, entering trades on the expectation that price will partially fill the gap. It incorporates risk management with customizable stop loss, take profit based on ri

Strategy v5 SMC / ICT / price actionSupport & resistance
Updated 1 year ago · None stated GitHub repository of FairValueGap E003

Wyckoff Phase

by muammeryldrm42
7 stars

This strategy identifies Wyckoff consolidation ranges directly on the price chart to trade potential spring and upthrust events. It calculates highest highs and lowest lows over a customizable lookback period, filtering setups by average volume spikes and ATR

Strategy v5 SMC / ICT / price actionSupport & resistance
Updated 3 months ago · MIT GitHub repository of Wyckoff Phase
1 stars

This Pine Script strategy detects ICT smart money concepts including order test zones, fair value gaps, and wicks on BTC and XAUUSD price charts. It calculates swings using pivot high and low. Signals enter long or short when the order test zone is hit with su

Strategy v5 SMC / ICT / price actionCandlestick patterns
Updated 6 months ago · None stated GitHub repository of ICT v4-weinkya BTC Improved

SMC + VWAP Edge Strategy

by StockPro-AI
1 stars

This strategy combines Smart Money Concepts with Order Blocks and Fair Value Gaps alongside multiple VWAP levels including session, weekly, monthly, and anchored variants. It detects confluence zones to generate long and short entry signals on the price chart.

Strategy v6 SMC / ICT / price actionSupport & resistance
Updated 6 months ago · None stated GitHub repository of SMC + VWAP Edge Strategy
330 stars

This strategy divides a fixed price range between an upper and a lower limit into equally spaced grid levels and plots them on the price chart. It marks a buy when price crosses down through a grid and a sell when price crosses up through a grid, using either

Strategy v5 Support & resistanceMean reversion Repaints
Updated 2 months ago · None stated GitHub repository of Grid Bot Simulator [Alorse]

More strategys

Trade Your Charts With a Regulated Broker

Compare brokers that connect to TradingView, with spreads, minimum deposits and leverage side by side.

Compare brokers