PureBytes Links
Trading Reference Links
|
Issue 3/2000 AmiBroker Tips weekly newsletter.
Issue 3/2000.
Copyright (C)2000 Tomasz Janeczko.
All back issues available from:
http://www.amibroker.com/newsletter/
IN THIS ISSUE
1 Welcome
2 Tutorial: Working with custom indicators
3 AFL Formula Library: Measuring volatility - Average True Range and Chaikin's Volatility
4 Tip of the week: Adding your own ASCII import formats
1 Welcome
Welcome to the 3rd issue of AmiBroker Tips newsletter. In this issue a new regular column will start: "Tutorial". This column is intended for novice users to learn about basic AmiBroker's functionality. This column will be also the basis of a complete tutorial that will be released next year.
In AFL corner I will discuss two methods of plotting volatility graphs. Please remember that all formulas presented in this column will also appear inhttp://www.amibroker.com/library.html
By the way: Do you find this newsletter useful? Have any comments/suggestions or article ideas. Please don't hesitate to drop a line to newsletter@xxxxxxxxxxxxxx
2 Tutorial: Working with custom indicators
AmiBroker allows the user to define his/her own indicators written in flexible AFL (AmiBroker Formula Language). You can find the description of this language in AFL Reference Guide section of user's guide. Here I will present basic steps needed to define and display your own custom indicator. In this example we will define an "indicator" that will show line volume graph (opposite to built-in bar volume graph).
Just follow these steps
1.. Select Analysis->Indicator Builder option from the menu as shown below:
2.. You will see the following dialog displayed on the screen:
then select one of the indicators listed on the left side of the window. Selected item will be highlighted.
3.. Single-click this item and it will change to the editable field as shown below:
Now you can edit the name of the custom indicator. Give it the name "My own indicator"
4.. Then click in the the formula field, delete existing text (if any) inthe box and type in the following formula:
graph0 = volume;
This formula instructs AmiBroker that graph number 0 should plot volume array.
5.. Select Scaling - Automatic and Grid lines: Middle as shown in the picture above
6.. Click "Apply" and then "Close" Indicator Builder
Now you are ready to use your first custom indicator - please select menu Insert->Custom Indicators->My own indicator as shown in the picture below:
A new chart pane will be displayed showing volume line chart.
For further reference on using Indicator Builder please consult Environment- Indicator Builder and AmiBroker Formula Language - AFL Tools sections ofAmiBroker User's guide.
3 AFL Formula Library: Measuring volatility - Average True Range and Chaikin's Volatility
Volatility is a general term used to describe the magnitude of day-to-day fluctuations in prices (independent of direction). Generally, changes in volatility tend to lead changes in prices. There are several ways to measure the volatility. In this issue I will describe the formulas that use two, probably the simplest, approaches to this task.
Average True Range
The True Range indicator is defined by Wilder to be the greatest of the following for each period:
a.. the distance from today's high to today's low
b.. the distance from yesterday's close to today's high
c.. the distance from yesterday's close to today's low
The Average True Range is simply the average of the true ranges over the past n periods. AmiBroker has built in AFL function for that purpose - atr( periods ). You can use simple 14 day ATR as a volatility indicator using thefollowing formula:
graph0 = atr( 14 );
Alternatively, you can add some more smoothing using the following formula:
graph0 = ema( atr( 14 ) , 5 );
Since atr() itself uses moving average in its construction the latter formula uses in fact double smoothing and exhibits more delay than the first formula.
For both formulas high readings of the indicator mean high market volatility while low readings mean low volatility.
Chaikin's Volatility
Marc Chaikin uses different approach to measure volatility. His volatility indicator compares the spread between a security's high and low prices. This is done by first calculating a moving average of the difference between the daily high and low prices and then calculating the rate of change of that moving average. Marc Chaikin recommends 10-periods for both the moving average and the rate of change. The AFL formula for Chaikin's volatility is:
graph0 = roc( ema( high-low, 10), 10);
4 Tip of the week: Adding your own import formats
Note: This functionality is available only in Windows version of AmiBroker
AmiBroker can use not only default.format definition file but also other user-specified files. File types, filters and format definition files are specified in import.types file, located in AmiBroker's main directory.
If such file exists you will see your types in the "Files of type" combo-box of ASCII importer file dialog and when you select one - appropriate filter will be used and after selecting some files and clicking OK - importer will use specified ".format" file. In that way you can define as many text-based data formats as you like and AmiBroker will be able to "understand" them all.
The user can prepare/modify import.types file with the description of supported ASCII formats and filters to use. The file could be edited in any plain text editor such as Notepad.
The format of import.types file is:
<Descriptive name>|<File filter>|<definition file name>
Note vertical line characters ( | ) between these three fields. Example import.types file looks as follows:
Default ASCII (*.*)|*.*|default.format
Yahoo's CSV (*.csv)|*.csv|yahoo.format
Metastock ASCII (*.mst)|*.mst|metastock.format
Omega SC ASCII (*.txt)|*.txt|omega.format
S-Files (s*.*)|s*.*|sfile.format
C-Files (c*.*)|c*.*|cfile.format
Sharenet DAT (*.dat)|*.dat|dat.format
In order to add you own import format you will need to:
1.. Define your .format file (for example myown.format) - this is described in Data management - Import from ASCII section of AmiBroker's user guide.
2.. Add the following line to import.types file:
My own format (*.*)|*.*|myown.format
After saving the files please launch AmiBroker and open ASCII file import dialog - you should see your own type shown in "Files of type" combo box.
.... and that's all for this week - hope you enjoyed reading
--------------------------------------------------------------------------------
AmiBroker Tips weekly newsletter. Issue 3/2000. Copyright (C)2000 Tomasz Janeczko. All back issues available from: http://www.amibroker.com/newsletter/
------=_NextPart_001_0013_01C05195.FCE95160
Content-Type: text/html;
charset="iso-8859-2"
Content-Transfer-Encoding: quoted-printable
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META content="text/html; charset=iso-8859-2" http-equiv=Content-Type>
<META content="MSHTML 5.00.2614.3500" name=GENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY>
<DIV>
<TABLE border=0 cellPadding=0 cellSpacing=0 width="100%">
<TBODY>
<TR>
<TD>
<DIV align=center><B><IMG alt="" border=0 hspace=0
src="cid:000d01c0518d$9afbb680$0100007f@xxxx"><BR>Issue 3/2000</B></DIV></TD>
<TD width="15%"><FONT size=-2>AmiBroker Tips weekly newsletter.<BR>Issue
3/2000.<BR>Copyright (C)2000 Tomasz Janeczko. <BR>All back
issues available from:<BR><A
href="http://www.amibroker.com/newsletter/">http://www.amibroker.com/newsletter/</A></FONT></TD></TR></TBODY></TABLE>
<H5>IN THIS ISSUE</H5>
<H5>1 Welcome<BR>2 Tutorial: Working with custom indicators<BR>3 AFL Formula
Library: Measuring volatility - Average True Range and Chaikin's Volatility<BR>4
Tip of the week: Adding your own ASCII import formats</H5>
<H5>1 Welcome</H5>
<P>Welcome to the 3rd issue of AmiBroker Tips newsletter. In this issue a new
regular column will start: "Tutorial". This column is intended for novice users
to learn about basic AmiBroker's functionality. This column will be also the
basis of a complete tutorial that will be released next year. </P>
<P>In AFL corner I will discuss two methods of plotting volatility graphs.
Please remember that all formulas presented in this column will also appearin
<A
href="http://www.amibroker.com/library.html">http://www.amibroker.com/library.html</A>
<BR></P>
<P>By the way: Do you find this newsletter useful? Have any comments/suggestions
or article ideas. Please don't hesitate to drop a line to <A
href="mailto:newsletter@xxxx">newsletter@xxxx</A></P>
<H5>2 Tutorial: Working with custom indicators</H5>
<P>AmiBroker allows the user to define his/her own indicators written in
flexible AFL (AmiBroker Formula Language). You can find the description of this
language in AFL Reference Guide section of user's guide. Here I will present
basic steps needed to define and display your own custom indicator. In this
example we will define an "indicator" that will show line volume graph (opposite
to built-in bar volume graph). </P>
<P>Just follow these steps</P>
<OL>
<LI>Select <I>Analysis->Indicator Builder</I> option from the menu as shown
below: <BR><BR><IMG alt="" border=0 hspace=0
src="cid:000e01c0518d$9b0c7f60$0100007f@xxxx"
style="HEIGHT: 142px; WIDTH: 182px"><BR> <BR><BR></LI>
<LI>You will see the following dialog displayed on the screen:<BR><BR><IMG
alt="" border=0 hspace=0
src="cid:000f01c0518d$9b0c7f60$0100007f@xxxx"><BR> <BR>then select one of
the indicators listed on the left side of the window. Selected item will be
highlighted.<BR><BR></LI>
<LI>Single-click this item and it will change to the editable field as shown
below:<BR><BR><IMG alt="" border=0 hspace=0
src="cid:001001c0518d$9b0c7f60$0100007f@xxxx"><BR><BR>Now you can edit the name
of the custom indicator. Give it the name "My own indicator" </LI>
<LI>Then click in the the formula field, delete existing text (if any) inthe
box and type in the following formula: <BR>graph0 = volume; <BR>This formula
instructs AmiBroker that graph number 0 should plot volume array.<BR></LI>
<LI>Select Scaling - Automatic and Grid lines: Middle as shown in the picture
above </LI>
<LI>Click "Apply" and then "Close" Indicator Builder </LI></OL>
<P>Now you are ready to use your first custom indicator - please select menu
Insert->Custom Indicators->My own indicator as shown in the picture
below:</P>
<P><IMG alt="" border=0 hspace=0
src="cid:001101c0518d$9b0c7f60$0100007f@xxxx"></P>
<P>A new chart pane will be displayed showing volume line chart.</P>
<P>For further reference on using Indicator Builder please consult
<I>Environment - Indicator Builder</I> and <I>AmiBroker Formula Language - AFL
Tools</I> sections of AmiBroker User's guide.</P>
<H5>3 AFL Formula Library: Measuring volatility - Average True Range and
Chaikin's Volatility</H5>
<P>Volatility is a general term used to describe the magnitude of day-to-day
fluctuations in prices (independent of direction). Generally, changes in
volatility tend to lead changes in prices. There are several ways to measure the
volatility. In this issue I will describe the formulas that use two, probably
the simplest, approaches to this task.</P>
<P><I>Average True Range</I></P>
<P>The True Range indicator is defined by Wilder to be the greatest of the
following for each period:<BR></P>
<UL>
<LI>the distance from today's high to today's low</LI>
<LI>the distance from yesterday's close to today's high </LI>
<LI>the distance from yesterday's close to today's low</LI></UL>
<P>The Average True Range is simply the average of the true ranges over thepast
<I>n</I> periods. AmiBroker has built in AFL function for that purpose - atr(
periods ). You can use simple 14 day ATR as a volatility indicator using the
following formula:</P>
<BLOCKQUOTE>
<P><CODE>graph0 = atr( 14 );</CODE></P></BLOCKQUOTE>
<P>Alternatively, you can add some more smoothing using the following
formula:</P>
<BLOCKQUOTE>
<P><CODE>graph0 = ema( atr( 14 ) , 5 );</CODE></P></BLOCKQUOTE>
<P>Since atr() itself uses moving average in its construction the latter formula
uses in fact double smoothing and exhibits more delay than the first
formula.</P>
<P>For both formulas high readings of the indicator mean high market volatility
while low readings mean low volatility.</P>
<P><I>Chaikin's Volatility</I></P>
<P>Marc Chaikin uses different approach to measure volatility. His volatility
indicator compares the spread between a security's high and low prices. This is
done by first calculating a moving average of the difference between the daily
high and low prices and then calculating the rate of change of that moving
average. Marc Chaikin recommends 10-periods for both the moving average andthe
rate of change. The AFL formula for Chaikin's volatility is:</P>
<BLOCKQUOTE>
<P><CODE>graph0 = roc( ema( high-low, 10), 10);</CODE></P></BLOCKQUOTE>
<P><B>4 Tip of the week: Adding your own import formats</B></P>
<P><I><FONT size=-2>Note: This functionality is available only in Windows
version of AmiBroker</FONT></I></P>
<P>AmiBroker can use not only default.format definition file but also other
user-specified files. File types, filters and format definition files are
specified in <B>import.types</B> file, located in AmiBroker's main directory.
<BR>If such file exists you will see your types in the "Files of type" combo-box
of ASCII importer file dialog and when you select one - appropriate filter will
be used and after selecting some files and clicking OK - importer will use
specified ".format" file. In that way you can define as many text-based data
formats as you like and AmiBroker will be able to "understand" them all.</P>
<P>The user can prepare/modify <B>import.types</B> file with the description of
supported ASCII formats and filters to use. The file could be edited in any
plain text editor such as Notepad.</P>
<P>The format of import.types file is: <DESCRIPTIVE name></P>
<BLOCKQUOTE>
<P><DESCRIPTIVE name><DESCRIPTIVE name><CODE><Descriptive name>|<File
filter>|<definition file name></CODE></P></BLOCKQUOTE>
<P><DEFINITION name file>Note vertical line characters ( | ) between these three
fields. Example import.types file looks as follows: </P>
<BLOCKQUOTE>
<P><CODE>Default ASCII (*.*)|*.*|default.format<BR>Yahoo's CSV
(*.csv)|*.csv|yahoo.format<BR>Metastock ASCII
(*.mst)|*.mst|metastock.format<BR>Omega SC ASCII
(*.txt)|*.txt|omega.format<BR>S-Files (s*.*)|s*.*|sfile.format<BR>C-Files
(c*.*)|c*.*|cfile.format<BR>Sharenet DAT
(*.dat)|*.dat|dat.format</CODE></P></BLOCKQUOTE>
<P>In order to add you own import format you will need to:</P>
<OL>
<LI>Define your .format file (for example <B>myown.format</B>) - this is
described in <I>Data management - Import from ASCII</I> section of AmiBroker's
user guide. </LI>
<LI>Add the following line to <B>import.types</B> file:<BR><CODE>My own format
(*.*)|*.*|myown.format</CODE></LI></OL>
<P>After saving the files please launch AmiBroker and open ASCII file import
dialog - you should see your own type shown in "Files of type" combo
box.</P><I>.... and that's all for this week - hope you enjoyed reading</I>
<HR>
<P><FONT size=-2>AmiBroker Tips weekly newsletter. Issue 3/2000.
Copyright (C)2000 Tomasz Janeczko. All back issues available
from: <A
href="http://www.amibroker.com/newsletter/">http://www.amibroker.com/newsletter/</A></FONT></P>
<P> </P></DIV></BODY></HTML>
------=_NextPart_001_0013_01C05195.FCE95160--
Attachment:
Description: ""
Attachment:
Description: ""
Attachment:
Description: ""
Attachment:
Description: ""
Attachment:
Description: ""
|