Strategy · Pine Script v6 · On the chart

Doc02 H1 Liquidity Sweep IFVG - Project Adapted

by Snappni

This strategy combines multi-timeframe trend bias, hourly liquidity sweeps, and lower-timeframe inversion fair value gap confirmations.

View on GitHub

Repaints

GitHub stars1on the repository
Pine versionv6current
Lines of code61
Settings6inputs
LicenceMIT
Last update4 months ago6 Jun 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

61 lines of Pine Script v6 from apps/server/src/pine-corpus/strategy-collection-adapted/02_一小时扫流动性IFVG_项目适配版.pine, published under MIT. Keep the author's credit and licence lines when you reuse it.

02_一小时扫流动性IFVG_项目适配版.pine
//@version=6
strategy("Doc02 H1 Liquidity Sweep IFVG - Project Adapted", overlay=true, pyramiding=0, initial_capital=10000)

// Source: user-provided strategy collection - strategy 2
// Logic summary:
// 1. Daily structure decides directional bias.
// 2. 1h must sweep liquidity against the daily direction and reclaim.
// 3. Runtime chart should be 5m. A simplified IFVG/reversal gap confirms entry.
// 4. Stop uses ATR. Target uses prior daily key price approximation.
// Compile confidence: 88/100. Profit confidence: 24/100.

dailyTf = input.timeframe("1d", "Daily trend timeframe")
sweepTf = input.timeframe("60", "Liquidity sweep timeframe")
atrLen = input.int(14, "ATR length", minval=1)
stopAtr = input.float(1.5, "Stop ATR", minval=0.1, step=0.1)
fallbackTargetAtr = input.float(3.0, "Fallback target ATR", minval=0.1, step=0.1)
minBodyRatio = input.float(0.45, "5m reversal body ratio", minval=0.1, maxval=1.0, step=0.05)

dHigh1 = request.security(syminfo.tickerid, dailyTf, high[1])
dHigh2 = request.security(syminfo.tickerid, dailyTf, high[2])
dLow1 = request.security(syminfo.tickerid, dailyTf, low[1])
dLow2 = request.security(syminfo.tickerid, dailyTf, low[2])
dClose1 = request.security(syminfo.tickerid, dailyTf, close[1])

dailyUp = dHigh1 > dHigh2 and dLow1 > dLow2
dailyDown = dHigh1 < dHigh2 and dLow1 < dLow2

h1Low = request.security(syminfo.tickerid, sweepTf, low)
h1High = request.security(syminfo.tickerid, sweepTf, high)
h1Close = request.security(syminfo.tickerid, sweepTf, close)
h1PrevLow = request.security(syminfo.tickerid, sweepTf, low[1])
h1PrevHigh = request.security(syminfo.tickerid, sweepTf, high[1])

longSweep = dailyUp and h1Low < h1PrevLow and h1Close > h1PrevLow
shortSweep = dailyDown and h1High > h1PrevHigh and h1Close < h1PrevHigh

barRange = math.max(high - low, syminfo.mintick)
bodyRatio = math.abs(close - open) / barRange

// Simplified IFVG: a displacement candle reclaims the previous imbalance side.
bullIfvg = low > high[2] and close > open and bodyRatio >= minBodyRatio
bearIfvg = high < low[2] and close < open and bodyRatio >= minBodyRatio

atr = ta.atr(atrLen)
longSignal = strategy.position_size == 0 and longSweep and bullIfvg
shortSignal = strategy.position_size == 0 and shortSweep and bearIfvg

if longSignal
    strategy.entry("Long", strategy.long)
if shortSignal
    strategy.entry("Short", strategy.short)

longStop = strategy.position_avg_price - atr * stopAtr
shortStop = strategy.position_avg_price + atr * stopAtr
longTarget = math.max(dHigh1, strategy.position_avg_price + atr * fallbackTargetAtr)
shortTarget = math.min(dLow1, strategy.position_avg_price - atr * fallbackTargetAtr)

if strategy.position_size > 0
    strategy.exit("Long Risk", "Long", stop=longStop, limit=longTarget)
if strategy.position_size < 0
    strategy.exit("Short Risk", "Short", stop=shortStop, limit=shortTarget)

Overview

Doc02 H1 Liquidity Sweep IFVG - Project Adapted determines daily trend direction using historical daily candles, checks for a 1-hour liquidity sweep and reclaim against that trend, and triggers entries on displacement candles with a specified body ratio. Risk management sets an ATR-based stop loss alongside targets derived from prior daily key levels or ATR fallbacks. Drawn overlaying the main price chart.

Details

Published by

Snappni on GitHub

Type

Strategy, Pine Script v6

Draws

On the price chart

Category

SMC / ICT / price action, Trend, Support & resistance

Markets

Any symbol

Timeframes

M1-M5, M15-H1

Risk Notes

  • Signals can change on the live bar or after it closes (repainting)

Settings

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

SettingTypeDefaultVariable
Daily trend timeframetimeframe1ddailyTf
Liquidity sweep timeframetimeframe60sweepTf
ATR lengthint14atrLen
Stop ATRfloat1.5stopAtr
Fallback target ATRfloat3.0fallbackTargetAtr
5m reversal body ratiofloat0.45minBodyRatio
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

FilledValueGap A006

by ruckard
13 stars

This strategy enters trades in the opposite direction of filled value gaps, operating under the assumption that price action will resume the primary trend after filling a recent gap. It plots directly on the main price chart and supports MA-based trend filters

Strategy v5 SMC / ICT / price actionTrend
Updated 1 year ago · None stated GitHub repository of FilledValueGap A006

This strategy identifies reversal opportunities based on liquidity sweeps and multi-gate confluence scoring. It evaluates setups using mandatory conditions such as swing sweeps, body and ATR filters, and dual EMA higher-timeframe trend alignment, alongside opt

Strategy v6 SMC / ICT / price actionTrend
Updated yesterday · MIT GitHub repository of Reversal Engine Score [WavesUnchained] Strategy

XXX

by MeridianAlgo
9 stars

This multi-timeframe scalping strategy plots moving averages alongside Smart Money Concepts elements on the price chart. It calculates trend signals using configurable moving average types like ALMA, Hull MA, or TEMA across alternate timeframes. It also plots

Strategy v5 TrendMoving averages Repaints
Updated 4 months ago · MIT GitHub repository of XXX

FVG Strategy

by muammeryldrm42
7 stars

Calculates three-bar Fair Value Gaps (FVG) and filters them using Average True Range. When price mitigates the FVG midpoint, the strategy enters a position in the direction of the gap, provided an optional EMA trend filter is satisfied. Exits are defined by an

Strategy v5 SMC / ICT / price actionSupport & resistance
Updated 3 months ago · MIT GitHub repository of FVG Strategy

NQ 9:45-10:15 ICT Strategy

by eddiebelaval
7 stars

This ICT-based strategy trades during the 9:45 AM to 10:15 AM New York session window. It calculates a daily bias using a 20-period daily EMA and tracks previous day highs and lows to identify liquidity sweeps. The script refines order block entry levels and m

Strategy v6 SMC / ICT / price actionSessions & time Repaints
Updated 3 months ago · None stated GitHub repository of NQ 9:45-10:15 ICT 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