Tuesday, October 27, 2009

VWAP

Definition


"Volume Weighted Average Price. A measure of the price at which the majority of a given day's trading in a given security took place. Calculated by taking the weighted average of the prices of each trade. The method is used by institutional traders, who often break a given trade into multiple transactions."

Another definition

The VWAP for a stock is calculated by adding the dollars traded for every transaction in that stock ("price" x "number of shares traded") and dividing the total shares traded. A VWAP is computed from the Open of the market to the market Close, AND is calculated by Volume weighting all transactions during this time period.

VWAP, or Volume Weighted Average Price is a tool used by some traders, I first learned of it from Brian Shannon who trades stocks. This won't work for forex since there is no volume.

There are a few different ways of displaying this in Amibroker. It can be a simple line like a moving average, this is the most common way pro's use it. Amibroker has a function to display it behind price, look in the help for these two functions with examples;

  • PlotVAPOverlayA
  • PlotVAPOverlay
Here are a few ways tp lot it and some code to try out.

eTokes Blog post on VWAP
I suggest reading his post, as well as Brian's post on VWAP, links below. eToke used a vertical "study" line drawn on the chart. This might give you an error on your chart if there is no line drawn. Here is his code with a little fix for this problem (adding "Nz");


Plot VWAP starting at a horizontal study line (Study ID set to ST)

//VWAP since last change in sentiment
TurningPoint = IIf(Nz(Study(“ST”,GetChartID())==0,1,0));
BarsSinceLastTurn = 1 + BarsSince(TurningPoint==1);
StartBar = ValueWhen(TurningPoint==1, BarIndex());
RunVolume = Sum(V,BarsSinceLastTurn);
IIf (BarIndex() >= StartBar, MTVWAP = Sum (C * V, BarsSinceLastTurn ) / RunVolume,0);
Plot (MTVWAP,”MTVWAP”,colorPink, styleLine);

Other ways to plot VWAP

Plot VWAP starting at selector line

This is another way, it will display the VWAP starting from where your selector line is placed. I use it for short term trading to see where all the volume is, makes finding support / resistance a bit easier when working with breakout.

_SECTION_BEGIN("Selector Line VAP");
segments = IIf(SelectedValue(BarIndex()) == BarIndex(), 1, 0);
PlotVAPOverlayA( segments , 300, 50, ParamColor("Color", colorDarkGrey ), 6 );
_SECTION_END();

Plotted like a moving average

_SECTION_BEGIN("VWAP");
Bars_so_far_today = 1 + BarsSince( Day() != Ref(Day(), -1));
StartBar = ValueWhen(TimeNum() == 093000, BarIndex());
TodayVolume = Sum(V,Bars_so_far_today);
IIf (BarIndex() >= StartBar, VWAP = Sum (C * V, Bars_so_far_today ) / TodayVolume,0);
Plot (VWAP,"VWAP",colorOrange, styleThick);
_SECTION_END();


Other links on VWAP
VWAP link 1
VWAP link 2

No comments:

Post a Comment

Let's hear what you have to say!

Disclaimer

The information presented on this site is for educational and entertainment purposes only. This site contains no suggestions or instructions that you must follow, do your own research and due diligence before committing your cash to the markets. Your on your own.