//@version=5 strategy("Brad Gold Scalping Strategy", overlay=true, initial_capital=10000, default_qty_type=strategy.percent_of_equity, default_qty_value=10) // --- INPUTS --- i_rr = input.float(2.0, title="Risk-to-Reward Ratio", group="Risk Management") i_lookback = input.int(15, title="POI Lookback Period", group="Strategy Settings") // --- STEP 1: TREND ALIGNMENT (1H & 15M Simulation via Multi-Timeframe Security) --- // Fetch 1-hour and 15-minute trend direction [h1_close, h1_open] = request.security(syminfo.tickerid, "60", [close[1], open[1]], barmerge.gaps_off, barmerge.lookahead_off) [m15_close, m15_open] = request.security(syminfo.tickerid, "15", [close[1], open[1]], barmerge.gaps_off, barmerge.lookahead_off) bool h1_bullish = h1_close > h1_open bool h1_bearish = h1_close < h1_open bool m15_bullish = m15_close > m15_open bool m15_bearish = m15_close < m15_open bool trend_aligned_long = h1_bullish and m15_bullish bool trend_aligned_short = h1_bearish and m15_bearish // --- STEP 2 & 3: MAP POI & PATIENCE (Demand / Supply Zones) --- float demand_poi = ta.lowest(low, i_lookback) float supply_poi = ta.highest(high, i_lookback) bool at_demand_poi = low <= demand_poi + (ta.atr(14) * 0.5) bool at_supply_poi = high >= supply_poi - (ta.atr(14) * 0.5) // --- STEP 4: ENTRY MODEL (Liquidity Sweep & Confirmation) --- // Liquidity sweep: Price pushes past recent low/high and reverses var bool swept_low = false var bool swept_high = false if (low < ta.lowest(low, 5)[1] and close > ta.lowest(low, 5)[1]) swept_low := true swept_high := false if (high > ta.highest(high, 5)[1] and close < ta.highest(high, 5)[1]) swept_high := true swept_low := false // --- STEP 5: EXECUTION & TARGETS --- bool can_trade = strategy.position_size == 0 // Long Execution bool trigger_long = trend_aligned_long and at_demand_poi and swept_low if (can_trade and trigger_long) float entry_price = close float stop_loss = low[1] // Below protected sweep low float risk = entry_price - stop_loss float target = entry_price + (risk * i_rr) if (risk > 0) strategy.entry("Gold Long", strategy.long) strategy.exit("TP/SL Long", "Gold Long", stop=stop_loss, limit=target) swept_low := false // Short Execution bool trigger_short = trend_aligned_short and at_supply_poi and swept_high if (can_trade and trigger_short) float entry_price = close float stop_loss = high[1] // Above protected sweep high float risk = stop_loss - entry_price float target = entry_price - (risk * i_rr) if (risk > 0) strategy.entry("Gold Short", strategy.short) strategy.exit("TP/SL Short", "Gold Short", stop=stop_loss, limit=target) swept_high := false