//@version=5 indicator("Price Action Structure & Rejections", overlay=true) // --- 1. MARKET STRUCTURE (Swing Highs & Lows) --- // Lookback period for finding swings lb = input.int(5, title="Swing Lookback Period") sw_high = ta.pivothigh(high, lb, lb) sw_low = ta.pivotlow(low, lb, lb) plotshape(sw_high, title="Swing High", style=shape.labeldown, location=location.abovebar, color=color.red, text="LH/SH", textcolor=color.white, offset=-lb) plotshape(sw_low, title="Swing Low", style=shape.labelup, location=location.belowbar, color=color.green, text="HL/SL", textcolor=color.white, offset=-lb) // --- 2. REJECTION WICK (Long Wick / Pinbar) DETECTION --- // Inputs for wick ratio body_size = math.abs(close - open) total_range = high - low upper_wick = high - math.max(open, close) lower_wick = math.min(open, close) - low // Conditions: Wick is at least 60% of the total candle range, body is small is_long_upper_wick = (upper_wick >= total_range * 0.6) and (body_size <= total_range * 0.3) is_long_lower_wick = (lower_wick >= total_range * 0.6) and (body_size <= total_range * 0.3) plotshape(is_long_upper_wick, title="Bearish Rejection Wick", style=shape.triangledown, location=location.abovebar, color=color.red, size=size.small) plotshape(is_long_lower_wick, title="Bullish Rejection Wick", style=shape.triangleup, location=location.belowbar, color=color.green, size=size.small)