<?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>Au.Tra.Sy blog - Automated trading System &#187; amibroker</title>
	<atom:link href="http://www.automated-trading-system.com/tag/amibroker/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.automated-trading-system.com</link>
	<description>Systematic Trading research and development, with a flavour of Trend Following</description>
	<lastBuildDate>Tue, 07 Feb 2012 09:58:33 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Thinking of buying Trading Blox?</title>
		<link>http://www.automated-trading-system.com/trading-blox-teaser-review/</link>
		<comments>http://www.automated-trading-system.com/trading-blox-teaser-review/#comments</comments>
		<pubDate>Mon, 01 Feb 2010 11:59:29 +0000</pubDate>
		<dc:creator>Jez Liberty</dc:creator>
				<category><![CDATA[Backtest]]></category>
		<category><![CDATA[Software]]></category>
		<category><![CDATA[amibroker]]></category>
		<category><![CDATA[comparison]]></category>
		<category><![CDATA[rollover]]></category>
		<category><![CDATA[screenshots]]></category>
		<category><![CDATA[tradersstudio]]></category>
		<category><![CDATA[Trading Blox]]></category>

		<guid isPermaLink="false">http://www.automated-trading-system.com/?p=1422</guid>
		<description><![CDATA[Well, I am&#8230; Regular readers might think that I suffer from backtesting-software-indecision-itis. Having first settled for TradersStudio, I then evaluated (and purchased) AmiBroker and found that it was 25 times faster than TradersStudio (at least for the calculation of the e-ratio). However, AmiBroker is not really geared towards true portfolio allocation testing with Futures and [...]]]></description>
			<content:encoded><![CDATA[<p>Well, I am&#8230;<br />
<a href="http://www.tradingblox.com/" target="_blank" rel="nofollow"><img src="http://www.automated-trading-system.com/wp-content/uploads/2010/01/TradingBloxLogo.jpg" alt="TradingBloxLogo" title="TradingBloxLogo" width="235" height="90" class="aligncenter size-full wp-image-1424" /></a></p>
<p>Regular readers might think that I suffer from <em>backtesting-software-indecision-itis</em>. Having <a href="http://www.automated-trading-system.com/tradersstudio-systems-testing-software/">first settled for TradersStudio</a>, I then evaluated (and purchased) AmiBroker and found that it was <a href="http://www.automated-trading-system.com/amibroker-tradersstudio-speed-comparison/">25 times faster than TradersStudio</a> (at least for the <a href="http://www.automated-trading-system.com/tag/e-ratio/">calculation of the e-ratio</a>). However, AmiBroker is not really geared towards true portfolio allocation testing with Futures and could not just <em>replace</em> TradersStudio &#8211; so I purchased it as a (cheap: $199) complement to it.</p>
<h3>Why TradersStudio in the first place?</h3>
<p>During my first round of evaluation, I did hesitate between TradersStudio and <a href="http://www.tradingblox.com/" target="_blank" rel="nofollow">Trading Blox</a>. At the time, it appeared that there was not a huge difference in functionality but a substantial price difference ($499 for TradersStudio, $3,000 for the full version of Trading Blox Builder). And this is how the choice was made.</p>
<p>However, I never really got past my TraderStudio&#8217;s first (not so good) impressions. Ultimately, I find the platform awkward to work with, documentation rather poor and the user community is very small.</p>
<p>So I decided to give Trading Blox another go and test their latest trial version (v3.3), and give you a <em>teaser</em> review of it.</p>
<h3>Trading Blox: friendly, efficient, fast, professional</h3>
<p>Trading Blox is vastly superior in terms of <span id="more-1422"></span>user interface &#8220;friendliness&#8221; and efficiency (love that script management/edit screen!). This makes the documentation lookup less necessary (and in any case, it is rather better).</p>
<p>The simulation runs are also very fast (300 stepped parameter tests under 7 minutes) and the software comes pre-packed with about a dozen ready-coded systems including the famous Turtle Trading system.</p>
<p>Finally, the numerous backtest options (slippage, commission, rollover slippage, volume, interest, etc.) should simulate trading reality much more closely.</p>
<p>Overall, it feels that the difference between Trading Blox and TradersStudio can be summed up by <em>Pro vs. Amateur</em>: both good at what they do, but playing in different leagues.</p>
<h3>User community</h3>
<p><a href="http://www.tradingblox.com/forum/" target="_blank" rel="nofollow">Trading Blox forum</a> is very good, with top-notch contributors. I joined it a few months ago and the discussion there is top-level, be it on all aspects of trading in general, backtesting, Data problems, Trading Blox questions, etc. It also has a <em>marketplace</em> where users can exchange code/systems, etc. This forum played a big part in my decision to re-consider Trading Blox (TradersStudio&#8217;s own forum and yahoo user group are barely ticking&#8230;).</p>
<h3>In closing: screenshots</h3>
<p>I feel I am about to give in and &#8220;cut my losses short&#8221; with TradersStudio and redeploy my resources towards Trading Blox. In the end, it is a &#8220;time vs dollar trade&#8221; and I feel that the initial outlay will give a great payback (in time savings and progress made). After all, automated trading is a business and one should not shy away from the essential investments.</p>
<p>Tomorrow, I should post a detailed system test using Trading Blox; but for now please find below some screenshots of the software (click to zoom in):<br />
<div id="attachment_1434" class="wp-caption aligncenter" style="width: 160px"><a href="http://www.automated-trading-system.com/wp-content/uploads/2010/01/TradingBloxSampleResults.htm" target="_blank"><img src="http://www.automated-trading-system.com/wp-content/uploads/2010/01/ResultReports-150x150.png" alt="Result Reports" title="ResultReports" width="150" height="150" class="size-thumbnail wp-image-1434" /></a><p class="wp-caption-text">Result Reports</p></div><br />
<div id="attachment_1431" class="wp-caption aligncenter" style="width: 160px"><a href="http://www.automated-trading-system.com/wp-content/uploads/2010/01/GeneralOptions.png" target="_blank"><img src="http://www.automated-trading-system.com/wp-content/uploads/2010/01/GeneralOptions-150x150.png" alt="rich choice in general options" title="GeneralOptions" width="150" height="150" class="size-thumbnail wp-image-1431" /></a><p class="wp-caption-text">rich choice in general options</p></div><br />
<div id="attachment_1432" class="wp-caption aligncenter" style="width: 160px"><a href="http://www.automated-trading-system.com/wp-content/uploads/2010/01/SystemEditor.png" target="_blank"><img src="http://www.automated-trading-system.com/wp-content/uploads/2010/01/SystemEditor-150x150.png" alt="System Editor" title="SystemEditor" width="150" height="150" class="size-thumbnail wp-image-1432" /></a><p class="wp-caption-text">System Editor</p></div><br />
<div id="attachment_1433" class="wp-caption aligncenter" style="width: 160px"><a href="http://www.automated-trading-system.com/wp-content/uploads/2010/01/BloxEditor.png" target="_blank"><img src="http://www.automated-trading-system.com/wp-content/uploads/2010/01/BloxEditor-150x150.png" alt="Blox Editor" title="BloxEditor" width="150" height="150" class="size-thumbnail wp-image-1433" /></a><p class="wp-caption-text">Blox Editor</p></div><br />
<div id="attachment_1435" class="wp-caption aligncenter" style="width: 160px"><a href="http://www.automated-trading-system.com/wp-content/uploads/2010/01/ResultsScatterPlot_P0.png" target="_blank"><img src="http://www.automated-trading-system.com/wp-content/uploads/2010/01/ResultsScatterPlot_P0-150x150.png" alt="Heat map for stepped parameter" title="ResultsScatterPlot_P0" width="150" height="150" class="size-thumbnail wp-image-1435" /></a><p class="wp-caption-text">Heat map for stepped parameter</p></div></p>
]]></content:encoded>
			<wfw:commentRss>http://www.automated-trading-system.com/trading-blox-teaser-review/feed/</wfw:commentRss>
		<slash:comments>49</slash:comments>
		</item>
		<item>
		<title>How to decide on a Backtesting and Trading Platform</title>
		<link>http://www.automated-trading-system.com/backtesting-trading-platform/</link>
		<comments>http://www.automated-trading-system.com/backtesting-trading-platform/#comments</comments>
		<pubDate>Mon, 23 Nov 2009 11:31:55 +0000</pubDate>
		<dc:creator>Jez Liberty</dc:creator>
				<category><![CDATA[Backtest]]></category>
		<category><![CDATA[Software]]></category>
		<category><![CDATA[amibroker]]></category>
		<category><![CDATA[comparison]]></category>
		<category><![CDATA[CSI]]></category>
		<category><![CDATA[eSignal]]></category>
		<category><![CDATA[exchange]]></category>
		<category><![CDATA[Futures]]></category>
		<category><![CDATA[introducing broker]]></category>
		<category><![CDATA[NinjaTrader]]></category>
		<category><![CDATA[R]]></category>
		<category><![CDATA[tradersstudio]]></category>
		<category><![CDATA[tradestation]]></category>
		<category><![CDATA[Zen Fire]]></category>

		<guid isPermaLink="false">http://www.automated-trading-system.com/?p=760</guid>
		<description><![CDATA[As an automated trader you probably need the following components: Broker Account &#8211; The starting point to trade in the markets Live Market Data &#8211; To feed to your trading robot so that it can generate trading signals. Most brokers provide market data with proprietary or third-party technology- although market data can also be obtained [...]]]></description>
			<content:encoded><![CDATA[<p>As an automated trader you probably need the following components:</p>
<ul>
<li><strong>Broker Account</strong> &#8211; The starting point to trade in the markets</li>
<li><strong>Live Market Data</strong> &#8211; To feed to your trading robot so that it can generate trading signals. Most brokers provide market data with proprietary or third-party technology- although market data can also be obtained from an independent vendor (e.g. eSignal).</li>
<li><strong>Order Routing</strong> &#8211; To transmit your orders to the exchange. These can be proprietary to the executing broker or third-party based (e.g. Zen Fire).</li>
<li><strong>Broker Trading Platform</strong> &#8211; To access your account information, place orders, etc.</li>
<li><strong>Charting Platform</strong> &#8211; Sometimes the broker platform charting capabilities are mediocre and an independent charting platform is required (e.g. eSignal)</li>
<li><strong>Signal Generation Platform</strong> &#8211; The actual trading robot: it analyses market data, account and positions information and implements the automated trading strategies to generate trade management signals (i.e. Buy / Sell / Exit, etc.).</li>
<li><strong>Excecution Platform</strong> &#8211; Receives trade signals and forwards them to the order routing.</li>
<li><strong>Platform Hosting</strong> &#8211; You can host the trading robot on your local machine, host it in a dedicated rented server or entrust a specialised broker to host and run your trading robot.</li>
<li><strong>Historical Market Data</strong> &#8211; Used as source for back-testing trading strategies</li>
<li><strong>Strategy Development Application</strong> &#8211; Allows for coding, optimisation, back-test and result analysis of trading strategies.</li>
<li><strong>Statistical Analysis package</strong> &#8211; for in-depth statistical analysis of back-testing results.</li>
</ul>
<p>Some of these distinctions are physical, some are logical. For example, TradeStation packs many of the points above into one system: a broker account and a trading platform that allows you to:<span id="more-760"></span><br />
Access live market data + Visualise price charts + Automate trading strategies that generate signals + Route the trading signals as orders on the exchange + Access account information + Store historical data + Back-test strategies</p>
<p>Sounds like it fits the bill perfectly, doesn&#8217;t it?<br />
Well let&#8217;s look at the areas you need to consider when deciding on your automated platform.</p>
<h3>Type of broker</h3>
<p>Different issues to consider: is the broker a clearing broker, a non-clearing FCM or an introducing broker? If the latter is it an independent introducing broker or a guaranteed introducing broker (backed by a clearer)? It would seem that the closer to the exchange  you broker is (in terms of relationship), the better/safer it is. See <a href="http://www.automated-trading-system.com/anatomy-futures-transaction/">Anatomy of a Futures transaction</a> for more detail on the different types of brokers.</p>
<h3>Markets supported</h3>
<p>Every broker offers access to different products and different markets. For example Interactive Brokers offers one of most complete coverage (worldwide Futures, Options, Equites and Forex) all &#8220;housed&#8221; under the same Universal Account. Other brokers only offer access to specific products/markets.</p>
<h3>Latency/Speed</h3>
<p>For some type of trading strategy, this can have a large impact and various platforms/feeds offer different levels of performance. This has led to specialist companies such as Zen Fire or Trading Technologies &#8211; which locate their servers very close to the exchange &#8211; achieving speed and reliability for data feed and order routing. They offer their services to brokers who can in turn offer it to their clients.</p>
<h3>Development Language</h3>
<p>This is mostly a matter of personal preference, experience and expertise. TradeStation has been around for longer and a big collection of Easy Language scripts are available for re-use while NinjaTrader, for example, uses C# and CQG Trader their own language.</p>
<h3>Strategy Complexity vs. Platform Functionality</h3>
<p>Most of the automated trading platforms that offer back-testing functionality lack sophistication of dedicated applications such as Mechanica, TraderStudio or Trading Blox. For example portfolio testing is usually not available in the live trading platforms. This might work for some simple strategies but not for more complex Money Management ones.</p>
<h3>Hosting</h3>
<p>You can run the trading robot on your machine, which makes you subject to power and connection failures or you can choose to rent a server to host your robot. Some brokers also offer trading strategy hosting and execution on their own servers.</p>
<h3>Charting</h3>
<p>Some specialised platforms offer better charting capabilities than the standard trading platforms and can be used as a standalone charting application. Some, such as eSignal, also offer a data feed.</p>
<h3>Costs</h3>
<p>An obvious one but between platform costs, execution costs, hardware, etc. there exists a wide range between bottom-end and top-end offerings.</p>
<h3>What/how to choose?</h3>
<p>While researching for this article I have come across <em>many</em> different packages offering different solutions. One of the best ways to help you decide on a solution that makes sense to <em>you</em> is to list <em>your goals</em> and cross-check each platform against them <a href="http://home.comcast.net/~countertrender/AI_for_the_Individual_Trader.pdf" target="_blank" rel="nofollow">in this fashion (PDF doc)</a>.</p>
<p>There are endless possibilities for combining all the differenty packages. Just for fun I tried to &#8220;virtually build&#8221; the opposite of an all-in-one package such as TradeStation (which will probably not address most automated trader goals) &#8211; here is one &#8220;wacky&#8221; implementation.<br />
<div id="attachment_762" class="wp-caption aligncenter" style="width: 460px"><img src="http://www.automated-trading-system.com/wp-content/uploads/2009/10/wacky-architecture.png" alt="wacky ATS architecture" title="wacky-architecture" width="450" height="450" class="size-full wp-image-762" /><p class="wp-caption-text">A trader decides to use TradeStation as a signal generating platform. However she does not want to use TradeStation data feed and instead decides to go for the eSignal package integrating the broker Dorman Trading and the Zen-Fire connection for market data and a charting platform. In order to route the market data to TradeStation, she needs a bridge application - OwnData from TS Support for example. The backup feed solution would be TradeStation data feed. For the execution side of things, our trader decides to send the trading signals generated by TradeStation to NinjaTrader, which can route the orders to the exchange through a broker. The primary route is through Velocity Futures broker using Trading Technologies order routing, while the secondary route is through Interactive Brokers via their TWS trading platform and API! Additionally, the strategy research and testing is performed with Mechanica using CQG tick data while the results are analysed using R.</p></div></p>
<h3>Conclusion</h3>
<p>Sorry to end up on a cliche but there are no silver bullet to making the choice. If you take away one point is that you need to list your own requirements clearly and make the choice for yourself based on them.</p>
<p>Check that <a href="http://www.elitetrader.com/vb/showthread.php?threadid=108534<br />
" target="_blank" rel="nofollow">60-page thread at EliteTrader</a> if you want an endless discussion as to which is the best platform/architecture&#8230;</p>
]]></content:encoded>
			<wfw:commentRss>http://www.automated-trading-system.com/backtesting-trading-platform/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>Amibroker vs TradersStudio: comparison</title>
		<link>http://www.automated-trading-system.com/amibroker-v-tradersstudio-comparison/</link>
		<comments>http://www.automated-trading-system.com/amibroker-v-tradersstudio-comparison/#comments</comments>
		<pubDate>Mon, 16 Nov 2009 10:18:38 +0000</pubDate>
		<dc:creator>Jez Liberty</dc:creator>
				<category><![CDATA[Backtest]]></category>
		<category><![CDATA[Software]]></category>
		<category><![CDATA[afl]]></category>
		<category><![CDATA[amibroker]]></category>
		<category><![CDATA[comparison]]></category>
		<category><![CDATA[screenshots]]></category>
		<category><![CDATA[tradersstudio]]></category>

		<guid isPermaLink="false">http://www.automated-trading-system.com/?p=981</guid>
		<description><![CDATA[A couple of weeks ago I downloaded Amibroker to see if it could compute the e-ratio much faster than TradersStudio (it did!). The result of the speed comparison is there and the Amibroker code for the e-ratio is there. I thought it might be interesting to do a comparison of how easy it is to [...]]]></description>
			<content:encoded><![CDATA[<p>A couple of weeks ago I downloaded Amibroker to see if it could <a href="http://www.automated-trading-system.com/e-ratio-trading-edge/">compute the e-ratio</a> much faster than TradersStudio (it did!). The result of the speed comparison is <a href="http://www.automated-trading-system.com/amibroker-tradersstudio-speed-comparison/">there</a> and the Amibroker code for the e-ratio is <a href="http://www.automated-trading-system.com/e-ratio-amibroker-code/">there</a>.<br />
I thought it might be interesting to do a comparison of how easy it is to get on with both platforms as a new user.</p>
<h3>Software and manuals</h3>
<p>You can download a fully-functioning Amibroker demo (you cannot with TraderStudio and even when you buy it you have to wait for CDs by post!) which contains some limitations (i.e no more than 5 markets back-tested at a time, etc.).<br />
The manuals are all online and very thorough, complemented with additional articles, presentations and other materials. This makes it very handy (again compared to TradersStudio printed 300 page manual &#8211; yet incomplete) as you can search them electronically to look for exactly what you need.<span id="more-981"></span></p>
<h3>Large Community</h3>
<p>The Amibroker community seems much wider and as a result there is <em>loads</em> of available scripts for re-use. There is actually a whole <a href="http://www.amibroker.com/library/list.php" target="_blank" rel="nofollow">library</a> hosted on amibroker website.<br />
There is also much, much more information available on the internet. As a sample test I googled &#8220;Amibroker Donchian&#8221; vs. &#8220;TradersStudio Donchian&#8221;: 23,200 results vs. 17 (including this blog!).<br />
Finally the <a href="http://finance.groups.yahoo.com/group/amibroker/" target="_blank" rel="nofollow">yahoo group</a> is much more active. There are about 10 times more daily messages (although the TradersStudio one can go days without getting a single message). As an example I posted a question related to the custom backtester and got a useful answer the next day.</p>
<h3>The platform</h3>
<p>It takes a bit of time to get used to the concept and principles of Amibroker. It is quite different from TradersStudio. For example, all afl files are self-contained and might implement indicator, system, back-test procedure, scan and exploration code all at once (although only one part really runs at once &#8211; alightly confusing at first). In TradersStudio you can also define functions to be called in other code files; this does not appear possible in Amibroker (you would have to copy/paste the code over and over again). Both platforms allow you to build COM dlls to code up your functions.</p>
<p>The GUI is different but I would not say better or worse than TradersStudio.The charting forms a more central part of the Amibroker platform and just firing up a chart with several indicators is pretty quick. At first glance the money management/portfolio allocation does not appear very rich in Amibroker (in terms of functionality) but I would have to do more testing to confirm this.<br />
<div id="attachment_987" class="wp-caption alignnone" style="width: 310px"><a href="http://www.automated-trading-system.com/wp-content/uploads/2009/11/amibroker.jpg" target="_blank"><img src="http://www.automated-trading-system.com/wp-content/uploads/2009/11/amibroker-300x246.jpg" alt="AmiBroker screenshot" title="amibroker screenshot" width="300" height="246" class="size-medium wp-image-987" /></a><p class="wp-caption-text">AmiBroker screenshot</p></div></p>
<p>The language to create your own indicators, systems, etc. (AFL: Amibroker Formula Language) is based on C and not very hard to pick up especially with the very useful in-line help &#8211; it does help to read the tutorials first (!) to get a grasp of the main keywords/built-in functions.</p>
<h3>Data loading</h3>
<p>Loading the <a href="http://www.automated-trading-system.com/unfair-advantage-api-code-c-extract-futures-continuous-data/">data extracted from CSI Unfair Advantage</a> was fairly straight-forward and there seems to be a bunch of ready-made interfaces with other data vendors in addition to the Amiquote utility &#8211; which allows you import quotes in Amibroker. It seems that there is more flexibility in the type of data fields that can be loaded.</p>
<h3>Conclusion</h3>
<p>Overall I was pretty pleased at what I was able to achieve in a short amount of time. For some reason I found it very hard to <em>get into</em> TradersStudio whereas Amibroker was easier to tackle (once you understand its working concept).<br />
Obviously I have not explored all the functionalities of either software and this is definitely not an exhaustive review. As a result of all this I will be buying a copy of Amibroker to complement (or replace?) TradersStudio. I am sure both platforms each have their pros and cons so having both is probably a good idea (and not a very costly one since Amibroker costs only $200!).</p>
]]></content:encoded>
			<wfw:commentRss>http://www.automated-trading-system.com/amibroker-v-tradersstudio-comparison/feed/</wfw:commentRss>
		<slash:comments>9</slash:comments>
		</item>
		<item>
		<title>Amibroker V. TradersStudio: Speed comparison Fight</title>
		<link>http://www.automated-trading-system.com/amibroker-tradersstudio-speed-comparison/</link>
		<comments>http://www.automated-trading-system.com/amibroker-tradersstudio-speed-comparison/#comments</comments>
		<pubDate>Tue, 10 Nov 2009 14:41:15 +0000</pubDate>
		<dc:creator>Jez Liberty</dc:creator>
				<category><![CDATA[Backtest]]></category>
		<category><![CDATA[Software]]></category>
		<category><![CDATA[afl]]></category>
		<category><![CDATA[amibroker]]></category>
		<category><![CDATA[CSI]]></category>
		<category><![CDATA[e-ratio]]></category>
		<category><![CDATA[optimisation]]></category>
		<category><![CDATA[performance]]></category>
		<category><![CDATA[screenshots]]></category>
		<category><![CDATA[tradersstudio]]></category>

		<guid isPermaLink="false">http://www.automated-trading-system.com/?p=930</guid>
		<description><![CDATA[It might not capture the imagination as much as the recent Haye v. Valuev WBA World Heavyweight Championship fight (it probably might for some of you&#8230; ;-) but I decided to organise my own &#8220;fight&#8221;: AmiBroker V. TradersStudio! And similarly to the boxing, speed was of the essence &#8211; with one platform completely out-performing the [...]]]></description>
			<content:encoded><![CDATA[<p><img src="http://www.automated-trading-system.com/wp-content/uploads/2009/11/valuevhayeposter.jpg" alt="valuevhayeposter" title="valuevhayeposter" width="235" height="287" class="alignleft size-full wp-image-932" style="margin-right:12px; margin-bottom:26px;"/><br />
It might not capture the imagination as much as the recent Haye v. Valuev WBA World Heavyweight Championship fight (it probably might for some of you&#8230; ;-) but I decided to organise my own &#8220;fight&#8221;: AmiBroker V. TradersStudio!<br />
And similarly to the boxing, speed was of the essence &#8211; with one platform completely out-performing the other one. Let&#8217;s find out which one&#8230;<span id="more-930"></span></p>
<p>In the last few posts I have been exploring the <a href="http://www.automated-trading-system.com/e-ratio-trading-edge/">e-ratio</a> and wrote the <a href="http://www.automated-trading-system.com/e-ratio-tradersstudio-excel/">code in TradersStudio</a>. I also tried to implement it in <a href="http://www.automated-trading-system.com/e-ratio-amibroker-code/">AmiBroker AFL language</a> mostly to check how it performed speed-wise &#8211; as I found TradersStudio quite slow.</p>
<p>While testing AmiBorker, it actually felt so fast that I decided to perform a more formal speed comparison test.</p>
<h3>Conditions of the test</h3>
<p>I exported the <a href="http://www.automated-trading-system.com/unfair-advantage-api-code-c-extract-futures-continuous-data/">CSI data via the API</a> for a proportionally back-adjusted Corn contract going back to 1949. The data was imported in both AmiBroker and TradersStudio via their ASCII Import.</p>
<p>The system tested is a simple 20-day Donchian Channel Breakout (Buy-only) and the ATR used to normalise the MAE/MFE is 20-day also.<br />
The optimiser in both systems were used to generate the e-ratio for <del datetime="2009-11-10T14:34:18+00:00">50 </del>51 different trade durations (from 10 to 50 days).</p>
<p>One of the condition to validate the results of the test was that the trades generated by both systems are similar (to double-check I did not make a coding mistake resulting in simpler/faster process for one of the platforms).</p>
<p>The computer I was running the test on is a quad-core CPU (2.4 GHz) with 3.25 GB of addressable RAM. Only one platform was running at the time it was tested.</p>
<h3>Results are in!</h3>
<p>And they look astoninglishly good for AmiBroker:</p>
<ul>
<li>The <strong>TradersStudio</strong> test was run first and took <strong>4 mins 15 sec</strong> to complete and produce the custom report (which needs to be manipulated in Excel to calculate the e-ratio). Furthermore, it appeared that every incremental run in the optimisation process took slightly longer than the previous one.</li>
<li>The <strong>AmiBroker</strong> test ran in (&#8230;drumrolls&#8230;) <strong>10 sec!</strong> And the e-ratio was readily available from the results grid:<br />
<div id="attachment_956" class="wp-caption alignnone" style="width: 310px"><a href="http://www.automated-trading-system.com/wp-content/uploads/2009/11/amibroker-optimisation-results.jpg" target="_blank"><img src="http://www.automated-trading-system.com/wp-content/uploads/2009/11/amibroker-optimisation-results-300x191.jpg" alt="AmiBroker optimisation results showing the e-ratio. Click to expand" title="amibroker-optimisation-results" width="300" height="191" class="size-medium wp-image-956" /></a><p class="wp-caption-text">AmiBroker optimisation results showing the e-ratio. Click to expand</p></div></li>
</ul>
<p>Both apps maxed out their allocated CPU (i.e. overall CPU usage of 25% = a quarter of the quad-core CPU available).</p>
<p>I then decided to run the AmiBroker code over <strong>5 markets</strong> to get a feel of how long it would take. I added Crude Oil (going back to 1985), Cotton (1968), Gold (1975) and Yen (1972).<br />
AmiBroker ran the same code + optimisation in <strong>2 mins 20 sec</strong>, twice as fast as one market in TradersStudio!</p>
<p>Applying a simple proportional calculation to derive the time it would take in TradersStudio for the same dataset would give us a completion time of 1 hour (59 min 30 sec exactly&#8230;). Since the performance seems to degrade over the course of the optimisation in TradersStudio (i.e. the first back-test is quicker than the last one of the optimisation run) we could assume that it would actually take longer, which is what I experienced when I was testing on similar data in the last few weeks.</p>
<p>So here you have it: <strong>AmiBroker is 25 times faster than TradersStudio</strong> and it gives you the results in a much more friendly format.</p>
<h3>Trade Reconciliation</h3>
<p>As mentioned earlier, to ensure that the test was valid, the set of trades generated by both systems should be compared. I ran one back-test of the system over the Corn data for a single optimisation step (e-ratio for 20 days duration) in both systems.</p>
<p>I could find that 296 trades out of 340 presented a very good match (some matches had one day difference on the Entry date and rounding differences on the prices). But overall the trade comparison was good enough to give assurance that the same systems and results were being tested.</p>
<p>I&#8217;ll keep investigating for myself where these errors are coming from (and post a  further code update if warranted) but we can assume that the differences are trivial with regards to performance comparison.</p>
<p>Did I mention that AmiBroker is 3 times as cheap with a much wider following (many more code samples, better docs, more forums, etc.)?&#8230;</p>
]]></content:encoded>
			<wfw:commentRss>http://www.automated-trading-system.com/amibroker-tradersstudio-speed-comparison/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Amibroker e-ratio code</title>
		<link>http://www.automated-trading-system.com/e-ratio-amibroker-code/</link>
		<comments>http://www.automated-trading-system.com/e-ratio-amibroker-code/#comments</comments>
		<pubDate>Mon, 09 Nov 2009 12:30:53 +0000</pubDate>
		<dc:creator>Jez Liberty</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[Development]]></category>
		<category><![CDATA[Software]]></category>
		<category><![CDATA[afl]]></category>
		<category><![CDATA[amibroker]]></category>
		<category><![CDATA[e-ratio]]></category>
		<category><![CDATA[edge]]></category>
		<category><![CDATA[optimisation]]></category>
		<category><![CDATA[tradersstudio]]></category>

		<guid isPermaLink="false">http://www.automated-trading-system.com/?p=901</guid>
		<description><![CDATA[I recently posted about the e-ratio as a tool to measure parts of a trading system (the code files to compute the e-ratio in TradersStudio and Excel are also available). The e-ratio is supposed to be a quick tool to check how signals might add some edge to a trading system. However computing the e-ratio [...]]]></description>
			<content:encoded><![CDATA[<p>I recently posted about the <a href="http://www.automated-trading-system.com/e-ratio-trading-edge/">e-ratio</a> as a tool to measure parts of a trading system (the <a href="http://www.automated-trading-system.com/e-ratio-tradersstudio-excel/">code files to compute the e-ratio in TradersStudio and Excel</a> are also available). The e-ratio is supposed to be a quick tool to check how signals might add some edge to a trading system. However computing the e-ratio in TradersStudio is slow (4+ hours for one signal over 100 different durations).</p>
<p>So I decided to give the &#8220;legendary fast&#8221; Amibroker a test to see if it could better TradersStudio&#8217;s performance. After some &#8220;playing and learning&#8221;, I have finalised the code to compute the e-ratio. My big thanks go to the <a href="http://theasxgorilla.blogspot.com/2007/07/how-to-compute-edge-ratio-in-amibroker.html" target="_blank" rel="nofollow">ASX gorilla</a> whose own version forms a large part of my code.<span id="more-901"></span></p>
<p>Below is the code explanation and downloadable <a href="http://www.automated-trading-system.com/wp-content/uploads/2009/11/e-ratio-gorilla.afl" target="_blank">afl file</a>.</p>
<p>Directly from the ASX Gorilla&#8217;s website as a prelude to the code:</p>
<blockquote><p>My implementation of the Edge Ratio involves two profound Amibroker fudges. The first is the use of the AddToComposite function to create a composite ticker symbol in which to hold the ATR array of a given stock for later retrieval within the Custom Back Tester via the Foreign function.</p></blockquote>
<blockquote><p>The second fudge is the use of the VarSet/VarGet function to create a quasi array. This was necessary to overcome the limitation where array elements cannot exceed in number the value of barcount-1.</p></blockquote>
<p>The first part is to actually code up your Buy signal (in our case a Donchian Channel Breakout). The Sell signals are tested separately:</p>

<div class="wp_syntax"><div class="code"><pre class="objc" style="font-family:monospace;"><span style="color: #11740a; font-style: italic;">//BUY RULES: implemented with Buy Stop on Upper Donchian Channel(17)</span>
BuyStop <span style="color: #002200;">=</span> Ref<span style="color: #002200;">&#40;</span>HHV<span style="color: #002200;">&#40;</span>High, <span style="color: #2400d9;">17</span><span style="color: #002200;">&#41;</span>,<span style="color: #002200;">-</span><span style="color: #2400d9;">1</span><span style="color: #002200;">&#41;</span>;
Buy <span style="color: #002200;">=</span> Cross<span style="color: #002200;">&#40;</span> High, BuyStop <span style="color: #002200;">&#41;</span>;
BuyPrice <span style="color: #002200;">=</span> Max<span style="color: #002200;">&#40;</span> BuyStop, Low <span style="color: #002200;">&#41;</span>; <span style="color: #11740a; font-style: italic;">// make sure buy price &gt;= Low</span></pre></div></div>

<p>Exiting positions is done on a fixed duration basis:</p>

<div class="wp_syntax"><div class="code"><pre class="objc" style="font-family:monospace;"><span style="color: #11740a; font-style: italic;">//Never Sell so that the position is stopped out after N bar instead</span>
Sell <span style="color: #002200;">=</span> <span style="color: #2400d9;">3</span> &gt; <span style="color: #2400d9;">5</span>;
<span style="color: #11740a; font-style: italic;">//Stop the positon and close it after N bars</span>
<span style="color: #11740a; font-style: italic;">//(eratio = N that we step from 1 to 100 in optimisation)</span>
ApplyStop<span style="color: #002200;">&#40;</span> stopTypeNBar, stopModeBars, eratio <span style="color: #002200;">&#41;</span>;</pre></div></div>

<p>The first fudge mentioned above to store the ATR:</p>

<div class="wp_syntax"><div class="code"><pre class="objc" style="font-family:monospace;">Normaliser <span style="color: #002200;">=</span> ATR<span style="color: #002200;">&#40;</span><span style="color: #2400d9;">17</span><span style="color: #002200;">&#41;</span>;
AddToComposite<span style="color: #002200;">&#40;</span>Normaliser, <span style="color: #bf1d1a;">&quot;~atr_&quot;</span><span style="color: #002200;">+</span>Name<span style="color: #002200;">&#40;</span><span style="color: #002200;">&#41;</span>, <span style="color: #bf1d1a;">&quot;C&quot;</span>, <span style="color: #2400d9;">1</span><span style="color: #002200;">+</span><span style="color: #2400d9;">2</span><span style="color: #002200;">+</span><span style="color: #2400d9;">8</span><span style="color: #002200;">&#41;</span>;</pre></div></div>

<p>And the &#8220;meat&#8221; of the code: the chunk that implements the custom back-testing to:</p>
<ol>
<li>Loop through the signals and store the Entry ATR value.</li>
<li>Loop through all trades and retrieve MFE, MAE and ATR.</li>
<li>Compute the e-ratio based on values from all trades.</li>
</ol>

<div class="wp_syntax"><div class="code"><pre class="objc" style="font-family:monospace;">SetCustomBacktestProc<span style="color: #002200;">&#40;</span><span style="color: #bf1d1a;">&quot;&quot;</span><span style="color: #002200;">&#41;</span>; <span style="color: #11740a; font-style: italic;">//activate the custom backtester</span>
<span style="color: #a61390;">if</span><span style="color: #002200;">&#40;</span>Status<span style="color: #002200;">&#40;</span><span style="color: #bf1d1a;">&quot;action&quot;</span><span style="color: #002200;">&#41;</span> <span style="color: #002200;">==</span> actionPortfolio<span style="color: #002200;">&#41;</span> <span style="color: #11740a; font-style: italic;">//called when backtesting/optimising</span>
<span style="color: #002200;">&#123;</span>
	bo <span style="color: #002200;">=</span> GetBacktesterObject<span style="color: #002200;">&#40;</span><span style="color: #002200;">&#41;</span>;
	bo.PreProcess<span style="color: #002200;">&#40;</span><span style="color: #002200;">&#41;</span>; <span style="color: #11740a; font-style: italic;">// run default backtest procedure</span>
	TradeATR <span style="color: #002200;">=</span> NumTrades <span style="color: #002200;">=</span> ATRArr <span style="color: #002200;">=</span> <span style="color: #2400d9;">0</span>; <span style="color: #11740a; font-style: italic;">//init variables</span>
	<span style="color: #a61390;">for</span><span style="color: #002200;">&#40;</span> bar<span style="color: #002200;">=</span><span style="color: #2400d9;">0</span>; bar &lt; BarCount<span style="color: #002200;">-</span><span style="color: #2400d9;">1</span>; bar<span style="color: #002200;">++</span><span style="color: #002200;">&#41;</span>
	<span style="color: #002200;">&#123;</span>
		bo.ProcessTradeSignals<span style="color: #002200;">&#40;</span>bar<span style="color: #002200;">&#41;</span>;
&nbsp;
		<span style="color: #a61390;">for</span> <span style="color: #002200;">&#40;</span> sig<span style="color: #002200;">=</span>bo.GetFirstSignal<span style="color: #002200;">&#40;</span>bar<span style="color: #002200;">&#41;</span>; sig; sig<span style="color: #002200;">=</span>bo.GetNextSignal<span style="color: #002200;">&#40;</span>bar<span style="color: #002200;">&#41;</span> <span style="color: #002200;">&#41;</span>
		<span style="color: #002200;">&#123;</span>
			<span style="color: #a61390;">if</span> <span style="color: #002200;">&#40;</span>sig.isEntry<span style="color: #002200;">&#40;</span><span style="color: #002200;">&#41;</span><span style="color: #002200;">&#41;</span>
			<span style="color: #002200;">&#123;</span>
				NumTrades<span style="color: #002200;">++</span>;
				ATRArr <span style="color: #002200;">=</span> Foreign<span style="color: #002200;">&#40;</span><span style="color: #bf1d1a;">&quot;~atr_&quot;</span><span style="color: #002200;">+</span>sig.Symbol, <span style="color: #bf1d1a;">&quot;C&quot;</span><span style="color: #002200;">&#41;</span>;
				VarSet<span style="color: #002200;">&#40;</span><span style="color: #bf1d1a;">&quot;TradeATR&quot;</span> <span style="color: #002200;">+</span> NumTrades, ATRArr<span style="color: #002200;">&#91;</span>bar<span style="color: #002200;">&#93;</span><span style="color: #002200;">&#41;</span>;
&nbsp;
				_TRACE<span style="color: #002200;">&#40;</span><span style="color: #bf1d1a;">&quot;Symbol &quot;</span> <span style="color: #002200;">+</span> sig.Symbol <span style="color: #002200;">+</span> <span style="color: #bf1d1a;">&quot; ATR: &quot;</span> <span style="color: #002200;">+</span> VarGet<span style="color: #002200;">&#40;</span><span style="color: #bf1d1a;">&quot;TradeATR&quot;</span> <span style="color: #002200;">+</span> NumTrades<span style="color: #002200;">&#41;</span><span style="color: #002200;">&#41;</span>;
			<span style="color: #002200;">&#125;</span>
		<span style="color: #002200;">&#125;</span>
	<span style="color: #002200;">&#125;</span>
&nbsp;
	AvgMAE <span style="color: #002200;">=</span> AccumMAE <span style="color: #002200;">=</span> AvgMFE <span style="color: #002200;">=</span> AccumMFE <span style="color: #002200;">=</span> NumTrades <span style="color: #002200;">=</span> <span style="color: #2400d9;">0</span>;
&nbsp;
	<span style="color: #11740a; font-style: italic;">// iterate through closed trades</span>
	<span style="color: #a61390;">for</span><span style="color: #002200;">&#40;</span> trade <span style="color: #002200;">=</span> bo.GetFirstTrade<span style="color: #002200;">&#40;</span><span style="color: #002200;">&#41;</span>; trade; trade <span style="color: #002200;">=</span> bo.GetNextTrade<span style="color: #002200;">&#40;</span><span style="color: #002200;">&#41;</span> <span style="color: #002200;">&#41;</span>
	<span style="color: #002200;">&#123;</span>
		NumTrades<span style="color: #002200;">++</span>;
		EntryATR <span style="color: #002200;">=</span> VarGet <span style="color: #002200;">&#40;</span><span style="color: #bf1d1a;">&quot;TradeATR&quot;</span> <span style="color: #002200;">+</span> NumTrades<span style="color: #002200;">&#41;</span>;
		<span style="color: #a61390;">if</span> <span style="color: #002200;">&#40;</span> EntryATR <span style="color: #002200;">!=</span> <span style="color: #2400d9;">0</span> <span style="color: #002200;">&#41;</span>
		<span style="color: #002200;">&#123;</span>
			_TRACE<span style="color: #002200;">&#40;</span><span style="color: #bf1d1a;">&quot;EntryATR: &quot;</span> <span style="color: #002200;">+</span> WriteVal<span style="color: #002200;">&#40;</span>EntryATR<span style="color: #002200;">&#41;</span><span style="color: #002200;">&#41;</span>;
			_TRACE<span style="color: #002200;">&#40;</span><span style="color: #bf1d1a;">&quot;AccumMAE : &quot;</span> <span style="color: #002200;">+</span> WriteVal<span style="color: #002200;">&#40;</span>AccumMAE<span style="color: #002200;">&#41;</span><span style="color: #002200;">&#41;</span>;
			AccumMAE <span style="color: #002200;">=</span> AccumMAE <span style="color: #002200;">+</span> <span style="color: #002200;">&#40;</span>trade.GetMAE<span style="color: #002200;">&#40;</span><span style="color: #002200;">&#41;</span><span style="color: #002200;">*</span>trade.EntryPrice<span style="color: #002200;">/</span><span style="color: #002200;">&#40;</span><span style="color: #2400d9;">100</span><span style="color: #002200;">*</span>EntryATR<span style="color: #002200;">&#41;</span><span style="color: #002200;">&#41;</span>;
			AccumMFE <span style="color: #002200;">=</span> AccumMFE <span style="color: #002200;">+</span> <span style="color: #002200;">&#40;</span>trade.GetMFE<span style="color: #002200;">&#40;</span><span style="color: #002200;">&#41;</span><span style="color: #002200;">*</span>trade.EntryPrice<span style="color: #002200;">/</span><span style="color: #002200;">&#40;</span><span style="color: #2400d9;">100</span><span style="color: #002200;">*</span>EntryATR<span style="color: #002200;">&#41;</span><span style="color: #002200;">&#41;</span>;
		<span style="color: #002200;">&#125;</span>
&nbsp;
		trade.AddCustomMetric<span style="color: #002200;">&#40;</span><span style="color: #bf1d1a;">&quot;My MAE&quot;</span>, trade.GetMAE<span style="color: #002200;">&#40;</span><span style="color: #002200;">&#41;</span><span style="color: #002200;">*</span>trade.EntryPrice<span style="color: #002200;">/</span><span style="color: #2400d9;">100</span><span style="color: #002200;">&#41;</span>;
		trade.AddCustomMetric<span style="color: #002200;">&#40;</span><span style="color: #bf1d1a;">&quot;My MFE&quot;</span>, trade.GetMFE<span style="color: #002200;">&#40;</span><span style="color: #002200;">&#41;</span><span style="color: #002200;">*</span>trade.EntryPrice<span style="color: #002200;">/</span><span style="color: #2400d9;">100</span><span style="color: #002200;">&#41;</span>;
		trade.AddCustomMetric<span style="color: #002200;">&#40;</span><span style="color: #bf1d1a;">&quot;Entry ATR&quot;</span>, EntryATR<span style="color: #002200;">*</span><span style="color: #2400d9;">10000</span><span style="color: #002200;">&#41;</span>;
	<span style="color: #002200;">&#125;</span>
&nbsp;
	AvgMAE <span style="color: #002200;">=</span> AccumMAE <span style="color: #002200;">/</span> NumTrades;
	AvgMFE <span style="color: #002200;">=</span> AccumMFE <span style="color: #002200;">/</span> NumTrades;
&nbsp;
	_TRACE<span style="color: #002200;">&#40;</span>WriteVal<span style="color: #002200;">&#40;</span>AccumMAE <span style="color: #002200;">&#41;</span><span style="color: #002200;">&#41;</span>;
	_TRACE<span style="color: #002200;">&#40;</span>WriteVal<span style="color: #002200;">&#40;</span>NumTrades<span style="color: #002200;">&#41;</span><span style="color: #002200;">&#41;</span>;
	_TRACE<span style="color: #002200;">&#40;</span>WriteVal<span style="color: #002200;">&#40;</span>AvgMAE<span style="color: #002200;">&#41;</span><span style="color: #002200;">&#41;</span>;
&nbsp;
	Eratio <span style="color: #002200;">=</span> <span style="color: #a61390;">abs</span><span style="color: #002200;">&#40;</span>AvgMFE<span style="color: #002200;">/</span>AvgMAE<span style="color: #002200;">&#41;</span>;
&nbsp;
	_TRACE<span style="color: #002200;">&#40;</span>WriteVal<span style="color: #002200;">&#40;</span>Eratio<span style="color: #002200;">&#41;</span><span style="color: #002200;">&#41;</span>;
&nbsp;
	bo.AddCustomMetric<span style="color: #002200;">&#40;</span> <span style="color: #bf1d1a;">&quot;Avg MAE&quot;</span>, AvgMAE <span style="color: #002200;">&#41;</span>;
	bo.AddCustomMetric<span style="color: #002200;">&#40;</span> <span style="color: #bf1d1a;">&quot;Avg MFE&quot;</span>, AvgMFE <span style="color: #002200;">&#41;</span>;
	bo.AddCustomMetric<span style="color: #002200;">&#40;</span> <span style="color: #bf1d1a;">&quot;Eratio&quot;</span>, Eratio<span style="color: #002200;">&#41;</span>;
&nbsp;
	bo.PostProcess<span style="color: #002200;">&#40;</span><span style="color: #002200;">&#41;</span>;
<span style="color: #002200;">&#125;</span></pre></div></div>

<p>If you want to run this code, you can download the <a href="http://www.automated-trading-system.com/wp-content/uploads/2009/11/e-ratio-gorilla.afl" target="_blank">e-ratio &#8220;gorilla&#8221; afl file</a> and simply update the BUY signals to whatever you fancy testing.</p>
<p>The next post will be a direct speed comparison between TradersStudio and Amibroker for computing the e-ratio on the same underlying data and with the same signal. I expect Amibroker to <em>win the fight</em> hands-down as it appeared &#8220;way&#8221; faster!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.automated-trading-system.com/e-ratio-amibroker-code/feed/</wfw:commentRss>
		<slash:comments>16</slash:comments>
		</item>
	</channel>
</rss>

