[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Volume weighted MA



PureBytes Links

Trading Reference Links

Piranhas R Us wrote:

> Is there a volume-weighted moving average? Could
> someone share the code?
> Thanks,  
> 
> =====
> Julian
> 
Julian this is my version. Enjoy,


Inputs:        Price(NumericSeries), Length(NumericSeries);
Vars:        X(0), SumPV(0), SumV(0);

if CurrentBar<=Length then ZaF_Vol_WMA=PRICE;

if CurrentBar>Length then begin
for X= 0 to Length-1 begin
SumV=SumV+0.001*Volume[X];
SumPV=SumPV+0.001*Price[X]*Volume[X];
end;

ZaF_Vol_WMA=iff(SumV<>0, SumPV/SumV, Price);

SumV=0;
SumPV=0;
end;


Attachment: Description: "VOL_WMA.ELA"