OPEN-SOURCE SCRIPT
Support Resistance Zone Selvapandi

//version=5
indicator("Volume Footprint S/R Zones – Nifty (Syntax Safe)", overlay=true, max_boxes_count=300)
// ---------- Inputs ----------
volLen = input.int(50, "Volume MA Length")
volMult = input.float(1.8, "Volume Spike Multiplier", step=0.1)
bodyPctMin = input.float(0.6, "Impulse Body %", step=0.05)
atrLen = input.int(14, "ATR Length")
zoneATRmult = input.float(0.7, "Zone Height ATR Mult", step=0.1)
extendBars = input.int(200, "Extend Zones (bars)")
maxRetests = input.int(3, "Max Retests per Zone")
// ---------- Core Metrics ----------
volMA = ta.sma(volume, volLen)
atr = ta.atr(atrLen)
isVolSpike = volume > volMA * volMult
body = math.abs(close - open)
barRange = high - low
bodyPct = barRange > 0 ? body / barRange : 0.0
bullImpulse = close > open and bodyPct >= bodyPctMin and isVolSpike
bearImpulse = close < open and bodyPct >= bodyPctMin and isVolSpike
zoneSize = atr * zoneATRmult
// ---------- Storage ----------
var box[] zones = array.new_box()
var float[] zTop = array.new_float()
var float[] zBot = array.new_float()
var int[] zType = array.new_int()
var int[] zTests = array.new_int()
var bool[] zActive = array.new_bool()
// ---------- Create Zone Function ----------
create_zone(_top, _bot, _type) =>
b = box.new(bar_index, _top, bar_index + extendBars, _bot, bgcolor = _type == 1 ? color.new(color.green,85) : color.new(color.red,85), border_color = _type == 1 ? color.green : color.red)
array.push(zones, b)
array.push(zTop, _top)
array.push(zBot, _bot)
array.push(zType, _type)
array.push(zTests, 0)
array.push(zActive, true)
// ---------- Zone Creation ----------
if bullImpulse
create_zone(low + zoneSize, low, 1)
if bearImpulse
create_zone(high, high - zoneSize, -1)
// ---------- Zone Management ----------
longRetestSignal = false
shortRetestSignal = false
zoneCount = array.size(zones)
if zoneCount > 0
for i = 0 to zoneCount - 1
if array.get(zActive, i)
top = array.get(zTop, i)
bot = array.get(zBot, i)
typ = array.get(zType, i)
bx = array.get(zones, i)
touched = low <= top and high >= bot
if touched
tests = array.get(zTests, i) + 1
array.set(zTests, i, tests)
if tests <= maxRetests
if typ == 1
longRetestSignal := true
if typ == -1
shortRetestSignal := true
if typ == 1 and close < bot
array.set(zType, i, -1)
box.set_bgcolor(bx, color.new(color.orange,85))
box.set_border_color(bx, color.orange)
if typ == -1 and close > top
array.set(zType, i, 1)
box.set_bgcolor(bx, color.new(color.teal,85))
box.set_border_color(bx, color.teal)
if array.get(zTests, i) > maxRetests
array.set(zActive, i, false)
box.set_bgcolor(bx, color.new(color.gray,92))
box.set_border_color(bx, color.gray)
// ---------- Visual Signals ----------
plotshape(longRetestSignal, title="Support Retest", style=shape.triangleup, location=location.belowbar, color=color.lime, size=size.small)
plotshape(shortRetestSignal, title="Resistance Retest", style=shape.triangledown, location=location.abovebar, color=color.red, size=size.small)
// ---------- Alerts ----------
alertcondition(longRetestSignal, title="Support Zone Retest", message="Price retesting high-volume support zone")
alertcondition(shortRetestSignal, title="Resistance Zone Retest", message="Price retesting high-volume resistance zone")
indicator("Volume Footprint S/R Zones – Nifty (Syntax Safe)", overlay=true, max_boxes_count=300)
// ---------- Inputs ----------
volLen = input.int(50, "Volume MA Length")
volMult = input.float(1.8, "Volume Spike Multiplier", step=0.1)
bodyPctMin = input.float(0.6, "Impulse Body %", step=0.05)
atrLen = input.int(14, "ATR Length")
zoneATRmult = input.float(0.7, "Zone Height ATR Mult", step=0.1)
extendBars = input.int(200, "Extend Zones (bars)")
maxRetests = input.int(3, "Max Retests per Zone")
// ---------- Core Metrics ----------
volMA = ta.sma(volume, volLen)
atr = ta.atr(atrLen)
isVolSpike = volume > volMA * volMult
body = math.abs(close - open)
barRange = high - low
bodyPct = barRange > 0 ? body / barRange : 0.0
bullImpulse = close > open and bodyPct >= bodyPctMin and isVolSpike
bearImpulse = close < open and bodyPct >= bodyPctMin and isVolSpike
zoneSize = atr * zoneATRmult
// ---------- Storage ----------
var box[] zones = array.new_box()
var float[] zTop = array.new_float()
var float[] zBot = array.new_float()
var int[] zType = array.new_int()
var int[] zTests = array.new_int()
var bool[] zActive = array.new_bool()
// ---------- Create Zone Function ----------
create_zone(_top, _bot, _type) =>
b = box.new(bar_index, _top, bar_index + extendBars, _bot, bgcolor = _type == 1 ? color.new(color.green,85) : color.new(color.red,85), border_color = _type == 1 ? color.green : color.red)
array.push(zones, b)
array.push(zTop, _top)
array.push(zBot, _bot)
array.push(zType, _type)
array.push(zTests, 0)
array.push(zActive, true)
// ---------- Zone Creation ----------
if bullImpulse
create_zone(low + zoneSize, low, 1)
if bearImpulse
create_zone(high, high - zoneSize, -1)
// ---------- Zone Management ----------
longRetestSignal = false
shortRetestSignal = false
zoneCount = array.size(zones)
if zoneCount > 0
for i = 0 to zoneCount - 1
if array.get(zActive, i)
top = array.get(zTop, i)
bot = array.get(zBot, i)
typ = array.get(zType, i)
bx = array.get(zones, i)
touched = low <= top and high >= bot
if touched
tests = array.get(zTests, i) + 1
array.set(zTests, i, tests)
if tests <= maxRetests
if typ == 1
longRetestSignal := true
if typ == -1
shortRetestSignal := true
if typ == 1 and close < bot
array.set(zType, i, -1)
box.set_bgcolor(bx, color.new(color.orange,85))
box.set_border_color(bx, color.orange)
if typ == -1 and close > top
array.set(zType, i, 1)
box.set_bgcolor(bx, color.new(color.teal,85))
box.set_border_color(bx, color.teal)
if array.get(zTests, i) > maxRetests
array.set(zActive, i, false)
box.set_bgcolor(bx, color.new(color.gray,92))
box.set_border_color(bx, color.gray)
// ---------- Visual Signals ----------
plotshape(longRetestSignal, title="Support Retest", style=shape.triangleup, location=location.belowbar, color=color.lime, size=size.small)
plotshape(shortRetestSignal, title="Resistance Retest", style=shape.triangledown, location=location.abovebar, color=color.red, size=size.small)
// ---------- Alerts ----------
alertcondition(longRetestSignal, title="Support Zone Retest", message="Price retesting high-volume support zone")
alertcondition(shortRetestSignal, title="Resistance Zone Retest", message="Price retesting high-volume resistance zone")
오픈 소스 스크립트
트레이딩뷰의 진정한 정신에 따라, 이 스크립트의 작성자는 이를 오픈소스로 공개하여 트레이더들이 기능을 검토하고 검증할 수 있도록 했습니다. 작성자에게 찬사를 보냅니다! 이 코드는 무료로 사용할 수 있지만, 코드를 재게시하는 경우 하우스 룰이 적용된다는 점을 기억하세요.
면책사항
해당 정보와 게시물은 금융, 투자, 트레이딩 또는 기타 유형의 조언이나 권장 사항으로 간주되지 않으며, 트레이딩뷰에서 제공하거나 보증하는 것이 아닙니다. 자세한 내용은 이용 약관을 참조하세요.
오픈 소스 스크립트
트레이딩뷰의 진정한 정신에 따라, 이 스크립트의 작성자는 이를 오픈소스로 공개하여 트레이더들이 기능을 검토하고 검증할 수 있도록 했습니다. 작성자에게 찬사를 보냅니다! 이 코드는 무료로 사용할 수 있지만, 코드를 재게시하는 경우 하우스 룰이 적용된다는 점을 기억하세요.
면책사항
해당 정보와 게시물은 금융, 투자, 트레이딩 또는 기타 유형의 조언이나 권장 사항으로 간주되지 않으며, 트레이딩뷰에서 제공하거나 보증하는 것이 아닙니다. 자세한 내용은 이용 약관을 참조하세요.