This Nifty strategy targets liquidity sweeps of the previous day's last 15-minute candle (PDH/PDL zone), entering on reversal confirmation for high-probability intraday trades. Use on 15min NIFTY charts during market hours (9:15 AM - 3:30 PM IST).
![]()
//@version=5
strategy("Nifty Previous Day Last 15min Liquidity Sweep", overlay=true, initial_capital=100000, default_qty_type=strategy.percent_of_equity, default_qty_value=1)
// Inputs
risk_pct = input.float(1.0, "Risk % per Trade")
rr_ratio = input.float(2.0, "Risk:Reward Ratio")
// Detect previous day (India time, NSE 9:15-15:30 IST)
is_new_day = ta.change(time("D"))
var float prev_day_zone_high = na
var float prev_day_zone_low = na
if is_new_day
prev_day_zone_high := high[1] // Last 15min high of prev day (on 15min chart)
prev_day_zone_low := low[1] // Last 15min low
// Plot zone
plot(prev_day_zone_high, "Prev Day High (Entry Zone)", color.red, 2)
plot(prev_day_zone_low, "Prev Day Low (Entry Zone)", color.green, 2)
fill(plot(prev_day_zone_high), plot(prev_day_zone_low), color.new(color.blue, 95), "Entry Zone")
// Liquidity Sweep: Price breaks beyond zone then reverses (close back inside with momentum)
bull_sweep = not na(prev_day_zone_high) and low < prev_day_zone_low and close > prev_day_zone_low // Sweep low, reverse up
bear_sweep = not na(prev_day_zone_high) and high > prev_day_zone_high and close < prev_day_zone_high // Sweep high, reverse down
// Entry on sweep confirmation (next candle close confirms reversal)
long_condition = bull_sweep[1] and close > open // Bullish candle after sweep
short_condition = bear_sweep[1] and close < open // Bearish candle after sweep
// Entries
if long_condition
strategy.entry("Long", strategy.long)
if short_condition
strategy.entry("Short", strategy.short)
// Risk Management
long_sl = prev_day_zone_low
long_tp = close + (rr_ratio * (close - long_sl))
short_sl = prev_day_zone_high
short_tp = close - (rr_ratio * (short_sl - close))
if strategy.position_size > 0
strategy.exit("Long Exit", "Long", stop=long_sl, limit=long_tp)
if strategy.position_size < 0
strategy.exit("Short Exit", "Short", stop=short_sl, limit=short_tp)
// Visuals
plotshape(long_condition, "Long Entry", shape.triangleup, location.belowbar, color.green, size=size.normal)
plotshape(short_condition, "Short Entry", shape.triangledown, location.abovebar, color.red, size=size.normal)
plotshape(bull_sweep, "Bull Sweep", shape.arrowdown, location.belowbar, color.orange)
plotshape(bear_sweep, "Bear Sweep", shape.arrowup, location.abovebar, color.orange)