a friend of mine was showing me Marketdelta and its features, when he plotted VWAP indicator , i've seen something seems me wrong.
when price makes a big movement, the bands don't widen as result by the price movements but they tend to follow the price .
this is the same either the price goes up or go down.
The following user says Thank You to crazybears for this post:
I can see that the bands widen after a sharp price movement as they should. Of course, the bands also follow price, as they are bands around the VWAP, and the VWAP follows price, as it is an average price.
There is certainly no way how bands have to work. It really depends on the definition of the bands. I have an idea, what may have caused the difference.
The bands are calculated by starting with the VWAP and then adding and subtracting multiples of the standard deviation. The VWAP only depends on the exact session chosen, so there is not much room for discussion. It may lack precision, if the resolution of the bars is insufficient, but it will certainly be close to identical for all charting software packages, if you apply it to a 1 min chart.
The difference comes from the standard deviation
So the problem comes with the standard deviation. There are different ways to define it. Let us first have a look at the Bollinger Bands with a period N. The standard deviation is calculated in the following way:
-> Calculate moving average as sum of last N closes divided by N
-> Calculate the squares of the difference between the n close and the last value of the moving average
-> Add up the square to calculate the variance
-> The square root of the variance is the standard deviation
-> Add and subtract a multiple of the standard deviation to the moving average
This is pretty straight forward. For the Bollinger bands the period of the standard deviation remains constant, so you can compare the standard deviation of yesterday at 10:00 AM to the standard deviation today at 3:00 PM.
The VWAP is an entirely different animal. It is a moving average with an ever increasing period until the session closes. If you calculate the standard deviation in a similar fashion as for the Bollinger Bands, you will start with a small period standard deviation and then have a standard deviation with a large period at the end of the session. Any bands calculated in the same way as the Bollinger Bands are therefore of little use. I can imagine different ways to calculate a standard deviation which is more in line with the requirement to get meaningfull bands.
Standard deviation is a measure of dispersion as is the average true range, and in a first approximation I would assume that the (average) value of the standard deviation increases with the square root of the period N. So one option would be to calculate the standard deviation in the same way as it is calculated for the Bollinger Bands, taking into account the ever increasing period and converting it to a fixed period standard deviation.
Different ways to calculate standard deviation
Another way to cope with the problem would be to calculate a standard deviation from differences of the closes and the value of the VWAP corresponding to that close. See the difference:
-> for a Bollinger Band you take n different closes and subtract each of them the last value of the moving average
-> for the standard deviation of the VWAP bands you could take n different closes and substract each of them from the corresponding of the last n values of the VWAP, meaning you take a different value for the moving average each time
Applying the second method will get you the standard deviation of the average distance of price from the VWAP.
How have different software packages implemented the bands?
To summarize, there can be at least 3 different methods to calculate standard deviation bands for the VWAP. What we have to find out now, is how the different software packages calculate those bands, and which of the options is most suited to trading.
I will have a look at the code and come back.
The following 4 users say Thank You to Fat Tails for this post:
The VWAP mode is comparable to a Bollinger Band with an increased period. Of course, if the volume of a bar takes the value k, the period is increased by k, and the values are stored in an array. The standard deviation is then calculated by using the last value of the VWAP as an input for the variance. So this is a non-corrected version.
If there is a sudden move of price with high volume, this drags the VWAP aways from its prior balance, which means that the variance of all data points that had already been collected increases as well. And as there are no dropouts at the beginning of the period, as would be the case for Bollinger Bands with its moving average, the variance of the old data points increases.
I am not sure that this makes sense, but it is the outcome that @beowulfit showed on his chart.
The other option with an average price of the VWAP is quite a peculiar approach. It is not a standard deviation of price relative to an average, but a standard deviation of the VWAP relative to its average price (the average of all VWAPs). I don't see any point in calculating this and won't further comment it.
The two different approaches can be seen on the charts below. Neither calcualtion method for the bands is identical with the solution adopted by Inverstor RT or Ensign Windows.
Investor RT has different options to plot the bands. Some of the options use my suggestions from post #6.
Option 1: Use the variance of the difference (close - average) by using the average at the time of the close.
Option 2: Use a quarter of the session range up to that point
Option 3: Use the average bar range of the last 20 bars (this is more like a Keltner Channel thing applied to VWAP)
Options 1 and 2 will give you bands that expand over the lifetime of the session. This is unlike Bollinger Bands, which expand and contract, but do not have a trend of continuous expansion.
Option 3 does not expand, but you could use the average true (using simple smoothing instead of exponential smoothing) over the session.
There are also proprietary ways of calculating bands, which are not disclosed.
which seems to be identical with the VWAP in the download section of the NinjaTrader forum.
The chart below shows VWAP (red) and standard deviation bands as calculated by the NinjaTrader VWAP (blue bands) and an indicator that I have coded for testing (slate gray bands). After two bars into the session, it is easy to calculate the standard deviation manually: