Daniele Maddaluno

VWAP@Time

Category: Indicators By: Daniele Maddaluno Created: August 20, 2020, 10:12 AM
August 20, 2020, 10:12 AM
Indicators
2 Comments
VWAP@Time

Another version of the VWAP indicator for intraday traders, this time you can set the “startTime” and the “endTime” of its plot with a time in “hhmmss” format (modify it in the indicator settings).

The VWAP formula is:

VWAP = Sum (Price[t] x Volume[t])  / Sum(Volume[t])

// VWAP@Time intraday
// 10.04.2020
// Daniele Maddaluno

if opentime < startTime or opentime > endTime then
 n = 0
 dwapT1 = 0
 dwapT2 = 0

 priced  = 0
 shared  = 0
 summ = 0

 vwap = close
 vwapstd = 0
else
 n = n + 1
 // This if has been added just for plot reasons
 if n <= 1 then
  dwapT1 = 0
  dwapT2 = 0
 else
  dwapT1 = 190
  dwapT2 = 128
 endif

 priced = priced + (totalprice*volume)
 shared = shared + volume

 if shared>0 then
  vwap = priced/shared

  summ = summ + square(totalprice - vwap)
  vwapstd = sqrt(summ / n)
 endif

endif


// Manage the coloring of vwap mid line
if close > vwap then
 dwapR = 0
 dwapG = 128
 dwapB = 192
else
 dwapR = 255
 dwapG = 0
 dwapB = 0
endif

vwapstd1 = vwapstd*NumDevs1
vwapstd2 = vwapstd*NumDevs2
vwapstd3 = vwapstd*NumDevs3

return vwap coloured(dwapR, dwapG, dwapB, dwapT1) as "vwap", vwap + vwapstd1 coloured(128, 128, 0, dwapT2) as "upVwap1", vwap - vwapstd1 coloured(128, 128, 0, dwapT2) as "dwVwap1", vwap + vwapstd2 coloured(128, 128, 0, dwapT2) as "upVwap2", vwap - vwapstd2 coloured(128, 128, 0, dwapT2) as "dwVwap2", vwap + vwapstd3 coloured(128, 128, 0, dwapT2) as "upVwap3", vwap - vwapstd3 coloured(128, 128, 0, dwapT2) as "dwVwap3"

For example in the image above I have set two VWAP@Time on the DAX 100ticks:

– the first has startTime=80000, endTime=153000 (and 2, 2,5, 3 as devs)
– the latter has startTime=153000, endTime=220000 (and 2, 2,5, 3 as devs)

Download
Filename: VWAP@Time.itf
Downloads: 314
Daniele Maddaluno
Daniele Maddaluno Master
Currently debugging life, so my bio is on hold. Check back after the next commit for an update.
Author’s Profile

Comments

withoutwings
3 years ago
#

To be able to flexibly wrap around the full 24h (i.e. past midnight), or to use just a single time to reset the VWAP (with startTime=endTime), replace the first IF statement with the following: if (not (endTime <= startTime) and (opentime endTime)) or (endTime endTime and opentime < startTime) or (endTime = startTime and opentime = startTime) then

GARNIEPI
3 years ago
#

hello I am looking for an anchored vwap intraday, indicator which allows you to visualize the vwap by clicking from anywhere on the price chart

ProRealCode ProRealCode
Loading...