PureBytes Links
Trading Reference Links
|
Okay, I think this is it...
Mike
/* vwma script demo */
EnableScript("VBScript");
Vi =.67*MA(V,50); //volume increment
Vr = V/Vi; //volume ratio
VWMA = C;
<%
Vr = AFL("Vr")
CDays = 10
Volume = AFL("Volume")
Close = AFL("Close")
VWMA = AFL("VWMA")
B = AFL("B")
for i = Days to UBound(Vr)
VrT = CDays
PVSum = 0
VSum = 0
j = i
do while VrT > 0.001 AND j>=0
if Vr(j)<VrT then
VrTT = Vr(j)
else
VrTT = VrT
end if
PVSum = PVSum + Close(j)*VrTT
VSum = VSum + VrTT
VrT = VrT - VrTT
j = j-1
Loop
if VSum >0 then
VWMA(i) = PVSum/VSum
B(i) = VSum*100
end if
next
AFL.Var("VWMA") = VWMA
%>
Plot(C, "", 1, 64);
Plot(VWMA, "VWMA", 2);
Plot(MA(C,10),"", 3);
Plot(MA(C*V,10)/MA(V,10),"",4);
----- Original Message -----
From: "Mike Lucero" <m.lucero@xxxx>
To: <amibroker@xxxxxxxxxxxxxxx>
Sent: Wednesday, July 10, 2002 4:41 PM
Subject: Re: [amibroker] Volume Weighted Moving Averages
Here's my attempt to program vwma as described below. Unfortunately, I don't
know VB so this doesn't work. Perhaps someone can fix my syntax and repost.
Thanks,
Mike
----- Original Message -----
From: "Mike Lucero" <m.lucero@xxxx>
To: <amibroker@xxxxxxxxxxxxxxx>
Sent: Wednesday, July 10, 2002 1:36 PM
Subject: Re: [amibroker] Volume Weighted Moving Averages
see !! below
----- Original Message -----
From: "b519b" <b519b@xxxx>
To: <amibroker@xxxxxxxxxxxxxxx>
Sent: Wednesday, July 10, 2002 7:04 AM
Subject: [amibroker] Volume Weighted Moving Averages
--- In amibroker@xxxx, "nirvana1x" <nirvanaiam@xxxx> wrote:
> ..can anyone explain what is meant
> by the last paragraph of b519b's
> post below.
John, the last paragraph in my post is a direct quotation from the
help files of the Australia distributor of MetaStock. Here is the
URL:
www.paritech.com.au/education/technical/indicators/trend/movavg-6.asp
I find their definition to be both complex and unclear. Here it is
with my COMMENTS/QUESTIONS IN UPPERCASE:
"A volume adjusted moving average is calculated as follows:
"1. Calculate the average volume using every time period in the
chart.
WHY USE 'EVERY TIME PERIOD' TO GET THE AVERAGE. WOULD IT NOT MAKE
MORE SENSE TO JUST USE THE NUMBER OF BARS SPECIFIED IN THE MOVING
AVERAGE. IF I AM CONSTRUCTING A 20 DAY MOVING AVERAGE USING 100
YEARS OF DATA HISTORY FOR THE DOW JONES WHY WOULD I WANT TO KNOW
THE AVERAGE VOLUME FOR THE ENTIRE 100 YEARS? FOR EVERY 20 DAY PERIOD
OVER THE 100 YEARS, YES. BUT FOR THE ENTIRE 100 YEARS, WHY IN THE
WORLD? ALSO, THIS STEPS IMPLIES I WOULD GET A DIFFERENT RESULT IF I
ONLY HAD 50 YEARS OR 5 YEARS OF DATA. POINT 1 IS A VERY CONFUSING
STATEMENT IF TAKEN LITERALLY.
"2. Calculate the volume increment by multiplying the average volume
by 0.67.
WHERE IN THE WORLD DOES 0.67 COME FROM? I DO NOT HAVE A CLUE. ALSO
WHAT IS MEANT BY 'VOLUME INCREMENT' IS NOT DEFINED.
!!This is the definition of "volume increment". I believe this was mainly
done to draw variable-width bars. We're trying to calculate a value so that
small-volume days will be one bar wide and high-volume days will be
multiple-bars wide. A small volume day will be one day, and a day with 2
times average volume will be be 3 days wide. Then, the calculation of ma's
naturally follows.
"3. Calculate each period's volume ratio by dividing each period's
actual volume by the volume increment.
WHAT IS EACH PERIOD'S VOLUME RATIO? IS IT THE RATIO OF THE ACTUAL
VOLUME TO THE VOLUME CALCULATED IN STEP 1? OR IS IT SOME OTHER
RATIO? AND THE QUESTION OF THE 'VOLUME INCREMENT' COMES UP AGAIN.
!! This is the definition of "volume ratio."
"Starting at the most recent time period and working backwards,
multiply each period's price by the period's volume ratio and
cumulatively sum these values until the user-specified number of
volume increments is reached. Note that only a fraction of the last
period's volume will likely be used.
WHAT IN THE WORLD DOES THE LAST SENTENCE MEAN?
!! These are directions on how to program the MA. The only thing I see as a
question is whether to round off the "volume ratios" to integers. I guess
it's unnecessary.
AFTER READING THAT EXPLAINATION OF VOLUME WEIGHTED MOVING AVERAGES I
AM TOTALLY CONFUSED. CAN ANYONE SHED SOME LIGHT ON THE SUBJECT OR
POINT TO WEBSITE WITH CLEARER EXPLANATIONS?
B
Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
|