<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>AmiBroker Knowledge Base &#187; Data</title>
	<atom:link href="http://www.amibroker.com/kb/category/data/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.amibroker.com/kb</link>
	<description>Providing you with tips &#038; tricks for everyday AmiBroker use</description>
	<lastBuildDate>Sat, 17 Dec 2011 10:18:10 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.4</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>AmiQuote and free data from Yahoo</title>
		<link>http://www.amibroker.com/kb/2007/08/04/amiquote-and-free-data-from-yahoo/</link>
		<comments>http://www.amibroker.com/kb/2007/08/04/amiquote-and-free-data-from-yahoo/#comments</comments>
		<pubDate>Sat, 04 Aug 2007 19:19:35 +0000</pubDate>
		<dc:creator>Tomasz Janeczko</dc:creator>
				<category><![CDATA[AmiQuote]]></category>
		<category><![CDATA[Data]]></category>

		<guid isPermaLink="false">http://www.amibroker.com/kb/2007/08/04/amiquote-and-free-data-from-yahoo/</guid>
		<description><![CDATA[There are a couple of things you need to know about Yahoo Finance pages that AmiQuote uses to download &#8220;historical&#8221; and &#8220;current&#8221; quotes.
Current quotes are quotes for current day (or previous day if there is no trading session today). For example MSFT current quote page is here:
http://finance.yahoo.com/q?s=MSFT
AmiQuote uses rather &#8220;download data&#8221; link which is: http://download.finance.yahoo.com/d/quotes.csv?s=MSFT&#038;f=sl1d1t1c1ohgv&#038;e=.csv
But [...]]]></description>
			<content:encoded><![CDATA[<p>There are a couple of things you need to know about Yahoo Finance pages that AmiQuote uses to download &#8220;historical&#8221; and &#8220;current&#8221; quotes.</p>
<p>Current quotes are quotes for current day (or previous day if there is no trading session today). For example MSFT current quote page is here:<br />
<a href="http://finance.yahoo.com/q?s=MSFT">http://finance.yahoo.com/q?s=MSFT</a><br />
AmiQuote uses rather &#8220;download data&#8221; link which is: <a href="http://download.finance.yahoo.com/d/quotes.csv?s=MSFT&#038;f=sl1d1t1c1ohgv&#038;e=.csv">http://download.finance.yahoo.com/d/quotes.csv?s=MSFT&#038;f=sl1d1t1c1ohgv&#038;e=.csv</a><br />
But it is not relevant because both show same current quote.</p>
<p>Now there is a second source. Historical quotes are downloaded from Historical Prices page. For example MSFT historical page is here: <a href="http://finance.yahoo.com/q/hp?s=MSFT">http://finance.yahoo.com/q/hp?s=MSFT</a> (again AmiQuote uses rather plain text link: <a href="http://ichart.finance.yahoo.com/table.csv?s=MSFT&#038;d=7&#038;e=4&#038;f=2007&#038;g=d&#038;a=2&#038;b=13&#038;c=1986&#038;ignore=.csv">http://ichart.finance.yahoo.com/table.csv?s=MSFT&#038;d=7&#038;e=4&#038;f=2007&#038;g=d&#038;a=2&#038;b=13&#038;c=1986&#038;ignore=.csv</a> )</p>
<p>Why using two sources? That&#8217;s simple: current mode gives data during trading session, while historical is only updated many hours after markets close so both compliment each other. Current mode is also much faster as it downloads as many as 200 symbols at once, while historical must download one by one. So recommended usage is to use Yahoo Current mode everyday, and Yahoo Historical once a week.<br />
Of course you may use historical everyday as well if you have time and fast internet connection.</p>
<p>It is important to understand that AmiQuote is just the downloader (like Internet Explorer) and it does nothing except downloading the data, so if you belive that there is a bad quote &#8211; it is not AmiQuote, but rather Yahoo problem. To verify always go to relevant page (see links above) and check the quote on Yahoo Finance site directly.</p>
<p>It may happen that quotes on Yahoo Current page and Yahoo Historical pages differ. It is so because Yahoo gets them from different data vendors. If this happens the only solution is to report data error to Yahoo.</p>
<p>There are however 2 things you need to know about importing of data:
<ol>
<li>AmiBroker by default imports <strong>split and dividend adjusted data </strong>(&#8221;Adj. Close&#8221; on Yahoo Historical page). For more information on how data are adjusted see Yahoo Help page at: <a href="http://help.yahoo.com/l/us/yahoo/finance/quotes/quote-12.html">http://help.yahoo.com/l/us/yahoo/finance/quotes/quote-12.html</a></p>
<li>AmiBroker by default imports volume in HUNDREDS of shares (so if volume is 183,200 shares, the volume chart will show 1832). NOTE: This will NO LONGER apply in AmiBroker 5.30.
</ol>
<p>These things are adjustable, so if you don&#8217;t like them, you can change them.<br />
The import process of historical quotes is controlled using <strong>aqh.format</strong> file that you will find inside &#8220;Formats&#8221; subfolder. By default it looks as follows (you can open it with Windows Notepad).</p>
<p><code># AmiQuote historical quotes download format (.AQH extension)<br />
<strong>$FORMAT Date_DMY,Open,High,Low,Close,Volume,AdjClose</strong><br />
$SKIPLINES 0<br />
$BREAKONERR 0<br />
$SEPARATOR ,<br />
$DEBUG 1<br />
$AUTOADD 1<br />
$CONT 1<br />
$GROUP 254<br />
<strong>$VOLFACTOR 0.01</strong><br />
</code></p>
<p>Lines marked with bold mark important areas.</p>
<p>$FORMAT line controls the import format. AdjClose field says that AmiBroker should use adjusted price. If you don&#8217;t want adjusted prices simply replace $FORMAT line with:</p>
<p><code>$FORMAT Date_DMY,Open,High,Low,Close,Volume</code><br />
(note no AdjClose field)</p>
<p>$VOLFACTOR line controls the volume multiplier. If you want volume to be expressed in single shares instead of hundreds of shares replace $VOLFACTOR line with:</p>
<p><code>$VOLFACTOR 1</code></p>
<p>The same $VOLFACTOR change should be applied to <strong>aqd.format</strong> file that is responsible for importing data in Yahoo CURRENT mode (if you are using it).</p>
]]></content:encoded>
			<wfw:commentRss>http://www.amibroker.com/kb/2007/08/04/amiquote-and-free-data-from-yahoo/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to display the indicators based on Advances/Declines</title>
		<link>http://www.amibroker.com/kb/2007/07/30/how-to-display-the-indicators-based-on-advancesdeclines/</link>
		<comments>http://www.amibroker.com/kb/2007/07/30/how-to-display-the-indicators-based-on-advancesdeclines/#comments</comments>
		<pubDate>Mon, 30 Jul 2007 12:01:59 +0000</pubDate>
		<dc:creator>Marcin Gorzynski</dc:creator>
				<category><![CDATA[Charting]]></category>
		<category><![CDATA[Data]]></category>

		<guid isPermaLink="false">http://www.amibroker.com/kb/2007/07/30/how-to-display-the-indicators-based-on-advancesdeclines/</guid>
		<description><![CDATA[In order to display indicators based on Advances/Declines first of all it&#8217;s necessary to calculate composities in the database:

Open Categories window using Symbol-&#62;Categories menu item.
Select base index for given market in Markets tab and Base indexes for &#8211; Composites combo.
For example if you are following NYSE this can by ^DIJ (Dow Jones Average)
(certain symbol must [...]]]></description>
			<content:encoded><![CDATA[<p>In order to display indicators based on Advances/Declines first of all it&#8217;s necessary to calculate composities in the database:
<ol>
<li>Open Categories window using <strong>Symbol-&gt;Categories</strong> menu item.</li>
<li>Select base index for given market in <strong>Markets</strong> tab and <strong>Base indexes for &#8211; Composites </strong>combo.<br />
For example if you are following NYSE this can by ^DIJ (Dow Jones Average)<br />
(certain symbol must be marked as index in <strong>Symbol -&gt; Information</strong> and must belong to the same market)
<li>Choose <strong>Symbol -&gt;Calculate composites</strong>  menu item to open the window shown below and mark:<br />
- Number of advancing/declining issues and<br />
- Apply to: all quotes, All markets
<li>Click <strong>Calculate </strong>. From now on ADLine, AdvVolume() and TRIN indicators will be visible.
</ol>
<p><strong>Q: Why does AB need &#8220;base index&#8221;?</strong><br />
A: Just because it may happen that not all stocks are quoted every businness day and AB needs must calculate number of advancing/declining issues per market. So it checks the &#8220;base index&#8221; quotations dates and tries to find corresponding quotes of all stocks belonging to that market to find out how many issues advanced, declined and not changed at all.</p>
<p><strong>Q: What are &#8220;Volume for base index&#8221; and &#8220;Copy volume to all indexes&#8221; checkboxes for?</strong><br />
A: &#8220;Volume for base index&#8221; and &#8220;Copy volume to all indexes&#8221; are provided in case you DON&#8217;T have real volume data for index quotes. In that case AmiBroker can calculate volume for index as a sum of volumes of all stocks belonging to given market. First option assigns calculated volume only to &#8220;base index&#8221;, the second copies the volume figure to all indexes belonging to given market.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.amibroker.com/kb/2007/07/30/how-to-display-the-indicators-based-on-advancesdeclines/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Setting up with FXCM (forex broker)</title>
		<link>http://www.amibroker.com/kb/2007/01/05/setting-up-with-fxcm-forex-broker/</link>
		<comments>http://www.amibroker.com/kb/2007/01/05/setting-up-with-fxcm-forex-broker/#comments</comments>
		<pubDate>Fri, 05 Jan 2007 20:23:11 +0000</pubDate>
		<dc:creator>Tomasz Janeczko</dc:creator>
				<category><![CDATA[Data]]></category>

		<guid isPermaLink="false">http://www.amibroker.com/kb/2007/01/05/setting-up-with-fxcm-forex-broker/</guid>
		<description><![CDATA[I have just prepared instructions how to connect to FXCM (Forex broker) to get their real-time quotes.
Also included is small example database (1 day worth of 1 minute data) and all required programs.
For the details check: http://www.amibroker.com/fxcm.html
]]></description>
			<content:encoded><![CDATA[<p>I have just prepared instructions how to connect to FXCM (Forex broker) to get their real-time quotes.<br />
Also included is small example database (1 day worth of 1 minute data) and all required programs.</p>
<p>For the details check: <a href="http://www.amibroker.com/fxcm.html">http://www.amibroker.com/fxcm.html</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.amibroker.com/kb/2007/01/05/setting-up-with-fxcm-forex-broker/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to combine two databases into one</title>
		<link>http://www.amibroker.com/kb/2006/10/16/how-to-combine-two-databases-into-one/</link>
		<comments>http://www.amibroker.com/kb/2006/10/16/how-to-combine-two-databases-into-one/#comments</comments>
		<pubDate>Mon, 16 Oct 2006 10:54:03 +0000</pubDate>
		<dc:creator>Marcin Gorzynski</dc:creator>
				<category><![CDATA[Data]]></category>

		<guid isPermaLink="false">http://www.amibroker.com/kb/2006/10/16/how-to-combine-two-databases-into-one/</guid>
		<description><![CDATA[If you ever wondered how to combine two databases into one this short article will show you how, but let us start with some background first&#8230; 
A database (or a workspace) is a directory that holds a set of binary files, which are stored in 0-9, a-z, &#8216;_&#8217; subdirectories. Those binary files hold quotes, symbol [...]]]></description>
			<content:encoded><![CDATA[<p>If you ever wondered how to combine two databases into one this short article will show you how, but let us start with some background first&#8230; <span id="more-54"></span></p>
<p>A database (or a workspace) is a directory that holds a set of binary files, which are stored in 0-9, a-z, &#8216;_&#8217; subdirectories. Those binary files hold quotes, symbol information, your studies (trend lines, Fibonacci stuff). Each symbol&#8217;s information is stored separately in the file with the name of the ticker symbol located in the subdirectory corresponding to the first character of the symbol, so IBM quotation data/studies are stored in the &#8216;IBM&#8217; file located in the &#8216;I&#8217; subdirectory (more information on this in the <a href="http://www.amibroker.com/guide/h_workspace.html">User&#8217;s Guide</a>).</p>
<p>In addition to these subdirectories and files, two additional files are also created by AmiBroker: broker.workspace and broker.master. The first is used to store category names and information about advancing/declining/unchanged issues. The latter stores the table of all symbols that is used for quick loading of the database. These two files are located in the root directory of each database, the &#8216;data&#8217; directory, by default.</p>
<p>So &#8211; if one wants to combine two separate databases &#8211; there are the following possibilities:</p>
<ol>
<li>Export quotations from one database to the ASCII files and reimport quotes from another database (export procedure is described in the following article in the Knowledge Base <a href="http://www.amibroker.com/kb/2006/03/04/how-to-export-quotations-from-amibroker-to-csv-file/">http://www.amibroker.com/kb/2006/03/04/how-to-export-quotations-from-amibroker-to-csv-file/</a> )</p>
<li>Just copy the data-files from one database folder into another (and place the files in their respective subfolders to keep the database structure the same). Then &#8211; it&#8217;s also necessary to <strong>delete the broker.master</strong> file from the target database &#8211; as a result AmiBroker will recreate the symbol list at startup and include all the new symbols in the database.
</ol>
]]></content:encoded>
			<wfw:commentRss>http://www.amibroker.com/kb/2006/10/16/how-to-combine-two-databases-into-one/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>AmiBroker for FOREX</title>
		<link>http://www.amibroker.com/kb/2006/08/09/amibroker-for-forex/</link>
		<comments>http://www.amibroker.com/kb/2006/08/09/amibroker-for-forex/#comments</comments>
		<pubDate>Wed, 09 Aug 2006 07:56:17 +0000</pubDate>
		<dc:creator>Marcin Gorzynski</dc:creator>
				<category><![CDATA[AFL]]></category>
		<category><![CDATA[AmiQuote]]></category>
		<category><![CDATA[Data]]></category>
		<category><![CDATA[Indicators]]></category>
		<category><![CDATA[Systems]]></category>

		<guid isPermaLink="false">http://www.amibroker.com/kb/2006/08/09/amibroker-for-forex/</guid>
		<description><![CDATA[Here is an article that tells you everything you need to know about using AmiBroker for trading FOREX markets. 
I. DATA
AmiBroker is very flexible as regards the datasources that can be used to feed data to the program.
1) Realtime data
Forex traders usually require a realtime datasource and with AB you have a variety of choices.
The exact [...]]]></description>
			<content:encoded><![CDATA[<p>Here is an article that tells you everything you need to know about using AmiBroker for trading FOREX markets. <span id="more-31"></span></p>
<p><strong>I. DATA</strong></p>
<p>AmiBroker is very flexible as regards the datasources that can be used to feed data to the program.</p>
<p>1) Realtime data</p>
<p>Forex traders usually require a realtime datasource and with AB you have a variety of choices.<br />
The exact configuration process depends on the particular source &#8211; click on the appropriate link to learn how to configure the source of your choice:</p>
<p>- eSignal &#8211; <a href="http://www.amibroker.com/video/esignal.html">http://www.amibroker.com/video/esignal.html</a> <br />
- IQFeed &#8211; <a href="http://www.amibroker.com/iqfeed.html">http://www.amibroker.com/iqfeed.html</a><br />
- Interactive Brokers &#8211; <a href="http://www.amibroker.com/video/ib.html">http://www.amibroker.com/video/ib.html</a><br />
- any source that supports DDE standard (this is a generic communication interface, check if your broker’s application supports DDE) &#8211; <a href="http://www.amibroker.com/dde.html">http://www.amibroker.com/dde.html</a><br />
- any source that delivers the data in MetaStock format &#8211; see:<br />
<a href="http://www.amibroker.com/guide/h_extsources.html">http://www.amibroker.com/guide/h_extsources.html</a></p>
<p> </p>
<p>2) AmiQuote downloader</p>
<p>If you do not require realtime quotations, but it&#8217;s enough for you to have the historical data (e.g. for backtesting your strategies) &#8211; then you can also use AmiQuote downloader program (a companion program that is installed with AmiBroker) and it will allow you to get FREE forex data (both EOD and intraday: 1-, 3-, 5-, 15-, 30-, 60- and 120-minute intervals).</p>
<p>AmiQuote can download the quotations for the following currency pairs:<br />
EURCHF,EURGBP,EURJPY,EURUSD,GBPUSD,USDCHF,USDJPY</p>
<p>The download process is shown in the video:<br />
<a href="http://www.amibroker.net/video/forex.html">http://www.amibroker.net/video/forex.html</a></p>
<p>You need to do the following:<br />
- set up database in AmiBroker (File -&gt; New Database, local database, base<br />
time interval, e.g. EOD)<br />
- run AmiQuote (START -&gt; Programs -&gt; AmiBroker -&gt; AmiQuote )<br />
- add forex symbols in AQ: (Edit -&gt; Add tickers )<br />
- select FOREX as a datasource<br />
- select time range<br />
- check &#8220;Automatic Import&#8221; field<br />
- choose: File -&gt; Start download<br />
The intraday forex quotes are available in the Registered version of AmiQuote only.<br />
Although the entire data range is very long, you must remember that in case of intraday quotes the saefst way is to get data in small parts, few weeks at a time.<br />
Otherwise the request may be too large for the data server to handle it and as a result it will reject the request.<br />
The other important thing to remember is that the data is not avalable for downloads between 13:00 &#8211; 22:00 GMT time (7:00 &#8211; 16:00 EST) &#8211; in these hours the data  vendor&#8217;s  server just rejects all the requests for intraday quotes.</p>
<p> </p>
<p>3) Text files.</p>
<p>You can also use any data that comes in the text files. The ASCII Importer available in AmiBroker is very flexible and accepts practically any standard of data.<br />
To import quotations &#8211; the most convenient is to use File -&gt; Import Wizard.</p>
<p>To learn more about importing the data from ASCII (text) files &#8211; please read the following tutorial:<br />
<a href="http://www.amibroker.com/guide/w_impwizard.html">http://www.amibroker.com/guide/w_impwizard.html</a><br />
<strong> </strong></p>
<p><strong>II.  SYMBOL GUIDE</strong></p>
<p>Once you configure the database (to read realtime data), then all you need to do is to add the symbol via: Symbol -&gt; New menu and AmiBroker will automatically read the data for the selected symbol. Please note that various datasources have different symbology, so please always refer to the data vendor&#8217;s Symbol guide to learn about the required symbol format.</p>
<p>Here you will find the links to the most popular vendors guidlines:</p>
<p>- eSignal:<br />
<a href="http://www.esignalcentral.com/support/symbol/symbol_format.asp#forexGarban">http://www.esignalcentral.com/support/symbol/symbol_format.asp#forexGarban</a><br />
<a href="http://www.esignalcentral.com/support/symbol/forex.asp">http://www.esignalcentral.com/support/symbol/forex.asp</a></p>
<p>- IQFeed:<br />
<a href="http://www.iqfeed.net/symbolguide/index.cfm?symbolguide=guide&amp;displayaction=support&amp;section=guide&amp;web=iqfeed">http://www.iqfeed.net/symbolguide/index&#8230;</a></p>
<p>- Interactive Brokers:<br />
<a href="http://www.amibroker.com/ib.html">http://www.amibroker.com/ib.html</a><br />
In case of Interactive Brokers &#8211; if you have any doubt what format to use -<br />
you can easily check any symbol in IB.</p>
<p>Just enter the symbol in Interactive<br />
Brokers TWS, then change the view to Symbol mode<br />
(View -&gt; Symbol mode). Now you can compose the actual symbol out of three<br />
fields:</p>
<p>SYMBOL-EXCHANGE-TYPE<br />
where:<br />
SYMBOL is the same as the symbol column as displayed in TWS while under<br />
symbol mode<br />
EXCHANGE is the exchange d in TWS while under symbol mode<br />
TYPE  is one the following: STK &#8211; stocks, FUT &#8211; futures, FOP &#8211; options on<br />
futures, OPT &#8211; options, IND &#8211; indexes, CASH -cash (ideal FX)</p>
<p> </p>
<p><strong>III. CHARTING</strong></p>
<p>Since most currency pairs requires 4 decimals to display the rates properly, it&#8217;s necessary to set-up AmiBroker accordingly. The number of decimal places can be defined  in Preferences dialog in:</p>
<p>Tools -&gt; Preferences -&gt; Miscellaneous</p>
<p><img src="http://www.amibroker.com/kb/wp-content/uploads/2006/08/fxprefs.gif" /></p>
<p>The changes will also affect such tools as Fibonacci Extension or Retracement drawing tools.</p>
<p> </p>
<p> </p>
<p><strong>IV. SCANNING and DATA EXPLORATIONS </strong></p>
<p>AmiBroker allows you to perform sophisticated scanning and data explorations (both in realtime and with use of historical quotes). To perform data analysis and display the values of chosen indicators in the customized table &#8211; we can use Automatic Analysis window. The detailed description on how to perform explorations is available at:<br />
<a href="http://www.amibroker.com/guide/h_exploration.html">http://www.amibroker.com/guide/h_exploration.html</a></p>
<p>As a short example &#8211; we will find the crossovers of MACD and its Signal line and additionally &#8211; display values of the symbol we test. The 3rd parameter of <strong><a title="AddColumn()" href="http://www.amibroker.com/f?addcolumn">AddColumn()</a></strong> function allows to customize the number of places after decimal point, so it&#8217;s possible to specify if we need 2 or 4 decimal places. If we use:</p>
<p><strong>AddColumn( Close, &#8220;Close&#8221;, 1.4);</strong><br />
then &#8211; 4 decimal places will be displayed. On the other hand &#8211; if we use:</p>
<p><strong>AddColumn( Close, &#8220;Close&#8221;, 1.2);</strong><br />
then AB will display only 2 decimals.</p>
<p>To perform the test - it&#8217;s necessary to do the following:<br />
- open the Formula Editor (Analysis -&gt; Formula Editor)<br />
- enter the formula:<br />
<code><span>Buy&nbsp;</span><span style="color: #000000">=&nbsp;</span><span style="color: #0000BB">Cross</span><span style="color: #000000">(&nbsp;</span><span style="color: #0000BB">MACD</span><span style="color: #000000">(),&nbsp;</span><span style="color: #0000BB">Signal</span><span style="color: #000000">()&nbsp;);<br />
</span><span style="color: #0000BB">Sell&nbsp;</span><span style="color: #000000">=&nbsp;</span><span style="color: #0000BB">Cross</span><span style="color: #000000">(&nbsp;</span><span style="color: #0000BB">Signal</span><span style="color: #000000">(),&nbsp;</span><span style="color: #0000BB">MACD</span><span style="color: #000000">()&nbsp;);<br />
</span><span style="color: #0000BB">Filter&nbsp;</span><span style="color: #000000">=&nbsp;</span><span style="color: #0000BB">Buy&nbsp;</span><span style="color: #000000">OR&nbsp;</span><span style="color: #0000BB">Sell</span><span style="color: #000000">;<br />
</span><span style="color: #0000BB">AddColumn</span><span style="color: #000000">(&nbsp;</span><span style="color: #0000BB">Close</span><span style="color: #000000">,&nbsp;</span><span style="color: #DD0000">&quot;Close&quot;</span><span style="color: #000000">,&nbsp;</span><span style="color: #0000BB">1.4</span><span style="color: #000000">);</span></code><br />
- Tools -&gt; Send to Auto-analysis<br />
- select the time-range of the exploration<br />
- press EXPLORE</p>
<p>As a result &#8211; we will get a list of MACD/Signal crossover points and the value of the chosen symbol on that bar.</p>
<p><strong>V. BACKTESTING</strong></p>
<p>First of all, it&#8217;s necessary to enter the symbol-specific information into Symbol -&gt; Information page (individually for each ticker). In case of currencies denominated in USD (like EURUSD) the following settings should be used:<br />
<img src="http://www.amibroker.com/kb/wp-content/uploads/2006/08/symbolinfo.gif" /></p>
<p>- <strong>Round lot size</strong> should be equal to 1 </p>
<p>- <strong>Tick size</strong> should be set to <strong>pip value</strong> equal 0.0001 for currencies with four decimal digits and to 0.01 for currencies with two decimal digits (so in case of EURUSD it&#8217;s 0.0001).</p>
<p>- <strong>Point value</strong> should be set to to the dollar value of a single pip divided by pip so for EURUSD it will be:<br />
             10$ / 0.0001  =  100000</p>
<p>- <strong>Margin Deposit</strong> in most cases should be set to 1000 (1% margin from $100&#8242;000)</p>
<p> </p>
<p>1) Currencies denominated in USD</p>
<p>Let&#8217;s analyse the results generated by a simple formula (a crossover of 12- and 24-day Moving Averages of Closing price, trading 3 contracts at a time). To perform a backtest &#8211; it&#8217;s necessary to do the following:</p>
<p>- open the Formula Editor (Analysis -&gt; Formula Editor)<br />
- enter the formula:<br />
<code><span>Buy&nbsp;</span><span style="color: #000000">=&nbsp;</span><span style="color: #0000BB">Cross</span><span style="color: #000000">(&nbsp;</span><span style="color: #0000BB">MA</span><span style="color: #000000">(</span><span style="color: #0000BB">Close</span><span style="color: #000000">,&nbsp;</span><span style="color: #0000BB">12</span><span style="color: #000000">)&nbsp;,&nbsp;</span><span style="color: #0000BB">MA</span><span style="color: #000000">(&nbsp;</span><span style="color: #0000BB">Close</span><span style="color: #000000">,&nbsp;</span><span style="color: #0000BB">24</span><span style="color: #000000">)&nbsp;);<br />
</span><span style="color: #0000BB">Sell&nbsp;</span><span style="color: #000000">=&nbsp;</span><span style="color: #0000BB">Cross</span><span style="color: #000000">(&nbsp;</span><span style="color: #0000BB">MA</span><span style="color: #000000">(</span><span style="color: #0000BB">Close</span><span style="color: #000000">,&nbsp;</span><span style="color: #0000BB">24</span><span style="color: #000000">)&nbsp;,&nbsp;</span><span style="color: #0000BB">MA</span><span style="color: #000000">(&nbsp;</span><span style="color: #0000BB">Close</span><span style="color: #000000">,&nbsp;</span><span style="color: #0000BB">12</span><span style="color: #000000">)&nbsp;);<br />
</span><span style="color: #0000BB">SetPositionSize</span><span style="color: #000000">(</span><span style="color: #0000BB">3</span><span style="color: #000000">,&nbsp;</span><span style="color: #0000BB">spsShares&nbsp;</span><span style="color: #000000">);</span></code></p>
<p> - choose: Tools -&gt; Send to Auto-analysis</p>
<p>As a result &#8211; the Automatic Analysis window will open. In the settings dialog (SETTNGS button) it&#8217;s necessary to turn on the FUTURES MODE (in order to use the information entered into the Information dialog) and define the Initial Equity.</p>
<p><img src="http://www.amibroker.com/kb/wp-content/uploads/2006/08/AAsettings.gif" /></p>
<p> </p>
<p>then &#8211; press OK. In the AA window main screen it&#8217;s necessary to define the time range of the backtest and the symbols included in the test. For our example that will be: <strong>Current Symbol, All quotations</strong></p>
<p>Then &#8211; once everything is configured &#8211; press <strong>BACKTEST</strong> button. Now let&#8217;s have a look at the results list.<br />
The profit is calculated as follows:</p>
<p><strong>NumContracts * (SellPrice &#8211; BuyPrice) * PointValue</strong><br />
 </p>
<p><img src="http://www.amibroker.com/kb/wp-content/uploads/2006/08/AAresults1.gif" /> </p>
<p>In the first transaction:<br />
- the <strong>Entry Price</strong> is equal to <strong>1.2154</strong><br />
- the <strong>Exit Price</strong> is equal to <strong>1.2304</strong><br />
- <strong>NumContracts</strong> = <strong>3</strong> (since we trade 3 contracts).<br />
- we trade on <strong>1% margin</strong> so deposit is $1,000 x 3 = <strong>$3,000</strong> (that&#8217;s expressed in <strong>Position Value</strong>)</p>
<p><strong>Profit</strong> =   3 * (1.2304 &#8211; 1.2154) * 100&#8242;000<strong> = 4&#8242;500</strong></p>
<p>So &#8211; the profit matches the results we&#8217;re getting by manual calculation.</p>
<p> </p>
<p>2) Currencies denominated in a different currency from USD (assuming that your account is in USD)</p>
<p>AmiBroker allows you to define a base currency and exchange rates (fixed or dynamic) for different currencies, and as a result - to get correct backtest results when testing securities denominated in different currency than your base portfolio currency.</p>
<p>These settings can be defined in: <strong>Tools -&gt; Preferences -&gt; Currencies </strong>dialog.</p>
<p><img src="http://www.amibroker.com/kb/wp-content/uploads/2006/08/pref13.gif" /></p>
<p> </p>
<p>AmiBroker allows to use both fixed and dynamic (historical) quotes for backtesting purposes (using dynamic quotes will allow you to check the real influence of the currency rates changes for your trades denominated in different currencies). </p>
<p>There are following requirements to use currency adjustements:<br />
a) Symbol-&gt;Information, &#8220;<strong>Currency</strong>&#8221; field shows currency different than BASE currency<br />
b) Appropriate currency (defined in Symbol-&gt; Information) has matching entry in Preferences-&gt;Currencies page<br />
c) the dynamic rate &#8220;FX SYMBOL&#8221; defined in the preferences EXISTS in your database and HAS QUOTES for each day under analysis range.</p>
<p> </p>
<p>&#8220;INVERSE&#8221; check box for in the preferences should be checked, when testing the FX rates like USDJPY or USDCHF &#8211; not denominated in the base currency of the portfolio.</p>
<p>For the same reason - if we look at the example of EURUSD &#8211; when &#8220;USD&#8221; is your BASE currency then EUR exchange rate would be &#8220;straight&#8221; EURUSD fx (e.g. ~1.25). But when &#8220;EUR&#8221; is your BASE currency then USD exchange rate would be INVERSE of EURUSD (i.e. ~1/1.25).</p>
]]></content:encoded>
			<wfw:commentRss>http://www.amibroker.com/kb/2006/08/09/amibroker-for-forex/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>How does the intraday-to-daily compression work?</title>
		<link>http://www.amibroker.com/kb/2006/03/19/how-does-the-daily-time-compression-work/</link>
		<comments>http://www.amibroker.com/kb/2006/03/19/how-does-the-daily-time-compression-work/#comments</comments>
		<pubDate>Mon, 20 Mar 2006 00:31:33 +0000</pubDate>
		<dc:creator>Marcin Gorzynski</dc:creator>
				<category><![CDATA[Data]]></category>

		<guid isPermaLink="false">http://www.amibroker.com/kb/2006/03/19/how-does-the-daily-time-compression-work/</guid>
		<description><![CDATA[When you are using intraday database daily candles are usually constructed by time-compression of intraday (for example 1-minute data). AmiBroker offers lots of flexibility when it comes to defining intraday-to-daily time compression.

Intraday Settings Window (File -&#62; Database Settings -&#62; Intraday Settings) allows you to control the display of intraday data. Different filtering and data-compression settings result [...]]]></description>
			<content:encoded><![CDATA[<p>When you are using intraday database daily candles are usually constructed by time-compression of intraday (for example 1-minute data). AmiBroker offers lots of flexibility when it comes to defining intraday-to-daily time compression.<br />
<span id="more-14"></span><br />
Intraday Settings Window (File -&gt; Database Settings -&gt; Intraday Settings) allows you to control the display of intraday data. Different filtering and data-compression settings result in different appearance of the chart and data being included in the compressed DAILY candle.</p>
<p>This article explains how to use this feature effectively.</p>
<p>First, let us check how<strong> Filtering </strong>works <strong>-</strong> AmiBroker collects all the data within the local database, but displays only those data which are inside selected trading hours start-end time. Please note that these settings affect all charts and windows <u>except</u> <a href="http://www.amibroker.com/kb/w_manualentry.html">Quote Editor</a> that always displays all available data.
<ul>
<li><strong>Show 24 hours trading (no filtering)</strong> &#8211; all data is displayed (no filtering at all). In this case, all the data (including pre- and after-market quotations) is shown on the chart, and all the quotations are compressed to the daily bar.</li>
</ul>
<p><img alt="24 Hours - Daily compression uses Exchange time" src="/kb/wp-content/uploads/2006/03/24Ex5min.gif" /><br />
<strong> </strong></p>
<p>As a result &#8211; all the data (since 00:00 untill 23:59) is included on the intraday chart. Now, if we switch the display into DAILY interval, all these quotes will be compressed to the daily candle.</p>
<p><img src="/kb/wp-content/uploads/2006/03/24ExDaily.gif" /></p>
<p>As it is visible in the tooltip - the OHLC values shown for the 2006-03-14 candle match the values observed on the intraday (5-min) chart.
<ul>
<li><strong>Show day session only</strong> &#8211; only the data between day session (RTH) start and end times is displayed. If we apply such kind of filtering, the quotes outside the regular session hours are not included in the charts.</li>
</ul>
<p>
<img src="/kb/wp-content/uploads/2006/03/DEx5min.gif" />
<p>
<strong>These are the settings we want to use if we are interested in getting daily bar representing standard US stock markets trading hours (9:30 open, 16:00 close).</strong> If we switch the display to DAILY interval, the influence of the filtering settings can also be observed.
<p>
<img src="/kb/wp-content/uploads/2006/03/DExDaily.gif" />
<p>
As it is visible in the tooltip - the OHLC values shown for the 2006-03-14 candle match the values from 9:30 upto 16:00 observed on the intraday (5-min) chart.
<ul>
<li><strong>Show night session only</strong> &#8211; only the data between night sesison (ETH) start and times are displayed. The below chart shows only the data between start and end times of the Night session defined in the settings.</li>
</ul>
<p><img src="/kb/wp-content/uploads/2006/03/NEx5min.gif" />
<p>
Since only Night-session data is displayed in the charts, consequently, such data will be included in the Daily candle when we switch the display interval to DAILY.
<p>
<img src="/kb/wp-content/uploads/2006/03/NExDaily.gif" /> 
<p>
Daily candle includes all the quotes for 2006-03-14 (marked with yellow background on the previous / intraday picture)
<p>
Now we will examine how does the <strong>time-shift</strong> affect the daily compression. Let us consider the Europe-based investor in GMT+1 time zone. There is a 6 hours difference, that is &#8211; when the regular session starts in US at 9:30, the time here is 15:30. That&#8217;s what the time-shift setting is for. If one wants to, it&#8217;s possible to display the quotations in the local time.
<p>
<strong>Time shift -</strong> is the time difference (in hours) between your local time zone and the exchange time zone. So &#8211; let&#8217;s set the time-shift to 6 hours and check what&#8217;s the influence of this setting on the daily compression.
<p>
AmiBroker allows us to choose, whether the daily time-compression uses Exchange time or Local time.
<ul>
<li><strong>Exchange time</strong> &#8211; daily data are constructed from intraday bars starting from 00:00 and ending at 23:59 in the EXCHANGE (or data source) TIME ZONE. This situation is presented in the screenshot below:<br />
<strong> </strong></li>
</ul>
<p>
<strong> <img src="/kb/wp-content/uploads/2006/03/24Ex5min_shift.gif" /></strong>
<p>
The yellow shade shows the bars which are used to build the 2006-03-14 daily candle. Despite the fact that the day expressed in Local time starts at 00:00, daily time-compression uses EXCHANGE time (so in local time, the new trading day starts at 6:00 and ends at 5:59, which is just 00:00 shifted by 6 hours). Consequently - if EXCHANGE time is used for the daily compression then the Daily bar will look exactly the same as in US-time (first example in this article).
<p>
<strong><img src="/kb/wp-content/uploads/2006/03/24ExDaily_shift.gif" /></strong>
<p>
As you can see &#8211; the Open, High, Low, Close prices of the 2006-03-14 daily candle are exactly the same as in Example 1, when there was no time-shift used. This is because the compression still uses EXCHANGE 00:00 &#8211; 23:59 range, which is expressed as 6:00 &#8211; 5:59 in local time.
<ul>
<li><strong>Local time</strong> &#8211; daily data are constructed from intraday bars starting from 00:00 and ending at 23:59 in the LOCAL (computer) TIME ZONE.</li>
</ul>
<p>
<img src="/kb/wp-content/uploads/2006/03/24Loc5min.gif" />
<p>
As opposed to the previous example &#8211; now AmiBroker uses 00:00 &#8211; 23:59 range expressed in Local time. That will produce a different daily candle.
<p>
<img src="/kb/wp-content/uploads/2006/03/24LocDaily.gif" />
<p>
It&#8217;s also possible to use<strong> Day/Night session times </strong>defined in the settings for daily compression purposes. Then daily candles are constructed from the intraday bars that start at the start time of night session (previous day) and end at the end time of day session). So &#8211; if we define the day session to start at: 9:30 and finish at 16:00 and night session times as 16:01 &#8211; 9:29, then the daily candles will be built from all the intraday bars from the start of the night session on the PREVIOUS day till the very last bar of the day session of the CURRENT day. Such setup is popular in Forex markets where Monday&#8217;s daily bar actually starts with Sunday evening trading (which starts from 17:00 ET) and continues till the end of Monday&#8217;s day session, and so on for each next day.
<p>
<img src="/kb/wp-content/uploads/2006/03/DNEx5min.gif" />
<p>
And the daily candle of March 14th shows these values &#8211; so the daily compression uses time range from: <strong>March 13th (previous day) 16:01</strong> to <strong>March 14th (current day), 16:00.</strong>
<p>
<img src="/kb/wp-content/uploads/2006/03/DNExDaily.gif" /></p>
<p><em>See also:<br />
<a href="http://www.amibroker.com/docs/tokyo/tokyo.html">Detailed setup instructions for Tokyo-based Forex traders using eSignal feed.</a><br />
</em></p>
]]></content:encoded>
			<wfw:commentRss>http://www.amibroker.com/kb/2006/03/19/how-does-the-daily-time-compression-work/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>How to export quotations from AmiBroker to CSV file ?</title>
		<link>http://www.amibroker.com/kb/2006/03/04/how-to-export-quotations-from-amibroker-to-csv-file/</link>
		<comments>http://www.amibroker.com/kb/2006/03/04/how-to-export-quotations-from-amibroker-to-csv-file/#comments</comments>
		<pubDate>Sun, 05 Mar 2006 01:56:07 +0000</pubDate>
		<dc:creator>Tomasz Janeczko</dc:creator>
				<category><![CDATA[AFL]]></category>
		<category><![CDATA[Data]]></category>
		<category><![CDATA[Explorations]]></category>

		<guid isPermaLink="false">http://www.amibroker.com/kb/2006/03/04/how-to-export-quotations-from-amibroker-to-csv-file/</guid>
		<description><![CDATA[The easiest way to export quotes to CSV file is to use the below formula from Automatic Analysis window:
(Analysis -> Automatic Analysis)

Filter=1;&#160;
AddColumn(O,&#34;Open&#34;);&#160;
AddColumn(H,&#34;High&#34;);&#160;
AddColumn(L,&#34;Low&#34;);&#160;
AddColumn(C,&#34;Close&#34;);&#160;
AddColumn(V,&#34;Volume&#34;,1.0);&#160;
AddColumn(OI,&#34;Open&#160;Interest&#34;,1.0);&#160;

Open: Analysis->Formula Editor
Paste the above formula into formula window 
Choose Tools->Send to Auto-Analysis menu in the Formula Editor
In Automatic Analysis window select Apply to: All Stocks, Range: All quotations (or any other time range [...]]]></description>
			<content:encoded><![CDATA[<p>The easiest way to export quotes to CSV file is to use the below formula from Automatic Analysis window:<br />
(Analysis -> Automatic Analysis)<br />
<span id="more-5"></span><br />
<code><span>Filter</span><span style="color: #000000">=</span><span style="color: #0000BB">1</span><span style="color: #000000">;&nbsp;<br />
</span><span style="color: #0000BB">AddColumn</span><span style="color: #000000">(</span><span style="color: #0000BB">O</span><span style="color: #000000">,</span><span style="color: #DD0000">&quot;Open&quot;</span><span style="color: #000000">);&nbsp;<br />
</span><span style="color: #0000BB">AddColumn</span><span style="color: #000000">(</span><span style="color: #0000BB">H</span><span style="color: #000000">,</span><span style="color: #DD0000">&quot;High&quot;</span><span style="color: #000000">);&nbsp;<br />
</span><span style="color: #0000BB">AddColumn</span><span style="color: #000000">(</span><span style="color: #0000BB">L</span><span style="color: #000000">,</span><span style="color: #DD0000">&quot;Low&quot;</span><span style="color: #000000">);&nbsp;<br />
</span><span style="color: #0000BB">AddColumn</span><span style="color: #000000">(</span><span style="color: #0000BB">C</span><span style="color: #000000">,</span><span style="color: #DD0000">&quot;Close&quot;</span><span style="color: #000000">);&nbsp;<br />
</span><span style="color: #0000BB">AddColumn</span><span style="color: #000000">(</span><span style="color: #0000BB">V</span><span style="color: #000000">,</span><span style="color: #DD0000">&quot;Volume&quot;</span><span style="color: #000000">,</span><span style="color: #0000BB">1.0</span><span style="color: #000000">);&nbsp;<br />
</span><span style="color: #0000BB">AddColumn</span><span style="color: #000000">(</span><span style="color: #0000BB">OI</span><span style="color: #000000">,</span><span style="color: #DD0000">&quot;Open&nbsp;Interest&quot;</span><span style="color: #000000">,</span><span style="color: #0000BB">1.0</span><span style="color: #000000">);&nbsp;</span></code></p>
<ol>
<li>Open: <strong>Analysis->Formula Editor</strong></li>
<li>Paste the above formula into formula window </li>
<li>Choose <strong>Tools->Send to Auto-Analysis</strong> menu in the Formula Editor</li>
<li>In Automatic Analysis window select Apply to: <strong>All Stocks</strong>, Range: <strong>All quotations</strong> (or any other time range or filter, depending on what you need to export) </li>
<li>Press <strong>Explore</strong> button </li>
<li>Press <strong>Export</strong> button, specify the name and press OK</li>
</ol>
]]></content:encoded>
			<wfw:commentRss>http://www.amibroker.com/kb/2006/03/04/how-to-export-quotations-from-amibroker-to-csv-file/feed/</wfw:commentRss>
		<slash:comments>8</slash:comments>
		</item>
	</channel>
</rss>

