Quote from Rabbitone:
inputs: Price(Close), Length(5);
vars: sx(0), sy(0), ave(0), j(0);
if length >= 1 then begin
sx = 0;
sy = 0;
for j = 0 to (Length-1) begin
sx = sx + Price[j]*Volume[j];
sy = sy + Volume[j];
end;
if sy > 0 then begin
ave = sx / sy;
end else begin
{ if volume is zero, just return simple average }
ave = sx / length;
end;
plot1(ave, "VWA");
end;
Quote from tortoise:
Thanks!
Question, though: In EL-land, doesn't "volume" refer to "upticks" only? If so, shouldn't one use "ticks" -- which, as I understand it, incorporates upticks and downticks, thus giving you volume?