Hello,
I am trying different VWAP indicators but none of them seem to work. For example when I try https://www.prorealcode.com/prorealtime-indicators/vwap-intraday/ I get the result i attached in this post.
I’ve tried other VWAP indicators and all of them give very strange results similiar to that one.
I would really appriciate getting a VWAP indicator with bands to work.
Best regards,
There is a built-in VWAP bands in the indicator list of the platform.
I think that the indicator you refer to has a problem of calculation for the bands when the volumes are not present. Here is a quick fix:
//PRC_VWAP intraday
//07.09.2016
//Nicolas @ www.prorealcode.com
//Sharing ProRealTime knowledge
d = max(1, intradaybarindex)
if volume>0 then
VWAP = SUMMATION[d](volume*typicalprice)/SUMMATION[d](volume)
if(intradaybarindex=0) then
sd = vwap
else
sd = SUMMATION[d](max(abs(high-vwap),abs(vwap-low)))/d
endif
endif
SDup1 = vwap+sd
SDlw1 = vwap-sd
SDup2 = vwap+sd*2
SDlw2 = vwap-sd*2
SDup3 = vwap+sd*3
SDlw3 = vwap-sd*3
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"
Hello Nicolas,
This seems to be working a lot better. Thank you for your quick and reliable help.
You contribute a great deal to this community, keep up the good work.
I will write again if I have any more questions 🙂
Thank you
Hello again,
So now I get this result (see attachment), which is better but I still have one or two questions.
Why do the bands spike up and down like crazy right at the beginning of the day? Now I have the chart time only during open hours 09.00-17.30.
Also second question, is it suppose to differ this much comapred to the built in VWAP bands in PRT? I want to use it for algo trading so I cannot use the built in one.
Best regards,
Why do the bands spike up and down like crazy right at the beginning of the day?
Because at the beginning of the day you don’t have much data to base the calculations on so each bit has a far larger effect than at the end of the day At the end of the day you have lots of data and so a new bit of data has little overall effect unless it is extremely different to all that came before it.
After unsuccessful attempts to reverse engineer the bands calculation from the built-in indicator, I sent an email to ITF to know how they calculate it. I let you know once I get a reply.
Okey, thank you so much for the help and answers.
Hello Nicholas, hope you have had nice and relaxing holidays.
Any news on the vwap indicator?
Best regards,
Axel
Not yet, will let you know. I made a reminder 😉
with the help of PRT, we finally recode it to be perfectly the same as the one from the platform, here is the VWAP code:
//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"
Make sure to have sufficient bars on your chart for the calculation to perfectly match the original VWAP indicator.
Hi Nicolas
Is there a way to have the above VWAP indicator commence/reset at 10:00am (UTC +11:00) each day?
Kind regards
Ben
Hi Nicolas,
With the code you published, the VWAP is now almost similar to the native indicator in PRT (there are still some minor discrepencies I don’t understand).
However, the bands remain totally different. My point is that I prefer the native indicator bands rather than the standard deviations bands you coded. Do you have more information about the way they coded these bands?
Thanks.
@BizzTrade: Time Anchored VWAP
or VWAP Date & Time Anchored
@screbassa I’m trying to understand why it doesn’t look the same as before in v11 and let you know..
Hello Nicolas,
Have you found why your custom code for the vwap bands and the native indicator doesn’t match? I think there are bugs at least when there is no volume in the CFD at some part of the day (holidays, or before future openings). See for example the 6 April on Dax CFD “Allemagne 30 Cash (5€)”