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])
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 |
// 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)
Share this
No information on this site is investment advice or a solicitation to buy or sell any financial instrument. Past performance is not indicative of future results. Trading may expose you to risk of loss greater than your deposits and is only suitable for experienced investors who have sufficient financial means to bear such risk.
ProRealTime ITF files and other attachments :PRC is also on YouTube, subscribe to our channel for exclusive content and tutorials
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
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