//@version=5 strategy("Liquidity Sweep Scalping Strategy [Complete]", overlay=true, initial_capital=10000, default_qty_type=strategy.percent_of_equity, default_qty_value=10) // --- INPUTS --- tp_multiplier = input.float(3.0, title="Risk-to-Reward Target Multiplier") sl_buffer = input.float(1.0, title="Stop Loss Buffer (Ticks)") // --- MULTI-TIMEFRAME DATA (DAILY LEVELS) --- // Fetch previous day's high and low without repainting prev_high = request.security(syminfo.tickerid, "D", high[1], barmerge.gaps_off, barmerge.lookahead_on) prev_low = request.security(syminfo.tickerid, "D", low[1], barmerge.gaps_off, barmerge.lookahead_on) // Plot daily levels plot(prev_high, color=color.red, style=plot.style_linebr, title="Prev Day High") plot(prev_low, color=color.green, style=plot.style_linebr, title="Prev Day Low") // --- STATE VARIABLES --- var bool swept_high = false var bool swept_low = false // Reset sweep status on a new day bool new_day = ta.change(time("D")) != 0 if new_day swept_high := false swept_low := false // --- SWEEP & REVERSAL DETECTION (1-Minute Execution) --- // 1. Price sweeps above Daily High -> Looking for Short reversal if high > prev_high and not swept_high swept_high := true // 2. Price sweeps below Daily Low -> Looking for Long reversal if low < prev_low and not swept_low swept_low := true // --- EXECUTION LOGIC --- // Short Entry: After sweeping the high, look for a bearish candle confirmation bool bearish_confirmation = (close < open) and (close < low[1]) if swept_high and bearish_confirmation and strategy.position_size == 0 float entry_price = close float stop_loss = high + (sl_buffer * syminfo.mintick) float risk = stop_loss - entry_price float take_profit = entry_price - (risk * tp_multiplier) if risk > 0 strategy.entry("Sweep Short", strategy.short) strategy.exit("Short Exit", "Sweep Short", stop=stop_loss, limit=take_profit) // Long Entry: After sweeping the low, look for a bullish candle confirmation bool bullish_confirmation = (close > open) and (close > high[1]) if swept_low and bullish_confirmation and strategy.position_size == 0 float entry_price = close float stop_loss = low - (sl_buffer * syminfo.mintick) float risk = entry_price - stop_loss float take_profit = entry_price + (risk * tp_multiplier) if risk > 0 strategy.entry("Sweep Long", strategy.long) strategy.exit("Long Exit", "Sweep Long", stop=stop_loss, limit=take_profit)