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")
開源腳本
秉持TradingView一貫精神,這個腳本的創作者將其設為開源,以便交易者檢視並驗證其功能。向作者致敬!您可以免費使用此腳本,但請注意,重新發佈代碼需遵守我們的社群規範。
免責聲明
這些資訊和出版物並非旨在提供,也不構成TradingView提供或認可的任何形式的財務、投資、交易或其他類型的建議或推薦。請閱讀使用條款以了解更多資訊。
開源腳本
秉持TradingView一貫精神,這個腳本的創作者將其設為開源,以便交易者檢視並驗證其功能。向作者致敬!您可以免費使用此腳本,但請注意,重新發佈代碼需遵守我們的社群規範。
免責聲明
這些資訊和出版物並非旨在提供,也不構成TradingView提供或認可的任何形式的財務、投資、交易或其他類型的建議或推薦。請閱讀使用條款以了解更多資訊。