VWAP

jlmalhotra

Active Member
#1
HI , Want to plot last 5 days VWAP on price chart. Couldn't find one after google search. Will be grateful if someone can share AFL.
or help me with changes in below mentioned code ;
//////


_SECTION_BEGIN("VWAP");
/*
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
*/

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",ParamColor( "Color", colorCycle ), ParamStyle("Style") );

_SECTION_END();
 

pkgmtnl

Well-Known Member
#2
Also Try

Plot (VWAP,"VWAP",ParamColor( "Color", colorCycle ), ParamStyle("Style") );
Plot (ref(VWAP,-1),"VWAP1",ParamColor( "Color", colorCycle ), ParamStyle("Style") );
Plot (REF(VWAP,-2),"VWAP2",ParamColor( "Color", colorCycle ), ParamStyle("Style") );
Plot (REF(VWAP,-3),"VWAP3",ParamColor( "Color", colorCycle ), ParamStyle("Style") );
Plot (REF(VWAP,-4),"VWAP4",ParamColor( "Color", colorCycle ), ParamStyle("Style") );
 

Similar threads