I am having trouble converting v2 to v5 any help greatly appreciated. Getting below errors:
Error at 565:28 Undeclared identifier 'bool' Error at 565:23 The 'input' function does not have an argument with the name 'type' Error at 566:23 The 'input' function does not have an argument with the name 'type' Error at 567:24 The 'input' function does not have an argument with the name 'type' Error at 568:24 The 'input' function does not have an argument with the name 'type' Error at 570:29 The 'input' function does not have an argument with the name 'type' Error at 572:18 Undeclared identifier 'tickerid' Error at 572:9 Could not find function or function reference 'security'
//@version=2
study("VWAP Stdev Bands v2 Mod", overlay=true)
devUp1 = input(1.28, title="Stdev above (1)")
devDn1 = input(1.28, title="Stdev below (1)")
devUp2 = input(2.01, title="Stdev above (2)")
devDn2 = input(2.01, title="Stdev below (2)")
devUp3 = input(2.51, title="Stdev above (3)")
devDn3 = input(2.51, title="Stdev below (3)")
devUp4 = input(3.09, title="Stdev above (4)")
devDn4 = input(3.09, title="Stdev below (4)")
devUp5 = input(4.01, title="Stdev above (5)")
devDn5 = input(4.01, title="Stdev below (5)")
showDv2 = input(true, type=bool, title="Show second group of bands?")
showDv3 = input(true, type=bool, title="Show third group of bands?")
showDv4 = input(false, type=bool, title="Show fourth group of bands?")
showDv5 = input(false, type=bool, title="Show fifth group of bands?")
showPrevVWAP = input(false, type=bool, title="Show previous VWAP close")
start = security(tickerid, "D", time)
newSession = iff(change(start), 1, 0)
vwapsum = iff(newSession, hl2*volume, vwapsum[1]+hl2*volume)
volumesum = iff(newSession, volume, volumesum[1]+volume)
v2sum = iff(newSession, volume*hl2*hl2, v2sum[1]+volume*hl2*hl2)
myvwap = vwapsum/volumesum
dev = sqrt(max(v2sum/volumesum - myvwap*myvwap, 0))
A=plot(myvwap,style=circles, title="VWAP", color=black)
U1=plot(myvwap + devUp1 * dev,style=circles, title="VWAP Upper", color=gray)
D1=plot(myvwap - devDn1 * dev, style=circles, title="VWAP Lower", color=gray)
U2=plot(showDv2 ? myvwap + devUp2 * dev : na, color=red, title="VWAP Upper (2)")
D2=plot(showDv2 ? myvwap - devDn2 * dev : na, color=green, title="VWAP Lower (2)")
U3=plot(showDv3 ? myvwap + devUp3 * dev : na, title="VWAP Upper (3)", color=red)
D3=plot(showDv3 ? myvwap - devDn3 * dev : na, title="VWAP Lower (3)", color=green)
U4=plot(showDv4 ? myvwap + devUp4 * dev : na, title="VWAP Upper (4)", color=red)
D4=plot(showDv4 ? myvwap - devDn4 * dev : na, title="VWAP Lower (4)", color=green)
U5=plot(showDv5 ? myvwap + devUp5 * dev : na, title="VWAP Upper (5)", color=red)
D5=plot(showDv5 ? myvwap - devDn5 * dev : na, title="VWAP Lower (5)", color=green)
prevwap = iff(newSession, myvwap[1], prevwap[1])
plot(showPrevVWAP ? prevwap : na, style=circles, color=close > prevwap ? green : red)
fill(U1, U2, color=red, transp=90, title="Over Bought Fill 1")
fill(D1, D2, color=green, transp=90, title="Over Sold Fill 1")
fill(U2, U3, color=red, transp=90, title="Over Bought Fill 2")
fill(D2, D3, color=green, transp=90, title="Over Sold Fill 2")
fill(U3, U4, color=red, transp=90, title="Over Bought Fill 3")
fill(D3, D4, color=green, transp=90, title="Over Sold Fill 3")
fill(U4, U5, color=red, transp=90, title="Over Bought Fill 4")
fill(D4, D5, color=green, transp=90, title="Over Sold Fill 4")
fill(A, U1, color=gray, transp=90, title="Middle Fill Up")
fill(A, D1, color=gray, transp=90, title="Middle Fill Down")
Here is the v5 code:
// This Pine Script™ code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © RakeshPoluri
//@version=5
indicator("VWAP Stdev Bands v2 Mod", overlay=true)
devUp1 = input.float(1.28, title="Stdev above (1)")
devDn1 = input.float(1.28, title="Stdev below (1)")
devUp2 = input.float(2.01, title="Stdev above (2)")
devDn2 = input.float(2.01, title="Stdev below (2)")
devUp3 = input.float(2.51, title="Stdev above (3)")
devDn3 = input.float(2.51, title="Stdev below (3)")
devUp4 = input.float(3.09, title="Stdev above (4)")
devDn4 = input.float(3.09, title="Stdev below (4)")
devUp5 = input.float(4.01, title="Stdev above (5)")
devDn5 = input.float(4.01, title="Stdev below (5)")
showDv2 = input.bool(true, title="Show second group of bands?")
showDv3 = input.bool(true, title="Show third group of bands?")
showDv4 = input.bool(false, title="Show fourth group of bands?")
showDv5 = input.bool(false, title="Show fifth group of bands?")
showPrevVWAP = input.bool(false, title="Show previous VWAP close")
newSession = timeframe.change("1D")
vwapsum = 0.0
volumesum = 0.0
v2sum = 0.0
vwapsum := newSession ? hl2*volume : vwapsum[1]+hl2*volume
volumesum := newSession ? volume : volumesum[1]+volume
v2sum := newSession ? volume*hl2*hl2 : v2sum[1]+volume*hl2*hl2
myvwap = vwapsum/volumesum
dev = math.sqrt(math.max(v2sum/volumesum - myvwap*myvwap, 0))
A = plot(myvwap, title="VWAP", color=color.black, style = plot.style_circles)
U1 = plot(myvwap + devUp1 * dev, title="VWAP Upper", color=color.gray, style = plot.style_circles)
D1 = plot(myvwap - devDn1 * dev, title="VWAP Lower", color=color.gray, style = plot.style_circles)
U2 = plot(showDv2 ? myvwap + devUp2 * dev : na, color=color.red, title="VWAP Upper (2)")
D2 = plot(showDv2 ? myvwap - devDn2 * dev : na, color=color.green, title="VWAP Lower (2)")
U3 = plot(showDv3 ? myvwap + devUp3 * dev : na, title="VWAP Upper (3)", color=color.red)
D3 = plot(showDv3 ? myvwap - devDn3 * dev : na, title="VWAP Lower (3)", color=color.green)
U4 = plot(showDv4 ? myvwap + devUp4 * dev : na, title="VWAP Upper (4)", color=color.red)
D4 = plot(showDv4 ? myvwap - devDn4 * dev : na, title="VWAP Lower (4)", color=color.green)
U5 = plot(showDv5 ? myvwap + devUp5 * dev : na, title="VWAP Upper (5)", color=color.red)
D5 = plot(showDv5 ? myvwap - devDn5 * dev : na, title="VWAP Lower (5)", color=color.green)
prevwap = 0.0
prevwap := newSession ? myvwap[1] : prevwap[1]
plot(showPrevVWAP ? prevwap : na, color=close > prevwap ? color.green : color.red, style = plot.style_circles)
fill(U1, U2, color=color.new(color.red, transp=90), title="Over Bought Fill 1")
fill(D1, D2, color=color.new(color.green, transp=90), title="Over Sold Fill 1")
fill(U2, U3, color=color.new(color.red, transp=90), title="Over Bought Fill 2")
fill(D2, D3, color=color.new(color.green, transp=90), title="Over Sold Fill 2")
fill(U3, U4, color=color.new(color.red, transp=90), title="Over Bought Fill 3")
fill(D3, D4, color=color.new(color.green, transp=90), title="Over Sold Fill 3")
fill(U4, U5, color=color.new(color.red, transp=90), title="Over Bought Fill 4")
fill(D4, D5, color=color.new(color.green, transp=90), title="Over Sold Fill 4")
fill(A, U1, color=color.new(color.gray, transp=90), title="Middle Fill Up")
fill(A, D1, color=color.new(color.gray, transp=90), title="Middle Fill Down")