PureBytes Links
Trading Reference Links
|
I found the following in some old code written by someone else.
This is not AFL but you can see the way the weighted average is created.
Is this the mathematically correct way?
f1 = fselx (In AFL this would be f1 = Foreign("FSELX","C") )
w1 = 60
f2 = fsvlx
w2 = 30
f3 = fsrbx
w3 = 10
//Sum their weighted exponential growth rates.
RateSum = w1 * Log(f1 / First(f1)) +
w2 * Log(f2 / First(f2)) +
w3 * Log(f3 / First(f3))
//Average the weighted exponential growth rates.
RateAvg = RateSum / (w1 + w2 + w3)
//Create a price series using the new growth rates.
WeightedAvg = Pow(10, RateAvg)
_____
From: Mr. Valley [mailto:valleymj@xxxxxxxxxxx]
Sent: Tuesday, January 23, 2007 12:32 PM
To: ken45140@xxxxxxxxx
Subject: RE: [AmiBroker] Weighted Average
If the total of the four symbols = 100%
Then each are a portion of 100%, then what portion is each to the total?
-----Original Message-----
From: amibroker@xxxxxxxxxxxxxxx [mailto:amibroker@xxxxxxxxxxxxxxx]On Behalf
Of Ken Close
Sent: Tuesday, January 23, 2007 10:25 AM
To: amibroker@xxxxxxxxxxxxxxx
Subject: [amibroker] Weighted Average
What would be the correct way to get a weighted average of three or four
tickers, with the weightings unequal?
WtAvg = Wt1 * Price1 + Wt2 * Price2 + Wt3 * Price3. ??????
I am asking because I thought I remember seeing here or on another list that
doing what I wrote above will give an incorrect result. But I do not
remember what alternative was suggested.
Any help?
Thanks,
Ken
Content-Description: "AVG certification"
No virus found in this incoming message.
Checked by AVG Free Edition.
Version: 7.5.432 / Virus Database: 268.17.5/645 - Release Date: 1/22/2007 4:10 PM
|