0
votes

On TradingView there is an indicator VWAP the you can adjust to an anchor period. The pine script build in function vwap is not adjustable. How can I adjust the build in pine function vwap to a time period in the same way as the chart indicator?

Regards Sven

1
Well, the pine's implementation with anchor period is coming, and will be there soon. - Michel_T.
here's pine's implementation of VWAP with anchors: tradingview.com/script/zrYGyXRx-Anchored-VWAP . I think by the end of the next week of on the week after it, the study will become a standard one. - Michel_T.
Where's @PineCoders-LucF when you need him/her? - carloswm85

1 Answers

1
votes

Not sure if what you're looking for, but it may help. You can visualiza at any timeframe, the data from any other timeframe. For example, you could see the weekly VWAP from the 1m chart.

// VWAP
price = input(type=input.source, defval=hlc3, title="VWAP Source")
enable_vwap = input(true, title="Enable VWAP")
vwapResolution = input(title = "VWAP Resolution", defval = "", type=input.resolution)
vwapFunction = vwap(price)
vwapSecurity = security(syminfo.tickerid, vwapResolution, vwapFunction)
plot(enable_vwap ? vwapSecurity : na, title="VWAP", color=color.white, linewidth=2, transp=0, editable=true) // All TimeFrames

Here's an example on 1h chart, checking the 1week information in this VWAP I'm providing here (white colored line), and the built-in one from TV (yellow one):

enter image description here

You can tell there's a difference and you'll probably find the way to make a better use of this. Play with it, try different approaches at different timeframes.

By the way, in the white VWAP on the screenshot I used the low price as source input for white VWAP, while de default (yellow VWAP uses hcl3).