rajath_pai

1m/1W VWAPs X WVWAP_by_drew102

May 30th, 2025
23
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.87 KB | None | 0 0
  1. // This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
  2. // © drew102
  3.  
  4. //@version=4
  5. study(title="1m/1W VWAPs X WVWAP", shorttitle="VWAPs x MVWAP", overlay=true)
  6.  
  7. // 1m VWAP
  8. vwap(vwap)
  9. plot = security(syminfo.tickerid, '1', vwap)
  10. plot(plot, title="VWAP", color=color.white)
  11.  
  12. // MVWAP
  13. mvLen = input(title="MVWAP Length", type=input.integer, defval=21)
  14. mvwap = ema(vwap, mvLen)
  15. plot(mvwap, title="MVWAP", color=color.fuchsia, style=plot.style_circles)
  16.  
  17. // 1W VWAP
  18. start = security(syminfo.tickerid, 'W', time)
  19. newSession = iff(change(start), 1, 0)
  20. float vwapsum = na
  21. vwapsum := iff(newSession, hl2*volume, vwapsum[1]+hl2*volume)
  22. float volumesum = na
  23. volumesum := iff(newSession, volume, volumesum[1]+volume)
  24. wvwap = vwapsum / volumesum
  25. plot(wvwap, style=plot.style_circles, color=close > wvwap ? color.green : color.red)
Advertisement
Add Comment
Please, Sign In to add comment