OPEN-SOURCE SCRIPT

5D-SMA+4hMACD

Session VWAP:
Uses the change in time("D") to detect a new day and resets the cumulative price‐volume and volume totals. The VWAP is then the cumulative price × volume divided by the cumulative volume.

2‑Day VWAP:
Maintains separate accumulators for the current day and the previous day. On a new day, the previous day’s totals are saved and then added to the current day’s running totals to compute a VWAP spanning the two most recent days.

Weekly VWAP:
Uses ta.change(time("W")) to reset the weekly accumulators at the start of a new week.

Anchored VWAP:
Begins accumulation when the current bar’s time exceeds the user‐defined anchor time. Once started, it continues to accumulate indefinitely.

Feel free to modify the inputs and styling to suit your preferences.






Disclaimer