PureBytes Links
Trading Reference Links
|
Every floating point representation has limited precision. The inaccuracy in AmiBroker is below 0.00001% level and in almost all cases it is acceptable.
I will, however, consider your suggestion in one of the future releases.
Best regards,
Tomasz Janeczko
amibroker.com
----- Original Message -----
From: Udo.Harke@xxxx
To: amibroker@xxxxxxxxxxxxxxx
Sent: Thursday, April 25, 2002 6:17 PM
Subject: [amibroker] Inaccuray of calculated data with AFL code of AmiBroker
Hi,
Although AmiBroker has an extensive library of functions and indicators available, care should be taken when computing sophisticated formulas with AmiBroker:
Fairly recently, a member of this group - CS - provided me with the AFL code for the calculation of the TRIX Indicator. However, a comparison of thetriple exponential functions using AmiBroker produced an inaccuracy as of the 5th digit to the right of the decimal point in comparison with the pre-programmed TRIX Indicator being in the AFL library!
Presumably, I think that the rationale this deviation derives from the fact that AmiBroker only utilizes floating-type numbers of the type name double instead of long double to be absolutely required for such kind of computations.
In order to avoid those variations henceforth, maybe we should ask for having long double data types to achieve higher accuracies for tedious and cumbersome calculations?
For your convenience, I would like to encourage you to test this little code sample with TRIX(9), for example and compare your result in the AA window:
// Our data array uses the closing prices for the entire computation:
quote = close;
// The period is set to 9 just like the pre-programmed default value:
period = 9;
// Calculating the triple exponentially smoothed function:
y = EMA(EMA(EMA(quote, period), period), period);
// Finally, we calculate this indicator by virtue of AFL code:
TRX = 1000 * (y - Ref(y, -1)) / Ref(y, -1);
// We want to see all the data (stocks) in our current database:
filter = 1;
// Here are the calculates data in the listed columns of the AA window:
numColumns = 2;
column0 = TRX;
column1 = TRIX(9); // This is the pre-programmed TRIX Indicator having 9 bars as the default period!
column0Format = column1Format = 1.7;
column0Name = "TRX";
column1Name = "TRIX(9)";
// Displaying the computes results of this little program with the pre-programmed TRIX(9) Indicator:
maxGraph = 1;
graph0 = TRX;
graph0Name = "TRX";
graph0Color = 25; // We want to display the graph in light red color.
graph0Style = 1;
graphxSpace = 2;
Thank you for providing me with your comments in this matter!
Regards,
Udo
Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.
------=_NextPart_001_47A7_01C1EC92.AA540D20
Content-Type: text/html;
charset="windows-1250"
Content-Transfer-Encoding: quoted-printable
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD><TITLE id=ridTitle>Schlicht</TITLE><BASE
href="file://C:\Programme\Gemeinsame Dateien\Microsoft Shared\Stationery\">
<META http-equiv=Content-Type content="text/html; charset=windows-1250">
<STYLE>BODY {
MARGIN-TOP: 25px; FONT-SIZE: 10pt; MARGIN-LEFT: 25px; COLOR: #000000; FONT-FAMILY: Arial, Helvetica
}
P.msoNormal {
MARGIN-TOP: 0px; FONT-SIZE: 10pt; MARGIN-LEFT: 0px; COLOR: #ffffcc; FONT-FAMILY: Helvetica, "Times New Roman"
}
LI.msoNormal {
MARGIN-TOP: 0px; FONT-SIZE: 10pt; MARGIN-LEFT: 0px; COLOR: #ffffcc; FONT-FAMILY: Helvetica, "Times New Roman"
}
</STYLE>
<META content="MSHTML 6.00.2600.0" name=GENERATOR></HEAD>
<BODY id=ridBody bgColor=#ffffff
background=cid:47a501c1ec81$e6ba7440$168e62d9@x...>
<DIV><FONT face="Arial CE">Udo,</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face="Arial CE">Every floating point representation has limited
precision. The inaccuracy in AmiBroker is below 0.00001% level and in almost all
cases it is acceptable. </FONT></DIV>
<DIV>I will, however, consider your suggestion in one of the future
releases.</DIV>
<DIV><FONT face="Arial CE"></FONT><FONT face="Arial CE"></FONT><BR>Best
regards,<BR>Tomasz Janeczko<BR>amibroker.com</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">----- Original Message ----- </DIV>
<DIV
style="BACKGROUND: #e4e4e4; FONT: 10pt arial; font-color: black"><B>From:</B>
<A title=Udo.Harke@xxxx
href="mailto:Udo.Harke@xxxx">Udo.Harke@xxxx</A> </DIV>
<DIV style="FONT: 10pt arial"><B>To:</B> <A title=amibroker@xxxxxxxxxx
href="mailto:amibroker@xxxxxxxxxxxxxxx">amibroker@xxxxxxxxxxxxxxx</A> </DIV>
<DIV style="FONT: 10pt arial"><B>Sent:</B> Thursday, April 25, 2002 6:17
PM</DIV>
<DIV style="FONT: 10pt arial"><B>Subject:</B> [amibroker] Inaccuray of
calculated data with AFL code of AmiBroker</DIV>
<DIV><BR></DIV>
<DIV><FONT face="Courier New"></FONT> </DIV>
<DIV>Hi,</DIV>
<DIV> </DIV>
<DIV>Although <EM>AmiBroker</EM> has an extensive library of functions and
indicators available, care should be taken when computing sophisticated
formulas with <EM>AmiBroker</EM>:</DIV>
<DIV> </DIV>
<DIV>Fairly recently, a member of this group - <EM>CS</EM> - provided me
with the AFL code for the calculation of the <FONT color=#0000ff>TRIX</FONT>
Indicator. However, a comparison of the triple exponential functions using
AmiBroker produced an inaccuracy as of the 5th digit to the right of the
decimal point in comparison with the pre-programmed <FONT
color=#0000ff>TRIX</FONT> Indicator being in the AFL library!</DIV>
<DIV>Presumably, I think that the rationale this deviation derives from the
fact that AmiBroker only utilizes floating-type numbers of the type name <FONT
face=Verdana color=#0000ff>double</FONT> instead of <FONT face=Verdana
color=#0000ff>long double</FONT> to be absolutely required for such kind of
computations.</DIV>
<DIV>In order to avoid those variations henceforth, maybe we should ask for
having <FONT face=Verdana color=#0000ff>long double</FONT> data typesto
achieve higher accuracies for tedious and cumbersome calculations?</DIV>
<DIV> </DIV>
<DIV>For your convenience, I would like to encourage you to test this little
code sample with <FONT face=Verdana color=#0000ff>TRIX(9)</FONT>, forexample
and compare your result in the AA window:</DIV>
<DIV> </DIV>
<DIV><FONT face=Verdana color=#000080 size=1>// Our data array usesthe
closing prices for the entire computation:</FONT></DIV>
<DIV><FONT face=Verdana color=#000080 size=1>quote = close;</FONT></DIV>
<DIV><FONT face=Verdana color=#000080 size=1></FONT> </DIV>
<DIV><FONT face=Verdana color=#000080 size=1>// The period is set to 9 just
like the pre-programmed default value:<BR>period = 9;</FONT></DIV>
<DIV><FONT face=Verdana color=#000080 size=1></FONT> </DIV>
<DIV><FONT face=Verdana color=#000080 size=1>// Calculating the triple
exponentially smoothed function:<BR>y = EMA(EMA(EMA(quote, period), period),
period);</FONT></DIV>
<DIV><FONT face=Verdana color=#000080 size=1></FONT> </DIV>
<DIV><FONT face=Verdana color=#000080 size=1>// Finally, we calculate this
indicator by virtue of AFL code:</FONT></DIV>
<DIV><FONT face=Verdana color=#000080 size=1>TRX = 1000 * (y - Ref(y, -1)) /
Ref(y, -1);</FONT></DIV>
<DIV><FONT face=Verdana color=#000080 size=1></FONT> </DIV>
<DIV><FONT face=Verdana color=#000080 size=1>// We want to see all the data
(stocks) in our current database:</FONT></DIV>
<DIV><FONT face=Verdana color=#000080 size=1>filter = 1;</FONT></DIV>
<DIV><FONT face=Verdana color=#000080 size=1></FONT> </DIV>
<DIV><FONT face=Verdana color=#000080 size=1>// Here are the calculates data
in the listed columns of the AA window:</FONT></DIV>
<DIV><FONT face=Verdana color=#000080 size=1>numColumns = 2;</FONT></DIV>
<DIV><FONT face=Verdana color=#000080 size=1></FONT> </DIV>
<DIV><FONT face=Verdana color=#000080 size=1>column0 = TRX;</FONT></DIV>
<DIV><FONT face=Verdana color=#000080 size=1>column1 = TRIX(9); // This is the
pre-programmed TRIX Indicator having 9 bars as the default
period!</FONT></DIV>
<DIV><FONT face=Verdana color=#000080 size=1></FONT> </DIV>
<DIV><FONT face=Verdana color=#000080 size=1>column0Format = column1Format =
1.7;</FONT></DIV>
<DIV><FONT face=Verdana color=#000080 size=1></FONT> </DIV>
<DIV><FONT face=Verdana color=#000080 size=1>column0Name = "TRX";</FONT></DIV>
<DIV><FONT face=Verdana color=#000080 size=1>column1Name =
"TRIX(9)";</FONT></DIV>
<DIV><FONT face=Verdana color=#000080 size=1></FONT> </DIV>
<DIV><FONT face=Verdana color=#000080 size=1>// Displaying the computes
results of this little program with the pre-programmed TRIX(9)
Indicator:</FONT></DIV>
<DIV><FONT face=Verdana color=#000080 size=1>maxGraph = 1;</FONT></DIV>
<DIV><BR><FONT face=Verdana color=#000080 size=1>graph0 = TRX;</FONT></DIV>
<DIV><FONT face=Verdana color=#000080 size=1>graph0Name = "TRX";</FONT></DIV>
<DIV><FONT face=Verdana color=#000080 size=1>graph0Color = 25; //We want to
display the graph in light red color.</FONT></DIV>
<DIV><FONT face=Verdana color=#000080 size=1>graph0Style = 1;</FONT></DIV>
<DIV><FONT face=Verdana color=#000080 size=1></FONT> </DIV>
<DIV><FONT face=Verdana color=#000080 size=1>graphxSpace = 2;</FONT></DIV>
<DIV> </DIV>
<DIV> </DIV>
<DIV>Thank you for providing me with your comments in this matter!</DIV>
<DIV> </DIV>
<DIV>Regards,</DIV>
<DIV> </DIV>
<DIV>Udo</DIV>
<DIV> </DIV><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_47A7_01C1EC92.AA540D20--
Attachment:
Description: ""
|