커뮤니티

문의드립니다.

프로필 이미지
해암
2025-05-14 19:15:27
248
글번호 190833
답변완료
이전 문의에 대해 어려운 점이 있다 하셔서 이전 vwap session 지표와 비숫한 아래의 수식을 다시 변환부탁드리고자 합니다. 거듭 부탁드립니다. ===================== 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") ========================== 선들사이에 색은 넣지 않아도 됩니다. 최대한 간단히 중심선과 위아래 선들만 나오게 해주셔도 감사하겠습니다. 항상 감사드립니다. 수고하세요!!!
지표
답변 1
프로필 이미지

예스스탁 예스스탁 답변

2025-05-16 10:23:51

안녕하세요 예스스탁입니다. input : devUp1(1.28); input : devDn1(1.28); input : devUp2(2.01); input : devDn2(2.01); input : devUp3(2.51); input : devDn3(2.51); input : devUp4(3.09); input : devDn4(3.09); input : devUp5(4.01); input : devDn5(4.01); input : showDv2(true); input : showDv3(true); input : showDv4(false); input : showDv5(false); input : showPrevVWAP(false); var : hl2(0),vwapsum(0),volumesum(0),v2sum(0),myvwap(0),dev(0),prevwap(0); hl2 = (h+L)/2; if Bdate != Bdate[1] Then { prevwap = myvwap[1]; vwapsum = hl2*volume; volumesum = Volume; v2sum = volume*hl2*hl2; } Else { vwapsum = vwapsum+ hl2*volume; volumesum = volumesum+volume; v2sum = v2sum+volume*hl2*hl2; } myvwap = vwapsum/volumesum; dev = sqrt(max(v2sum/volumesum - myvwap*myvwap, 0)); if showDv2 Then { plot1(myvwap + devUp2 * dev,"VWAP Upper (2)",Red); plot2(myvwap - devDn2 * dev,"VWAP Lower (2)",Green); } Else { NoPlot(1); NoPlot(2); } if showDv3 Then { plot3(myvwap + devUp3 * dev ,"VWAP Upper (3)", red); plot4(myvwap - devDn3 * dev ,"VWAP Lower (3)", green); } Else { NoPlot(3); NoPlot(4); } if showDv4 Then { plot5(myvwap + devUp4 * dev ,"VWAP Upper (4)", red); plot6(myvwap - devDn4 * dev ,"VWAP Lower (4)", green); } Else { NoPlot(5); NoPlot(6); } if showDv5 Then { plot7(myvwap + devUp5 * dev ,"VWAP Upper (5)", red); plot8(myvwap - devDn5 * dev ,"VWAP Lower (5)", green); } Else { NoPlot(7); NoPlot(8); } if showPrevVWAP Then plot9(prevwap,"prevwap",iff(close > prevwap , green , red)); Else NoPlot(9); plot10(myvwap,"VWAP", black); plot11(myvwap + devUp1 * dev,"VWAP Upper", gray); plot12(myvwap - devDn1 * dev,"VWAP Lower", gray); 즐거운 하루되세요 > 해암 님이 쓴 글입니다. > 제목 : 문의드립니다. > 이전 문의에 대해 어려운 점이 있다 하셔서 이전 vwap session 지표와 비숫한 아래의 수식을 다시 변환부탁드리고자 합니다. 거듭 부탁드립니다. ===================== 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") ========================== 선들사이에 색은 넣지 않아도 됩니다. 최대한 간단히 중심선과 위아래 선들만 나오게 해주셔도 감사하겠습니다. 항상 감사드립니다. 수고하세요!!!