Strategy · Pine Script v6 · On the chart

PF probe liquidity-sweep-probe-01-pivot-swing

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

This strategy confirms swing pivot highs and lows and compares each new pivot with the previous swing of the same type.

View on GitHub

GitHub stars1on the repository
Pine versionv6current
Lines of code58
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

58 lines of Pine Script v6 from validation/composite-liqsweep-pivot-hh-ll-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-01-pivot-swing — directional swing-structure
// Clean-room: written from validation goal, not from source.
//
// Purpose: isolates pivot-high/low detection plus a higher-high / lower-low
// directional confirm. The engine surfaces under test are `ta.pivothigh` /
// `ta.pivotlow` and the cross-bar `var float` previous-swing tracking used
// to classify each newly confirmed pivot as a higher-high, lower-high,
// higher-low, or lower-low. Entries fire on the rising edge of a confirmed
// higher-high (long) or lower-low (short).
//
// Validation goal: bit-exact entries on confirmed HH/LL events. Pass =
// identical trade list vs TradingView's broker emulator.
//
// 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-01-pivot-swing", shorttitle="PF_lsp01_SWG",
     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 detection ----------------------------------------------
float ph = ta.pivothigh(high, i_left, i_right)
float pl = ta.pivotlow(low,   i_left, i_right)

// ---- last-confirmed swings ----------------------------------------
var float last_ph = na
var float prev_ph = na
var float last_pl = na
var float prev_pl = na

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

// ---- HH / LL events -----------------------------------------------
bool higher_high = not na(ph) and not na(prev_ph) and ph > prev_ph
bool lower_low   = not na(pl) and not na(prev_pl) and pl < prev_pl

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

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

Overview

PF probe liquidity-sweep-probe-01-pivot-swing draws on the price chart. A long entry fires when a confirmed pivot high is a higher high and the position is flat or short. A short entry fires when a confirmed pivot low is a lower low and the position is flat or long. Left and right bar inputs set how many bars a pivot needs before confirmation. There is no stop loss, take profit, or separate exit; the opposite signal reverses a one-contract position.

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

Support & resistance, Trend

Markets

Crypto

Timeframes

M15-H1

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

This trend-following strategy executes a classic Donchian channel breakout system designed to cross-validate backtest results against external framework benchmarks. It triggers a long entry when the closing price breaks above the highest high of the prior entr

Strategy v6 BreakoutTrend
Updated today · AGPL-3.0 GitHub repository of Forven S01509 - Simple Donchian 20/10 Breakout

Omar Edited WF

by Alorse
330 stars

Omar Edited WF is a trading strategy overlay built around Williams Fractals and multiple Exponential Moving Averages. It detects high and low fractal pivot points over configurable lookback periods alongside three adjustable EMA trendlines. Long entries are ma

Strategy v5 TrendMoving averages
Updated 2 months ago · None stated GitHub repository of Omar Edited WF
257 stars

This strategy calculates dynamic support and resistance levels using pivot highs and lows alongside a custom smoothed trend filter and a 3-period EMA. It identifies entry opportunities when price breaks out relative to the trend filter and short-term EMA cross

Strategy v5 TrendSupport & resistance Repaints
Updated 6 weeks ago · None stated GitHub repository of 30s - ES 1m Strategy Candle Bar
106 stars

This overlay strategy plots a two-timeframe Ichimoku setup on the price chart, with Tenkan, Kijun, Chikou, and Kumo from a base higher timeframe and an optional highest-timeframe cloud. It allows two entries in the same direction and uses ATR-based trailing st

Strategy v4 TrendVolatility & bands
Updated 2 years ago · GPL-3.0 GitHub repository of 2Tier Ichimoku Pyramiding [Takazudo]
104 stars

This strategy combines three Exponential Moving Averages with Williams Fractals to execute trend-following or mean-reverting trades. It analyzes price structure using short, medium, and long-term EMAs along with fractal highs and lows. Entries trigger when fra

Strategy v5 TrendMoving averages
Updated 3 years ago · MIT GitHub repository of 3MA and Fractals Strategy

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