<?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>the genetic trader . com &#187; MetaTrader</title>
	<atom:link href="http://www.thegenetictrader.com/category/metatrader/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.thegenetictrader.com</link>
	<description>Freelance quantitative analyst specialising in evolutionary computing techniques.</description>
	<lastBuildDate>Wed, 23 Jun 2010 12:51:49 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>Extracting historic data from MetaTrader</title>
		<link>http://www.thegenetictrader.com/2009/09/16/extracting-historic-data-from-metatrader/</link>
		<comments>http://www.thegenetictrader.com/2009/09/16/extracting-historic-data-from-metatrader/#comments</comments>
		<pubDate>Wed, 16 Sep 2009 21:18:22 +0000</pubDate>
		<dc:creator>andrew</dc:creator>
				<category><![CDATA[MetaTrader]]></category>

		<guid isPermaLink="false">http://www.thegenetictrader.com/?p=33</guid>
		<description><![CDATA[If you&#8217;ve looked at my plan for forex, you&#8217;ll know that my first step is to create an EA that dumps the historic data out of MetaTrader into a CSV file so that I can load this into my Scheme programs creating the genetic programs. Here&#8217;s the code for DataDumper.mq4 that does just that :- [...]]]></description>
			<content:encoded><![CDATA[<!-- AdSense Now! V1.90 -->
<!-- Post[count: 2] -->
<div class="adsense adsense-leadin" style="float:right;margin: 12px;"><script type="text/javascript"><!--
google_ad_client = "pub-1213643583738263";
/* 234x60, AdSenseNow created 3/1/09 */
google_ad_slot = "5294177075";
google_ad_width = 234;
google_ad_height = 60;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script></div><p>If you&#8217;ve looked at my <a href="/2009/09/14/the-plan-for-forex/">plan for forex</a>, you&#8217;ll know that my first step is to create an EA that dumps the historic data out of MetaTrader into a CSV file so that I can load this into my Scheme programs creating the genetic programs.</p>
<p>Here&#8217;s the code for DataDumper.mq4 that does just that :-</p>
<pre style="border: 1px dashed #999999; padding: 5px; overflow: auto; font-family: Andale Mono,Lucida Console,Monaco,fixed,monospace; color: #000000; background-color: #eeeeee; font-size: 12px; line-height: 14px; width: 100%;"><code>//+---------------------------+

//| Historic Data Dumping EA  |

//+---------------------------+

#property copyright "Andrew Whaley"

extern int min_year = 2008;
extern int max_year = 2009;

// Global scope

int handle;

int init()

{

   int p = Period();

   string pd;

   if (p == 1) pd = "M1";

   else if (p == 5) pd = "M5";

   else if (p == 15) pd = "M15";

   else if (p == 30) pd = "M30";

   else if (p == 60) pd = "H1";

   else if (p == 240) pd = "H4";

   else pd = "D1";

   string filename = StringConcatenate(Symbol(), "_", pd, ".csv");

   handle = FileOpen(filename, FILE_CSV|FILE_WRITE, ',');

   FileWrite(handle, "Date", "Time", "Volume", "Low", "Open", "Close", "High", "Bid", "Ask");

   return(0);

}

int deinit()

{

   FileClose(handle);

   return(0);

}

int start()

{
   string d,m,y,h,mi;
   double open,close,high,low;
   double vol;

   if ((Year() &gt;= min_year) &amp;&amp; (Year() &lt;= max_year))
   {
     if (Day() &lt; 10) d = StringConcatenate("0", DoubleToStr(Day(),0));
     else d = DoubleToStr(Day(),0);

     if (Month() &lt; 10) m = StringConcatenate("0", DoubleToStr(Month(),0));
     else m = DoubleToStr(Month(),0);

     y = DoubleToStr(Year(),0);

     if (TimeHour(TimeCurrent()) &lt; 10) h = StringConcatenate("0", DoubleToStr(TimeHour(TimeCurrent()),0));
     else h = DoubleToStr(TimeHour(TimeCurrent()),0);

     if (TimeMinute(TimeCurrent()) &lt; 10) mi = StringConcatenate("0", DoubleToStr(TimeMinute(TimeCurrent()),0));
     else mi = DoubleToStr(TimeMinute(TimeCurrent()),0);

     string ds = StringConcatenate(""", d, "-", m, "-", y, """);

     string ts = StringConcatenate(""", h, ":", mi, """);

     open = iOpen(NULL, 0, 1);
     close = iClose(NULL, 0, 1);
     high = iHigh(NULL, 0, 1);
     low = iLow(NULL, 0, 1);
     vol = iVolume(NULL, 0, 1);

     FileWrite(handle, ds, ts, vol, low, open, close, high, Bid, Ask);
   }

   return(0);

}

</code></pre>
<p>Here&#8217;s how to use it :-</p>
<ol>
<li>Open the chart that you want use it on and attach the DataDumper EA,</li>
<li>Press F6 for the Tester</li>
<li>Select the symbol and period</li>
<li>Select the &#8216;Open prices only&#8217; model</li>
<li>Configure the EA properties for start and end year</li>
<li>Run the backtest</li>
</ol>
<p>When the test has finished, check your &lt;METATRADER&gt;/tester/files directory for the resultant CSV file.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.thegenetictrader.com/2009/09/16/extracting-historic-data-from-metatrader/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Running MetaTrader on Linux</title>
		<link>http://www.thegenetictrader.com/2009/09/10/running-metatrader-on-linux/</link>
		<comments>http://www.thegenetictrader.com/2009/09/10/running-metatrader-on-linux/#comments</comments>
		<pubDate>Thu, 10 Sep 2009 11:39:43 +0000</pubDate>
		<dc:creator>andrew</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[MetaTrader]]></category>

		<guid isPermaLink="false">http://www.thegenetictrader.com/?p=5</guid>
		<description><![CDATA[Many of the Forex brokers e.g. FXCM and Alpari UK are now offering direct trading through MetaTrader which offers great opportunities to program &#8216;Expert Advisors&#8217; to automate your trading. This means that you can be day trading full time whilst you&#8217;re at work and asleep. Unfortunately MetaTrader is a purely Windows application but the great [...]]]></description>
			<content:encoded><![CDATA[<p>Many of the Forex brokers e.g. <a href="http://www.fxcm.co.uk/">FXCM</a> and <a href="http://www.alpari.co.uk/">Alpari UK</a> are now offering direct trading through MetaTrader which offers great opportunities to program &#8216;Expert Advisors&#8217; to automate your trading. This means that you can be day trading full time whilst you&#8217;re at work and asleep.</p>
<p>Unfortunately MetaTrader is a purely Windows application but the great news is that it installs and runs fine under Wine on Ubuntu 9.04. It will install under vanilla Wine from the Ubuntu repository but unfortunately it won&#8217;t run because it requires MFC libraries that aren&#8217;t included in the default Wine installation.</p>
<p>This is easily remedied by copying the following files from a Windows XP box :-</p>
<p><code>-rwxrwxrwx 1 andrew andrew  924432 2003-07-16 17:28 mfc40.dll<br />
-rwxrwxrwx 1 andrew andrew  927504 2008-04-14 01:11 mfc40u.dll<br />
-rwxrwxrwx 1 andrew andrew 1028096 2008-04-14 01:11 mfc42.dll<br />
-rwxrwxrwx 1 andrew andrew  981760 2007-04-03 04:14 mfc42u.dll<br />
-rwxrwxrwx 1 andrew andrew 1060864 2003-03-18 20:20 mfc71.dll<br />
-rwxrwxrwx 1 andrew andrew 1047552 2003-03-18 20:12 mfc71u.dll<br />
-rwxrwxrwx 1 andrew andrew   22528 2008-04-14 01:11 mfcsubs.dll</code></p>
<p>to your .wine/dosdevices/c:/windows/system32 directory.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.thegenetictrader.com/2009/09/10/running-metatrader-on-linux/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>
