//@version=5
indicator("SMC Liquidity Grab & Spring", overlay=true)
// స్వింగ్ పాయింట్స్ (Support & Resistance) కోసం లుక్ బ్యాక్ పీరియడ్
length = input.int(10, title="Swing Lookback")
// స్వింగ్ హై మరియు స్వింగ్ లో కాలిక్యులేషన్
swingHigh = ta.pivothigh(high, length, length)
swingLow = ta.pivotlow(low, length, length)
// పాత స్వింగ్ వాల్యూస్ స్టోర్ చేసుకోవడానికి వేరియబుల్స్
var float lastHigh = na
var float lastLow = na
if not na(swingHigh)
lastHigh := swingHigh
if not na(swingLow)
lastLow := swingLow
// Liquidity Grab (Bearish) - స్వింగ్ హై ని బ్రేక్ చేసి కింద క్లోజ్ అవ్వడం
bearishGrab = high > lastHigh and close < lastHigh and close[1] > lastHigh[1]
// Spring (Bullish) - స్వింగ్ లో ని బ్రేక్ చేసి పైన క్లోజ్ అవ్వడం (Absorption)
bullishSpring = low < lastLow and close > lastLow and close[1] < lastLow[1]
// చార్ట్ పైన సిగ్నల్స్ ప్లాట్ చేయడం
plotshape(bullishSpring, title="Spring", style=shape.labelup, location=location.belowbar, color=color.green, text="SPRING", textcolor=color.white, size=size.small)
plotshape(bearishGrab, title="Liquidity Grab", style=shape.labeldown, location=location.abovebar, color=color.red, text="LIQ GRAB", textcolor=color.white, size=size.small)
// రిఫరెన్స్ కోసం స్వింగ్ లెవెల్స్ ని లైన్స్ లా డ్రా చేయడం
plot(lastHigh, color=color.new(color.red, 70), title="Swing High Level")
plot(lastLow, color=color.new(color.green, 70), title="Swing Low Level")