OPEN-SOURCE SCRIPT
Auto Volume Footprint S/R ZONES PRO

//version=5
indicator("Auto Volume Footprint S/R ZONES PRO", overlay=true, max_boxes_count=200)
// ————— Inputs
volMult = input.float(1.8, "Volume Spike Multiplier", step=0.1)
rangeMult = input.float(1.4, "Range Spike Multiplier", step=0.1)
pivotLen = input.int(3, "Pivot Length")
atrMult = input.float(0.4, "Zone Thickness ATR Mult", step=0.1)
extendRight = input.int(300, "Extend Bars Right")
minScore = input.float(1.2, "Min Volume Score Filter")
showLabels = input.bool(true, "Show Strength Labels")
enableAlerts = input.bool(true, "Enable Retest Alerts")
// ————— Base Metrics
avgVol = ta.sma(volume, 20)
avgRange = ta.sma(high-low, 20)
atr = ta.atr(14)
volScore = volume / avgVol
rangeScore = (high-low) / avgRange
volSpike = volScore > volMult
rangeSpike = rangeScore > rangeMult
pivotH = ta.pivothigh(high, pivotLen, pivotLen)
pivotL = ta.pivotlow(low, pivotLen, pivotLen)
priceBasis = (high + low + close*2) / 4
zoneHalf = atr * atrMult
// ————— Storage
var box[] zones = array.new_box()
var float[] tops = array.new_float()
var float[] bots = array.new_float()
// ————— Function create zone
createZone(_top, _bot, _color, _score) =>
b = box.new(bar_index-pivotLen, _top, bar_index+extendRight, _bot,
bgcolor=color.new(_color, 85),
border_color=_color)
array.push(zones, b)
array.push(tops, _top)
array.push(bots, _bot)
if showLabels
label.new(bar_index-pivotLen, _top,
text="Score "+str.tostring(_score, format.mintick),
style=label.style_label_down,
color=_color,
textcolor=color.white,
size=size.tiny)
// ————— Resistance Zone
if not na(pivotH) and volSpike[pivotLen] and rangeSpike[pivotLen] and volScore[pivotLen] > minScore
p = priceBasis[pivotLen]
top = p + zoneHalf
bot = p - zoneHalf
createZone(top, bot, color.red, volScore[pivotLen])
// ————— Support Zone
if not na(pivotL) and volSpike[pivotLen] and rangeSpike[pivotLen] and volScore[pivotLen] > minScore
p = priceBasis[pivotLen]
top = p + zoneHalf
bot = p - zoneHalf
createZone(top, bot, color.green, volScore[pivotLen])
// ————— Zone Maintenance + Break Detection
breakBuf = atr * 0.25
for i = 0 to array.size(zones)-1
z = array.get(zones, i)
t = array.get(tops, i)
b = array.get(bots, i)
broken = close > t + breakBuf or close < b - breakBuf
if broken
box.set_border_color(z, color.gray)
box.set_bgcolor(z, color.new(color.gray, 90))
// ————— Retest Alert Logic
retest = false
for i = 0 to array.size(tops)-1
t = array.get(tops, i)
b = array.get(bots, i)
if low <= t and high >= b
retest := true
alertcondition(enableAlerts and retest, "Zone Retest", "Price retesting volume S/R zone")
indicator("Auto Volume Footprint S/R ZONES PRO", overlay=true, max_boxes_count=200)
// ————— Inputs
volMult = input.float(1.8, "Volume Spike Multiplier", step=0.1)
rangeMult = input.float(1.4, "Range Spike Multiplier", step=0.1)
pivotLen = input.int(3, "Pivot Length")
atrMult = input.float(0.4, "Zone Thickness ATR Mult", step=0.1)
extendRight = input.int(300, "Extend Bars Right")
minScore = input.float(1.2, "Min Volume Score Filter")
showLabels = input.bool(true, "Show Strength Labels")
enableAlerts = input.bool(true, "Enable Retest Alerts")
// ————— Base Metrics
avgVol = ta.sma(volume, 20)
avgRange = ta.sma(high-low, 20)
atr = ta.atr(14)
volScore = volume / avgVol
rangeScore = (high-low) / avgRange
volSpike = volScore > volMult
rangeSpike = rangeScore > rangeMult
pivotH = ta.pivothigh(high, pivotLen, pivotLen)
pivotL = ta.pivotlow(low, pivotLen, pivotLen)
priceBasis = (high + low + close*2) / 4
zoneHalf = atr * atrMult
// ————— Storage
var box[] zones = array.new_box()
var float[] tops = array.new_float()
var float[] bots = array.new_float()
// ————— Function create zone
createZone(_top, _bot, _color, _score) =>
b = box.new(bar_index-pivotLen, _top, bar_index+extendRight, _bot,
bgcolor=color.new(_color, 85),
border_color=_color)
array.push(zones, b)
array.push(tops, _top)
array.push(bots, _bot)
if showLabels
label.new(bar_index-pivotLen, _top,
text="Score "+str.tostring(_score, format.mintick),
style=label.style_label_down,
color=_color,
textcolor=color.white,
size=size.tiny)
// ————— Resistance Zone
if not na(pivotH) and volSpike[pivotLen] and rangeSpike[pivotLen] and volScore[pivotLen] > minScore
p = priceBasis[pivotLen]
top = p + zoneHalf
bot = p - zoneHalf
createZone(top, bot, color.red, volScore[pivotLen])
// ————— Support Zone
if not na(pivotL) and volSpike[pivotLen] and rangeSpike[pivotLen] and volScore[pivotLen] > minScore
p = priceBasis[pivotLen]
top = p + zoneHalf
bot = p - zoneHalf
createZone(top, bot, color.green, volScore[pivotLen])
// ————— Zone Maintenance + Break Detection
breakBuf = atr * 0.25
for i = 0 to array.size(zones)-1
z = array.get(zones, i)
t = array.get(tops, i)
b = array.get(bots, i)
broken = close > t + breakBuf or close < b - breakBuf
if broken
box.set_border_color(z, color.gray)
box.set_bgcolor(z, color.new(color.gray, 90))
// ————— Retest Alert Logic
retest = false
for i = 0 to array.size(tops)-1
t = array.get(tops, i)
b = array.get(bots, i)
if low <= t and high >= b
retest := true
alertcondition(enableAlerts and retest, "Zone Retest", "Price retesting volume S/R zone")
오픈 소스 스크립트
트레이딩뷰의 진정한 정신에 따라, 이 스크립트의 작성자는 이를 오픈소스로 공개하여 트레이더들이 기능을 검토하고 검증할 수 있도록 했습니다. 작성자에게 찬사를 보냅니다! 이 코드는 무료로 사용할 수 있지만, 코드를 재게시하는 경우 하우스 룰이 적용된다는 점을 기억하세요.
면책사항
해당 정보와 게시물은 금융, 투자, 트레이딩 또는 기타 유형의 조언이나 권장 사항으로 간주되지 않으며, 트레이딩뷰에서 제공하거나 보증하는 것이 아닙니다. 자세한 내용은 이용 약관을 참조하세요.
오픈 소스 스크립트
트레이딩뷰의 진정한 정신에 따라, 이 스크립트의 작성자는 이를 오픈소스로 공개하여 트레이더들이 기능을 검토하고 검증할 수 있도록 했습니다. 작성자에게 찬사를 보냅니다! 이 코드는 무료로 사용할 수 있지만, 코드를 재게시하는 경우 하우스 룰이 적용된다는 점을 기억하세요.
면책사항
해당 정보와 게시물은 금융, 투자, 트레이딩 또는 기타 유형의 조언이나 권장 사항으로 간주되지 않으며, 트레이딩뷰에서 제공하거나 보증하는 것이 아닙니다. 자세한 내용은 이용 약관을 참조하세요.