Chart Period VWAP and Standard Deviation Bands

Since the introduction of the native TOS Volume Profile, I’ve had numerous requests to publish “those lines” that were a part of my original Volume Profile study. The lines are a chart period VWAP (Volume Weighted Average Price) and three VWAP standard deviation bands which default to 1/2/3 sigma but are user selectable. By chart period I mean that the VWAP is not by day or week (like the TOS version) but rather will display the VWAP for all the chart data displayed. I have migrated my own use to the TOS profiles so this makes the studies feel more like my own. Happy Easter!

Chart Period VWAP and Standard Deviation Bands

# TS_CHART_VWAP_SD_BANDS
# http://www.thinkscripter.com
# thinkscripter@gmail.com
# Last Update 03 APR 2010

input VWAPStdev1 = 1.0;
input VWAPStdev2 = 2.0;
input VWAPStdev3 = 3.0;

plot VWAP = TotalSum(((high+low+close)/3)*volume) / TotalSum(volume);
def vwapSD = sqrt(TotalSum(Sqr(((high+low+close)/3)-VWAP)*volume)/TotalSum(volume));
VWAP.SetDefaultColor(color.magenta);
VWAP.SetStyle(curve.SHORT_DASH);
VWAP.SetLineWeight(3);

plot r1 = VWAP+VWAPStdev1*vwapSD;
plot s1 = VWAP-VWAPStdev1*vwapSD;
plot r2 = VWAP+VWAPStdev2*vwapSD;
plot s2 = VWAP-VWAPStdev2*vwapSD;
plot r3 = VWAP+VWAPStdev3*vwapSD;
plot s3 = VWAP-VWAPStdev3*vwapSD;

r1.setDefaultColor(color.orange);
r2.setDefaultColor(color.pink);
r3.setDefaultColor(color.cyan);
s1.setDefaultColor(color.orange);
s2.setDefaultColor(color.pink);
s3.setDefaultColor(color.cyan);

r1.SetStyle(curve.SHORT_DASH);
r2.SetStyle(curve.SHORT_DASH);
r3.SetStyle(curve.SHORT_DASH);
s1.SetStyle(curve.SHORT_DASH);
s2.SetStyle(curve.SHORT_DASH);
s3.SetStyle(curve.SHORT_DASH);

VWAP.hideBubble();
r1.hideBubble();
r2.hideBubble();
r3.hideBubble();
s1.hideBubble();
s2.hideBubble();
s3.hideBubble();
This entry was posted in Indicator and tagged , , , , . Bookmark the permalink.

5 Responses to Chart Period VWAP and Standard Deviation Bands

  1. RappidFyre says:

    Thank you Eric,
    Much appreciated.

    Peace-
    RappidFyre

  2. Chris says:

    Interesting indicator. One of the aspects that I think might be misleading about this indicator is that it repaints since it always takes into account the total sum of the chart values as a new bar is added to the chart. This doesn’t necessarily take away from its ability to provide potentially useful projections for resistance / support but attempting to visually backtest it’s accuracy isn’t possible without actually “stepping back in time”.

    Based on my research VWAP variations are typically used on intraday charts, but my intent is to see how it does on the daily charts, as I’m a swing trader.

    • The plot lines do not change after the fact. The TotalSum function is only aware of bars prior to it and hence the study lines will not change as the study is repainted each bar.
      -Eric

  3. Bob Reinhart says:

    Hello,

    Is is it possible to have 2 periods for VWAP (Like a 5000 tick VWAP and a 10,000 tick VWAP)? If so, could each VWAP indicator be plotted on the same graph? Mark Whistler in his book, “Volatility Illuminated”, shows a graph where this is done. He also has the ability to show the standard deviations for each VWAP if desired.

    Bob (puddie)

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>