Type : Function, Name : VWAP_SMA
{ VWAP SMA }
input:
Price(NumericSeries),length(NumericSimple);
vars:
PV(0),
Vol(0),
dayBar1(0),
len(0),
it(0);
if date <> date[1] then
dayBar1 = barNumber;
len = MinList(BarNumber-dayBar1,length);
PV = price * Ticks;
Vol = Ticks;
value1 = summation(Vol,len);
if value1 <> 0 then
it=summation(PV,len)/value1
else
it=Price;
VWAP_SMA = it;
Type : Indicator, Name : VWAP_MA
{ VWAP MA }
input:
Price(AvgPrice),length(25),upColor(cyan),dnColor(red);
vars:
it(0);
it = VWAP_SMA(Price,length);
plot1(it,»VWAP MA»);
if plot1 > plot1[1] then setplotcolor(1,upColor);
if plot1 < plot1[1] then setplotcolor(1,dnColor);