INVITE-ONLY SCRIPT
BAMBAM with VWAP Bands

//version=5
// Knitted by Reigen lol
indicator("BAMBAM with VWAP Bands", overlay=true)
// Signal by BAMBAM
lookback = input.int(200, 'Lookback', minval=0, maxval=500, group='Signal')
lessRatio = input.float(0.05, 'Less Ratio', minval=0.001, maxval=0.1, group='Signal')
ph = high[1]
pl = low[1]
vb = high == low ? 0 : volume * (close - low) / (high - low)
vs = high == low ? 0 : volume * (high - close) / (high - low)
vd = vb[1] - vs[1]
vol = vb[1] + vs[1]
top = ta.highest(ph, lookback)
btm = ta.lowest(pl, lookback)
avgVol = math.sum(vol, lookback) / lookback
vdRatio = math.abs(vd / vol)
isLessRatio = vdRatio < lessRatio
highVol = vol > avgVol
bearSignal = ph >= top and highVol and (isLessRatio or vd < 0)
bullSignal = pl <= btm and highVol and (isLessRatio or vd > 0)
// Marker Generation
bearPlot = bearSignal ? 1 : na
bullPlot = bullSignal ? 1 : na
plotshape(series=bearPlot, color=color.new(color.red, 0), style=shape.labeldown, location=location.abovebar, offset=-1, title='Bearish Signal', size=size.small)
plotshape(series=bullPlot, color=color.new(color.lime, 0), style=shape.labelup, location=location.belowbar, offset=-1, title='Bullish Signal', size=size.small)
// Alert Conditions
alertcondition(bearSignal, title="Bearish Signal Alert", message="Bearish Signal detected")
alertcondition(bullSignal, title="Bullish Signal Alert", message="Bullish Signal detected")
// VWAP Bands by qrsq
getTheme(theme) =>
color lineCol = na
color bgCol = na
if theme == "Light"
lineCol := color.rgb(255,255,255,45)
bgCol := color.rgb(255,255,255,85)
if theme == "Dark"
lineCol := color.new(#393b44, 30)
bgCol := color.new(#393b44, 92)
if theme == "Blue"
lineCol := color.new(#2962ff,30)
bgCol := color.new(#2962ff,92)
if theme == "Red"
lineCol := color.new(#e84b4c, 30)
bgCol := color.new(#e84b4c, 92)
if theme == "Orange"
lineCol := color.new(#ffb228, 30)
bgCol := color.new(#ffb228, 92)
if theme == "Green"
lineCol := color.new(#01c082, 30)
bgCol := color.new(#01c082, 92)
[lineCol, bgCol]
theme = input.string("Dark", title="Theme", options=["Light", "Dark", "Blue", "Red", "Orange", "Green"], group="Styling")
color lineCol = na
color bgCol = na
[_lineCol, _bgCol] = getTheme(theme)
lineCol:=_lineCol
bgCol:=_bgCol
BV = high == low ? 0 : volume * (close - low) / (high - low)
SV = high == low ? 0 : volume * (high - close) / (high - low)
src = input(title = "Source", defval = hlc3, group="VWAP Settings")
length = input.int(100, title="Length", group="VWAP Settings")
stdevMultiplier = input.float(1.5, "SD Multiplier 1", group="VWAP Settings")
stdevMultiplier2 = input.float(2, "SD Multiplier 2", group="VWAP Settings")
showDouble = input.bool(true, "Show double bands", group="VWAP Settings")
sumBuy = math.sum(BV, length)
sumSrcBuy = math.sum(src*BV, length)
sumSrcSrcBuy = math.sum(BV*math.pow(src,2), length)
VWAPBuy = sumSrcBuy / sumBuy
varianceBuy = (sumSrcSrcBuy / sumBuy) - math.pow(VWAPBuy, 2)
stDevBuy = math.sqrt(varianceBuy < 0 ? 0 : varianceBuy)
sumSell = math.sum(SV, length)
sumSrcSell = math.sum(src*SV, length)
sumSrcSrcSell = math.sum(SV*math.pow(src,2),length)
VWAPSell = sumSrcSell / sumSell
varianceSell = (sumSrcSrcSell / sumSell) - math.pow(VWAPSell, 2)
stDevSell = math.sqrt(varianceSell < 0 ? 0 : varianceSell)
thresholdDown = VWAPBuy - stDevBuy * stdevMultiplier
thresholdUp = VWAPSell + stDevSell * stdevMultiplier
bottomUpper = plot(VWAPSell - stDevSell*stdevMultiplier, color=lineCol)
bottomLower = plot(thresholdDown, color=lineCol)
fill(bottomUpper, bottomLower, color=bgCol)
topLower = plot(VWAPBuy + stDevBuy*stdevMultiplier, color=lineCol)
topUpper = plot(thresholdUp, color=lineCol)
fill(topUpper, topLower, color=bgCol)
bottomDbl = plot(showDouble?VWAPSell - stDevSell*stdevMultiplier2:na, color=lineCol)
fill(bottomDbl, bottomLower, color=showDouble?bgCol:color.new(color.white, 100))
topDbl = plot(showDouble?VWAPBuy + stDevBuy*stdevMultiplier2:na, color=lineCol)
fill(topDbl, topUpper, color=showDouble?bgCol:color.new(color.white, 100))
// Knitted by Reigen lol
indicator("BAMBAM with VWAP Bands", overlay=true)
// Signal by BAMBAM
lookback = input.int(200, 'Lookback', minval=0, maxval=500, group='Signal')
lessRatio = input.float(0.05, 'Less Ratio', minval=0.001, maxval=0.1, group='Signal')
ph = high[1]
pl = low[1]
vb = high == low ? 0 : volume * (close - low) / (high - low)
vs = high == low ? 0 : volume * (high - close) / (high - low)
vd = vb[1] - vs[1]
vol = vb[1] + vs[1]
top = ta.highest(ph, lookback)
btm = ta.lowest(pl, lookback)
avgVol = math.sum(vol, lookback) / lookback
vdRatio = math.abs(vd / vol)
isLessRatio = vdRatio < lessRatio
highVol = vol > avgVol
bearSignal = ph >= top and highVol and (isLessRatio or vd < 0)
bullSignal = pl <= btm and highVol and (isLessRatio or vd > 0)
// Marker Generation
bearPlot = bearSignal ? 1 : na
bullPlot = bullSignal ? 1 : na
plotshape(series=bearPlot, color=color.new(color.red, 0), style=shape.labeldown, location=location.abovebar, offset=-1, title='Bearish Signal', size=size.small)
plotshape(series=bullPlot, color=color.new(color.lime, 0), style=shape.labelup, location=location.belowbar, offset=-1, title='Bullish Signal', size=size.small)
// Alert Conditions
alertcondition(bearSignal, title="Bearish Signal Alert", message="Bearish Signal detected")
alertcondition(bullSignal, title="Bullish Signal Alert", message="Bullish Signal detected")
// VWAP Bands by qrsq
getTheme(theme) =>
color lineCol = na
color bgCol = na
if theme == "Light"
lineCol := color.rgb(255,255,255,45)
bgCol := color.rgb(255,255,255,85)
if theme == "Dark"
lineCol := color.new(#393b44, 30)
bgCol := color.new(#393b44, 92)
if theme == "Blue"
lineCol := color.new(#2962ff,30)
bgCol := color.new(#2962ff,92)
if theme == "Red"
lineCol := color.new(#e84b4c, 30)
bgCol := color.new(#e84b4c, 92)
if theme == "Orange"
lineCol := color.new(#ffb228, 30)
bgCol := color.new(#ffb228, 92)
if theme == "Green"
lineCol := color.new(#01c082, 30)
bgCol := color.new(#01c082, 92)
[lineCol, bgCol]
theme = input.string("Dark", title="Theme", options=["Light", "Dark", "Blue", "Red", "Orange", "Green"], group="Styling")
color lineCol = na
color bgCol = na
[_lineCol, _bgCol] = getTheme(theme)
lineCol:=_lineCol
bgCol:=_bgCol
BV = high == low ? 0 : volume * (close - low) / (high - low)
SV = high == low ? 0 : volume * (high - close) / (high - low)
src = input(title = "Source", defval = hlc3, group="VWAP Settings")
length = input.int(100, title="Length", group="VWAP Settings")
stdevMultiplier = input.float(1.5, "SD Multiplier 1", group="VWAP Settings")
stdevMultiplier2 = input.float(2, "SD Multiplier 2", group="VWAP Settings")
showDouble = input.bool(true, "Show double bands", group="VWAP Settings")
sumBuy = math.sum(BV, length)
sumSrcBuy = math.sum(src*BV, length)
sumSrcSrcBuy = math.sum(BV*math.pow(src,2), length)
VWAPBuy = sumSrcBuy / sumBuy
varianceBuy = (sumSrcSrcBuy / sumBuy) - math.pow(VWAPBuy, 2)
stDevBuy = math.sqrt(varianceBuy < 0 ? 0 : varianceBuy)
sumSell = math.sum(SV, length)
sumSrcSell = math.sum(src*SV, length)
sumSrcSrcSell = math.sum(SV*math.pow(src,2),length)
VWAPSell = sumSrcSell / sumSell
varianceSell = (sumSrcSrcSell / sumSell) - math.pow(VWAPSell, 2)
stDevSell = math.sqrt(varianceSell < 0 ? 0 : varianceSell)
thresholdDown = VWAPBuy - stDevBuy * stdevMultiplier
thresholdUp = VWAPSell + stDevSell * stdevMultiplier
bottomUpper = plot(VWAPSell - stDevSell*stdevMultiplier, color=lineCol)
bottomLower = plot(thresholdDown, color=lineCol)
fill(bottomUpper, bottomLower, color=bgCol)
topLower = plot(VWAPBuy + stDevBuy*stdevMultiplier, color=lineCol)
topUpper = plot(thresholdUp, color=lineCol)
fill(topUpper, topLower, color=bgCol)
bottomDbl = plot(showDouble?VWAPSell - stDevSell*stdevMultiplier2:na, color=lineCol)
fill(bottomDbl, bottomLower, color=showDouble?bgCol:color.new(color.white, 100))
topDbl = plot(showDouble?VWAPBuy + stDevBuy*stdevMultiplier2:na, color=lineCol)
fill(topDbl, topUpper, color=showDouble?bgCol:color.new(color.white, 100))
초대 전용 스크립트
이 스크립트는 작성자가 승인한 사용자만 접근할 수 있습니다. 사용하려면 요청 후 승인을 받아야 하며, 일반적으로 결제 후에 허가가 부여됩니다. 자세한 내용은 아래 작성자의 안내를 따르거나 Huynguyen8에게 직접 문의하세요.
트레이딩뷰는 스크립트의 작동 방식을 충분히 이해하고 작성자를 완전히 신뢰하지 않는 이상, 해당 스크립트에 비용을 지불하거나 사용하는 것을 권장하지 않습니다. 커뮤니티 스크립트에서 무료 오픈소스 대안을 찾아보실 수도 있습니다.
작성자 지시 사항
bam
면책사항
해당 정보와 게시물은 금융, 투자, 트레이딩 또는 기타 유형의 조언이나 권장 사항으로 간주되지 않으며, 트레이딩뷰에서 제공하거나 보증하는 것이 아닙니다. 자세한 내용은 이용 약관을 참조하세요.
초대 전용 스크립트
이 스크립트는 작성자가 승인한 사용자만 접근할 수 있습니다. 사용하려면 요청 후 승인을 받아야 하며, 일반적으로 결제 후에 허가가 부여됩니다. 자세한 내용은 아래 작성자의 안내를 따르거나 Huynguyen8에게 직접 문의하세요.
트레이딩뷰는 스크립트의 작동 방식을 충분히 이해하고 작성자를 완전히 신뢰하지 않는 이상, 해당 스크립트에 비용을 지불하거나 사용하는 것을 권장하지 않습니다. 커뮤니티 스크립트에서 무료 오픈소스 대안을 찾아보실 수도 있습니다.
작성자 지시 사항
bam
면책사항
해당 정보와 게시물은 금융, 투자, 트레이딩 또는 기타 유형의 조언이나 권장 사항으로 간주되지 않으며, 트레이딩뷰에서 제공하거나 보증하는 것이 아닙니다. 자세한 내용은 이용 약관을 참조하세요.