VWAP with Standard deviation bands

 

What am I doing wrong? The VWAP deviates from price when volume is low and comes closer when volume is high. Please help. I've sat with this for 15 hours straight now and I'm losing my mind. Thanks.

Files:
 

Searching might have saved you a sleepless night: https://www.mql5.com/en/search#!keyword=vwap&module=mql5_module_codebase

Bear in mind there's virtually nothing that hasn't already been programmed for MT4/MT5 and is ready for you - and searching gives better results than ChartGPT!

Reason: