Hello!
I have been messing around with VWAP and tried different indicators for displaying VWAP Bands. I have realized that all three versions of the VWAP Bands that I have been using shows different levels. The first two I have been using are indicators downloaded from the Forum, and the third one is the built in VWAP Bands indicator that comes as standard with PRT. As you can see in the attached image below, the VWAP is the same but the bands are different. I am a bit confused with which VWAP Bands are actually the correct ones to use?
Yes, it has been discussed before about the bands not being calculated the same way as the default VWAP indicator of the platform, I’m sure I have solved that calculation somewhere, let me find the topic.
Here is the code with the same VWAP bands calculation as the default indicator:
//PRC_VWAP intraday
//SAME VERSION AS THE ORIGINAL VWAP FROM THE PLATFORM
//09.01.2020
//Nicolas @ www.prorealcode.com
//Sharing ProRealTime knowledge
if day<>day[1] then
d=0
else
d=d+1
if volume >0 then
VWAP = SUMMATION[d](volume*typicalprice)/SUMMATION[d](volume)
endif
sd = std[d](abs(typicalprice-vwap))
SDup1 = vwap+sd
SDlw1 = vwap-sd
SDup2 = vwap+sd*2
SDlw2 = vwap-sd*2
SDup3 = vwap+sd*3
SDlw3 = vwap-sd*3
endif
if vwap>vwap[1] then
color = 1
else
color = -1
endif
RETURN VWAP coloured by color STYLE(LINE,2) as "VWAP", SDup1 coloured(102,102,102) STYLE(DOTTEDLINE,1) as "upper 1 STD", SDlw1 coloured(102,102,102) STYLE(DOTTEDLINE,1) as "lower 1 STD", SDup2 coloured(102,102,102) STYLE(DOTTEDLINE,1) as "upper 2 STD", SDlw2 coloured(102,102,102) STYLE(DOTTEDLINE,1) as "lower 2 STD", SDup3 coloured(102,102,102) STYLE(DOTTEDLINE,1) as "upper 3 STD", SDlw3 coloured(102,102,102) STYLE(DOTTEDLINE,1) as "lower 3 STD"
Found it in this recent topic: Is there any working intraday VWAP?
Excellent! Thank you very much Nicolas!