It doesn't help that different online resources have different formulas for calculating the bands. It doesn't appear to be as simple as finding the standard deviation of the VWAP.
I think the problem you might be having is that the standard deviation formula uses an average price. What average are you using? I use session VWAP, so it is reset at the open (9:30AM). Your daily charts are going to use the daily VWAP data and find an average ( close? ). It makes a big difference what you use......
But this link exactly do the job. Screenshot attached. - N is number of observations, to make it simpler - how many units you have since beginning of observation (let's say you use 5min chart, and there is 1 hour after session start, N=12) - i is iteration for each unit (1,2,3...N) - xi is VWAP for iteration i - x with dash is average VWAP since start of observation
I'm not sure what you mean by average price. Do you mean average close? Or average VWAP? VWAP is reset at open. Calculating the VWAP is not an issue. It's the bands I don't understand.
Thanks for telling me what all the variables are -- the article didn't explain it well. When I plug all the numbers into the formula, I'm still getting the wrong results. Unless I'm doing the math completely wrong (which is entirely possible).
I will tell you this. In ThinkorSwim you can go into the VWAP study and just view the source code. It will tell you what they are using.
Thanks so much for sharing this. I had no idea this was possible. The code makes a lot more sense than the other articles I've seen.
No problem. I have been using all of their source code to build indicators and analysis tools. thinkScript is an incredibly powerful tool for traders trying to get an edge.
Out of curiosity - could you paste this code with standard deviation bands calculation in ToS ? I don't use it, but made also this excel calculation after your post and I want to check where is the difference.