PureBytes Links
Trading Reference Links
|
Exactly - StDev() is a MOVING standard deviation - as the one needed to calculate bollinger bands for example.
It returns ARRAY of results - not a single value.
To get single value you just need to specify calucation range for all bars and then take last value of it:
onestdev = LastValue( StDev( ARRAY, LastValue( cum(1) ) - 1 ) );
Best regards,
Tomasz Janeczko
===============
AmiBroker - the comprehensive share manager.
http://www.amibroker.com
----- Original Message -----
From: Louw Coetzer
To: amibroker@xxxxxxxxxxxxxxx
Sent: Sunday, September 09, 2001 10:28 PM
Subject: [amibroker] Standard Deviation
Tomasz
I understand that there is a "stdev" function built into the AFL but it seems as if this is a moving standard deviation....I include a small piece of an example I came across on the net ...what this person is explaining here is exactly what I whish to apply to a price graph....please help with thetransformation to AFL !
To understand how standard deviation is calculated, let's work through a couple of very basic examples. We'll use two families, the Smiths and the Joneses. Both families have three children, and for both families, the average age of the children is 10. However, the range of the children's ages is quite different for the two families. The Smiths have an eight year old daughter, a 10 year old son, and a 12 year old daughter. The Joneses have a one-year old son, a nine year old daughter, and a 20-year-old son. Both sets of children have the same average age, but we can use standard deviation to measure the variance around that mean, or average.
To calculate standard deviation, we first find the average ofthe children. We then subtract each child's age from the average age. Then, we square the resulting number. (By squaring the numbers, we eliminate any negative numbers from the equation.) For the Smith family, we end up with:
We then add these numbers together, divide by the total number of children, and take the square root of the whole thing:
I have manually applied these formulas to an Excel spreadsheet and found a big difference between the "stdev" graph in AB and the graph in the spreadsheet....I also have a book about unit trust that lists all unit trust in detail and also provides a small graph on the deviations, I tested my spreadsheet against a few of these printed graphs and found them to be the same,but different than the one's in AB....thus I assume there must be another kind of standard deviation calculation for AB like in the example above.
If I'm understanding the concept of Standard Deviations wrong, than please except my apologies for this question.
Kind regards
Louw Coetzer
Yahoo! Groups Sponsor
Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.
------=_NextPart_001_0042_01C139D5.D3695F00
Content-Type: text/html;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=iso-8859-1">
<META content="MSHTML 5.50.4134.600" name=GENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=#ffffff>
<DIV><FONT face=Tahoma><FONT size=2>Dear <FONT face=Arial>Louw
Coetzer,</FONT></FONT></FONT></DIV>
<DIV><FONT face=Arial></FONT> </DIV>
<DIV><FONT face=Arial size=2>Exactly - StDev() is a MOVING standard deviation -
as the one needed to calculate bollinger bands for example.</FONT></DIV>
<DIV><FONT face=Arial size=2>It returns ARRAY of results - not a single
value.</FONT></DIV>
<DIV><FONT face=Arial size=2>To get single value you just need to specify
calucation range for all bars and then take last value of it:</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>onestdev = LastValue( StDev( ARRAY, LastValue(
cum(1) ) - 1 ) );</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV>Best regards,<BR>Tomasz Janeczko<BR>===============<BR>AmiBroker - the
comprehensive share manager.<BR><A
href="http://www.amibroker.com">http://www.amibroker.com</A><BR></DIV>
<BLOCKQUOTE
style="PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">
<DIV style="FONT: 10pt arial ce">----- Original Message ----- </DIV>
<DIV
style="BACKGROUND: #e4e4e4; FONT: 10pt arial ce; font-color: black"><B>From:</B>
<A title=lcoetzer@xxxx
href="mailto:lcoetzer@xxxx">Louw Coetzer</A> </DIV>
<DIV style="FONT: 10pt arial ce"><B>To:</B> <A title=amibroker@xxxxxxxxxxxxx
href="mailto:amibroker@xxxxxxxxxxxxxxx">amibroker@xxxxxxxxxxxxxxx</A> </DIV>
<DIV style="FONT: 10pt arial ce"><B>Sent:</B> Sunday, September 09, 2001 10:28
PM</DIV>
<DIV style="FONT: 10pt arial ce"><B>Subject:</B> [amibroker] Standard
Deviation</DIV>
<DIV><FONT face=Tahoma size=1></FONT><BR></DIV>
<DIV><FONT face=Arial><STRONG><EM>Tomasz</EM></STRONG></FONT></DIV>
<DIV><FONT face=Tahoma size=1></FONT> </DIV>
<DIV><FONT face=Arial size=2>I understand that there is a "stdev" function
built into the AFL but it seems as if this is a moving standard deviation....I
include a small piece of an example I came across on the net ...what this
person is explaining here is exactly what I whish to apply to a price
graph....please help with the transformation to AFL !</FONT></DIV>
<DIV><FONT face=Tahoma size=1></FONT> </DIV>
<DIV><FONT face=Arial size=2>
<TABLE cellSpacing=0 cellPadding=0 width=605 border=0>
<TBODY>
<TR vAlign=top align=left>
<TD width=605 colSpan=3 height=227>
<TABLE cellSpacing=1 cellPadding=0 border=0>
<TBODY>
<TR vAlign=top align=left>
<TD width=359 height=225>
<P><FONT face="Times New Roman,Times,Times NewRoman"
color=#0000ff>To understand how standard deviation is calculated,
let's work through a couple of very basic examples. We'll usetwo
families, the Smiths and the Joneses. Both families have three
children, and for both families, the average age of the children
is 10. However, the range of the children's ages is quite
different for the two families. The Smiths have an eight yearold
daughter, a 10 year old son, and a 12 year old daughter. The
Joneses have a one-year old son, a nine year old daughter, and a
20-year-old son. Both sets of children have the same average age,
but we can use standard deviation to measure the variance around
that mean, or average.</FONT></P>
<P><FONT color=#0000ff><FONT
face="Times New Roman,Times,Times NewRoman">To calculate standard
deviation, we first find the average of the children. We then
subtract each child's age from the average age. Then, we square
the resulting number. (By squaring the numbers, we eliminate any
negative numbers from the equation.) For the Smith family, weend
up with:<BR></FONT> </FONT></P></TD></TR></TBODY></TABLE></TD></TR>
<TR vAlign=top align=left>
<TD width=244 height=10><IMG height=1
src="cid:003d01c139c5$0f95ca60$0100007f@xxxx" width=244 border=0></TD>
<TD width=244><IMG height=1 src="cid:003d01c139c5$0f95ca60$0100007f@xxxx"
width=244 border=0></TD>
<TD width=117><IMG height=1 src="cid:003d01c139c5$0f95ca60$0100007f@xxxx"
width=117 border=0></TD></TR>
<TR vAlign=top align=left>
<TD colSpan=2 height=25></TD>
<TD vAlign=top align=left width=117 rowSpan=2><IMG height=71
alt=equations src="cid:003e01c139c5$0f9d6b80$0100007f@xxxx" width=89
border=0></TD></TR>
<TR vAlign=top align=left>
<TD height=73></TD>
<TD vAlign=top align=left width=244><IMG height=30 alt="Average age"
src="cid:003f01c139c5$0f9d6b80$0100007f@xxxx" width=217 border=0></TD></TR>
<TR vAlign=top align=left>
<TD width=605 colSpan=3 height=47>
<TABLE cellSpacing=1 cellPadding=0 border=0>
<TBODY>
<TR vAlign=top align=left>
<TD width=243> </TD>
<TD width=359 height=45>
<P><FONT color=#0000ff><FONT
face="Times New Roman,Times,Times NewRoman">We then add these
numbers together, divide by the total number of children, andtake
the square root of the whole
thing:<BR></FONT> </FONT></P></TD></TR></TBODY></TABLE></TD></TR>
<TR vAlign=top align=left>
<TD colSpan=3 height=15></TD></TR>
<TR vAlign=top align=left>
<TD height=66></TD>
<TD vAlign=top align=left width=361 colSpan=2><IMG height=37
alt="Standard Deviation" src="cid:004001c139c5$0f9d6b80$0100007f@xxxx"
width=278 border=0></TD></TR></TBODY></TABLE></FONT></DIV>
<DIV><FONT face=Arial size=2>I have manually applied these formulas to an
Excel spreadsheet and found a big difference between the "stdev" graph inAB
and the graph in the spreadsheet....I also have a book about unit trust that
lists all unit trust in detail and also provides a small graph on the
deviations, I tested my spreadsheet against a few of these printed graphsand
found them to be the same, but different than the one's in AB....thus I assume
there must be another kind of standard deviation calculation for AB like in
the example above.</FONT></DIV>
<DIV> </DIV>
<DIV align=center><FONT face=Arial size=2><EM>If I'm understanding the concept
of Standard Deviations wrong, than please except my apologies for this
question.</EM></FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>Kind regards</FONT></DIV>
<DIV> </DIV>
<DIV> </DIV>
<DIV><FONT face=Arial size=2>Louw Coetzer</FONT></DIV><BR><BR><TT>Your
use of Yahoo! Groups is subject to the <A
href="http://docs.yahoo.com/info/terms/">Yahoo! Terms of Service</A>.</TT>
<BR></BLOCKQUOTE></BODY></HTML>
------=_NextPart_001_0042_01C139D5.D3695F00--
Attachment:
Description: ""
Attachment:
Description: ""
Attachment:
Description: ""
Attachment:
Description: ""
|