Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
- // © drew102
- //@version=4
- study(title="1m/1W VWAPs X WVWAP", shorttitle="VWAPs x MVWAP", overlay=true)
- // 1m VWAP
- vwap(vwap)
- plot = security(syminfo.tickerid, '1', vwap)
- plot(plot, title="VWAP", color=color.white)
- // MVWAP
- mvLen = input(title="MVWAP Length", type=input.integer, defval=21)
- mvwap = ema(vwap, mvLen)
- plot(mvwap, title="MVWAP", color=color.fuchsia, style=plot.style_circles)
- // 1W VWAP
- start = security(syminfo.tickerid, 'W', time)
- newSession = iff(change(start), 1, 0)
- float vwapsum = na
- vwapsum := iff(newSession, hl2*volume, vwapsum[1]+hl2*volume)
- float volumesum = na
- volumesum := iff(newSession, volume, volumesum[1]+volume)
- wvwap = vwapsum / volumesum
- plot(wvwap, style=plot.style_circles, color=close > wvwap ? color.green : color.red)
Advertisement
Add Comment
Please, Sign In to add comment