<?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; performance</title>
	<atom:link href="http://www.automated-trading-system.com/tag/performance/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>Moving Median: a better indicator than Moving Average?</title>
		<link>http://www.automated-trading-system.com/moving-median-better-indicator-than-moving-average/</link>
		<comments>http://www.automated-trading-system.com/moving-median-better-indicator-than-moving-average/#comments</comments>
		<pubDate>Thu, 14 Jan 2010 12:52:45 +0000</pubDate>
		<dc:creator>Jez Liberty</dc:creator>
				<category><![CDATA[Futures]]></category>
		<category><![CDATA[Strategies]]></category>
		<category><![CDATA[average]]></category>
		<category><![CDATA[comparison]]></category>
		<category><![CDATA[crossover]]></category>
		<category><![CDATA[median]]></category>
		<category><![CDATA[performance]]></category>
		<category><![CDATA[robust]]></category>
		<category><![CDATA[Trend Following]]></category>

		<guid isPermaLink="false">http://www.automated-trading-system.com/?p=1237</guid>
		<description><![CDATA[While searching for robustness, you might come across the term of robust statistical estimator: the median, for instance, is a robust measure of central tendency, while the mean (average) is not (the latter is much more sensitive to outliers). Robustness in trading is a tough beast to tame and understand. The more &#8220;robust&#8221; the research [...]]]></description>
			<content:encoded><![CDATA[<p>While searching for robustness, you might come across the term of <em>robust statistical estimator</em>: the median, for instance, is a robust measure of central tendency, while the mean (average) is not (the latter is much more sensitive to outliers).</p>
<p>Robustness in trading is a <a href="http://www.automated-trading-system.com/robustness-definitions/">tough beast to tame and understand</a>. The more &#8220;robust&#8221; the research and development process, the better (read: <em>robust</em>) the results ought to be, right? With this in mind, I decided to test robust &#8220;tools&#8221; within the actual mechanical trading strategy itself.</p>
<p>The moving average indicator is so ubiquitous in trading that most folks (me included) use it without second thoughts. Its legacy probably dates from the era of expensive and complicated computing (it is relatively inexpensive to compute), so I wanted to revisit its hegemony &#8211; and give it a run for its money: by pitching it against a <em>moving median</em> indicator (on the basis of better statistical robustness for the latter).</p>
<p><em>Could it be that a moving median is actually a better indicator than the moving average?&#8230;</em><span id="more-1237"></span></p>
<h3>The experiment</h3>
<p>To find out I used a basic and simple mechanical trading strategy: the <strong>Moving Average Crossover</strong>. This trading systems is always in the market, buys when the fast moving average crosses <em>over</em> the slow moving average and sells short when the fast average crosses <em>under</em> the slow average.</p>
<p>The second system would be a <strong>Moving Median Crossover</strong>. You guessed it: the same system, but replacing the average by the median.</p>
<p>The markets tested were a random collection of 17 Futures daily prices (proportionally back-adjusted contracts) &#8211; all going back as far as CSI history goes (1920&#8242;s for Wheat!):</p>
<table style="border:1px solid #c3c3c3; border-collapse:collapse;">
<tr>
<th style="background-color:#e5eecc; border:1px solid #c3c3c3; padding-left:2px; font-size: 0.7em;">
      CSI Num.
    </th>
<th style="background-color:#e5eecc; border:1px solid #c3c3c3; padding-left:2px; font-size: 0.7em;">
      &nbsp;Futures Contract
    </th>
<th style="background-color:#e5eecc; border:1px solid #c3c3c3; padding-left:2px; font-size: 0.7em;">
      1st Date
    </th>
</tr>
<tr>
<td style="background-color:#ffffff; border:1px solid #c3c3c3; padding-left:2px; font-size: 0.7em;" align = "right">
5
    </td>
<td style="background-color:#ffffff; border:1px solid #c3c3c3; padding-left:2px; font-size: 0.7em;">
&nbsp;Pork Bellies (Floor+Electronic Combined)-CME
    </td>
<td style="background-color:#ffffff; border:1px solid #c3c3c3; padding-left:2px; font-size: 0.7em;">
20/09/1963
    </td>
</tr>
<tr>
<td style="background-color:#f3f3f3; border:1px solid #c3c3c3; padding-left:2px; font-size: 0.7em;" align = "right">
25
    </td>
<td style="background-color:#f3f3f3; border:1px solid #c3c3c3; padding-left:2px; font-size: 0.7em;">
&nbsp;Swiss Franc-CME-(Floor+Electronic Combined)
    </td>
<td style="background-color:#f3f3f3; border:1px solid #c3c3c3; padding-left:2px; font-size: 0.7em;">
16/05/1972
    </td>
</tr>
<tr>
<td style="background-color:#ffffff; border:1px solid #c3c3c3; padding-left:2px; font-size: 0.7em;" align = "right">
26
    </td>
<td style="background-color:#ffffff; border:1px solid #c3c3c3; padding-left:2px; font-size: 0.7em;">
&nbsp;British Pound-CME(Floor+Electronic Combined)
    </td>
<td style="background-color:#ffffff; border:1px solid #c3c3c3; padding-left:2px; font-size: 0.7em;">
01/01/1970
    </td>
</tr>
<tr>
<td style="background-color:#f3f3f3; border:1px solid #c3c3c3; padding-left:2px; font-size: 0.7em;" align = "right">
41
    </td>
<td style="background-color:#f3f3f3; border:1px solid #c3c3c3; padding-left:2px; font-size: 0.7em;">
&nbsp;T-Bill-U.S. 3 Mth-CME(Floor+Electronic Combined)
    </td>
<td style="background-color:#f3f3f3; border:1px solid #c3c3c3; padding-left:2px; font-size: 0.7em;">
01/06/1976
    </td>
</tr>
<tr>
<td style="background-color:#ffffff; border:1px solid #c3c3c3; padding-left:2px; font-size: 0.7em;" align = "right">
64
    </td>
<td style="background-color:#ffffff; border:1px solid #c3c3c3; padding-left:2px; font-size: 0.7em;">
&nbsp;Canadian Dollar-CME(Floor+Electronic Combined)
    </td>
<td style="background-color:#ffffff; border:1px solid #c3c3c3; padding-left:2px; font-size: 0.7em;">
16/05/1972
    </td>
</tr>
<tr>
<td style="background-color:#f3f3f3; border:1px solid #c3c3c3; padding-left:2px; font-size: 0.7em;" align = "right">
65
    </td>
<td style="background-color:#f3f3f3; border:1px solid #c3c3c3; padding-left:2px; font-size: 0.7em;">
&nbsp;Japanese Yen-CME(Floor+Electronic Combined)
    </td>
<td style="background-color:#f3f3f3; border:1px solid #c3c3c3; padding-left:2px; font-size: 0.7em;">
16/05/1972
    </td>
</tr>
<tr>
<td style="background-color:#ffffff; border:1px solid #c3c3c3; padding-left:2px; font-size: 0.7em;" align = "right">
150
    </td>
<td style="background-color:#ffffff; border:1px solid #c3c3c3; padding-left:2px; font-size: 0.7em;">
&nbsp;T-Note-U.S. 10 Yr w/Prj A-CBT(Floor+Electronic Combined)
    </td>
<td style="background-color:#ffffff; border:1px solid #c3c3c3; padding-left:2px; font-size: 0.7em;">
05/03/1982
    </td>
</tr>
<tr>
<td style="background-color:#f3f3f3; border:1px solid #c3c3c3; padding-left:2px; font-size: 0.7em;" align = "right">
290
    </td>
<td style="background-color:#f3f3f3; border:1px solid #c3c3c3; padding-left:2px; font-size: 0.7em;">
&nbsp;S&#038;P 500-CME(Floor+Electronic Combined)
    </td>
<td style="background-color:#f3f3f3; border:1px solid #c3c3c3; padding-left:2px; font-size: 0.7em;">
01/03/1950
    </td>
</tr>
<tr>
<td style="background-color:#ffffff; border:1px solid #c3c3c3; padding-left:2px; font-size: 0.7em;" align = "right">
412
    </td>
<td style="background-color:#ffffff; border:1px solid #c3c3c3; padding-left:2px; font-size: 0.7em;">
&nbsp;Corn-CBT (Floor+Electronic Combined)
    </td>
<td style="background-color:#ffffff; border:1px solid #c3c3c3; padding-left:2px; font-size: 0.7em;">
01/03/1949
    </td>
</tr>
<tr>
<td style="background-color:#f3f3f3; border:1px solid #c3c3c3; padding-left:2px; font-size: 0.7em;" align = "right">
413
    </td>
<td style="background-color:#f3f3f3; border:1px solid #c3c3c3; padding-left:2px; font-size: 0.7em;">
&nbsp;Wheat-CBT (Floor+Electronic Combined)
    </td>
<td style="background-color:#f3f3f3; border:1px solid #c3c3c3; padding-left:2px; font-size: 0.7em;">
01/03/1922
    </td>
</tr>
<tr>
<td style="background-color:#ffffff; border:1px solid #c3c3c3; padding-left:2px; font-size: 0.7em;" align = "right">
856
    </td>
<td style="background-color:#ffffff; border:1px solid #c3c3c3; padding-left:2px; font-size: 0.7em;">
&nbsp;Crude Oil-Light-NYMEX(Floor+Electronic Combined)
    </td>
<td style="background-color:#ffffff; border:1px solid #c3c3c3; padding-left:2px; font-size: 0.7em;">
30/03/1983
    </td>
</tr>
<tr>
<td style="background-color:#f3f3f3; border:1px solid #c3c3c3; padding-left:2px; font-size: 0.7em;" align = "right">
859
    </td>
<td style="background-color:#f3f3f3; border:1px solid #c3c3c3; padding-left:2px; font-size: 0.7em;">
&nbsp;Platinum-NYMEX(Floor+Electronic Combined)
    </td>
<td style="background-color:#f3f3f3; border:1px solid #c3c3c3; padding-left:2px; font-size: 0.7em;">
14/01/1964
    </td>
</tr>
<tr>
<td style="background-color:#ffffff; border:1px solid #c3c3c3; padding-left:2px; font-size: 0.7em;" align = "right">
868
    </td>
<td style="background-color:#ffffff; border:1px solid #c3c3c3; padding-left:2px; font-size: 0.7em;">
&nbsp;Silver-COMEX(Floor+Electronic Combined)
    </td>
<td style="background-color:#ffffff; border:1px solid #c3c3c3; padding-left:2px; font-size: 0.7em;">
21/06/1963
    </td>
</tr>
<tr>
<td style="background-color:#f3f3f3; border:1px solid #c3c3c3; padding-left:2px; font-size: 0.7em;" align = "right">
869
    </td>
<td style="background-color:#f3f3f3; border:1px solid #c3c3c3; padding-left:2px; font-size: 0.7em;">
&nbsp;Natural Gas-Henry Hub-NYMEX(Floor+Electronic Combined)
    </td>
<td style="background-color:#f3f3f3; border:1px solid #c3c3c3; padding-left:2px; font-size: 0.7em;">
03/04/1990
    </td>
</tr>
<tr>
<td style="background-color:#ffffff; border:1px solid #c3c3c3; padding-left:2px; font-size: 0.7em;" align = "right">
1148
    </td>
<td style="background-color:#ffffff; border:1px solid #c3c3c3; padding-left:2px; font-size: 0.7em;">
&nbsp;Cocoa-NYCE(Floor+Electronic Combined)
    </td>
<td style="background-color:#ffffff; border:1px solid #c3c3c3; padding-left:2px; font-size: 0.7em;">
30/12/1965
    </td>
</tr>
<tr>
<td style="background-color:#f3f3f3; border:1px solid #c3c3c3; padding-left:2px; font-size: 0.7em;" align = "right">
1150
    </td>
<td style="background-color:#f3f3f3; border:1px solid #c3c3c3; padding-left:2px; font-size: 0.7em;">
&nbsp;Orange Juice-Frozen-NYCE (Floor+Electronic Combined)
    </td>
<td style="background-color:#f3f3f3; border:1px solid #c3c3c3; padding-left:2px; font-size: 0.7em;">
26/10/1966
    </td>
</tr>
</table>
<p>&nbsp;<br />
The money management for both systems is to trade each instrument in a separate independent sub-account, fully funded (i.e. no leverage used) with profit re-invested. All commissions or slippage are ignored.</p>
<p>The main interest of the experiment is the robustness of each indicator. To quantify this, each system is run over <strong>9 combinations of parameters for the Golden Cross</strong> (fast indicator values: <strong>45, 50 and 55 days</strong>; slow indicator values: <strong>180, 200 and 220 days</strong>). A measure of the robustness of the indicator is the uniformity of the results over the 9 combinations.</p>
<h3>The results</h3>
<p>Below are the total returns for both systems over each parameter set:</p>
<table style="border:1px solid #c3c3c3; border-collapse:collapse;">
<tr>
<th style="background-color:#e5eecc; border:1px solid #c3c3c3; padding:2px;">
      Params<br />(Slow/Fast)
    </th>
<th style="background-color:#e5eecc; border:1px solid #c3c3c3; padding:2px;">
      Average Sys.
    </th>
<th style="background-color:#e5eecc; border:1px solid #c3c3c3; padding:2px;">
      Median Sys.
    </th>
</tr>
<tr>
<td style="background-color:#ffffff; border:1px solid #c3c3c3; padding:2px;" align = "right">
180 / 45
    </td>
<td style="background-color:#ffffff; border:1px solid #c3c3c3; padding:2px;" align = "right">
<div style="color:black">621.35%</div>
</td>
<td style="background-color:#ffffff; border:1px solid #c3c3c3; padding:2px;" align = "right">
<div style="color:black">391.33%</div>
</td>
</tr>
<tr>
<td style="background-color:#f3f3f3; border:1px solid #c3c3c3; padding:2px;" align = "right">
180 / 50
    </td>
<td style="background-color:#f3f3f3; border:1px solid #c3c3c3; padding:2px;" align = "right">
<div style="color:black">682.41%</div>
</td>
<td style="background-color:#f3f3f3; border:1px solid #c3c3c3; padding:2px;" align = "right">
<div style="color:black">71.48%</div>
</td>
</tr>
<tr>
<td style="background-color:#ffffff; border:1px solid #c3c3c3; padding:2px;" align = "right">
180 / 55
    </td>
<td style="background-color:#ffffff; border:1px solid #c3c3c3; padding:2px;" align = "right">
<div style="color:black">805.35%</div>
</td>
<td style="background-color:#ffffff; border:1px solid #c3c3c3; padding:2px;" align = "right">
<div style="color:black">304.81%</div>
</td>
</tr>
<tr>
<td style="background-color:#f3f3f3; border:1px solid #c3c3c3; padding:2px;" align = "right">
200 / 45
    </td>
<td style="background-color:#f3f3f3; border:1px solid #c3c3c3; padding:2px;" align = "right">
<div style="color:black">849.72%</div>
</td>
<td style="background-color:#f3f3f3; border:1px solid #c3c3c3; padding:2px;" align = "right">
<div style="color:black">327.43%</div>
</td>
</tr>
<tr>
<td style="background-color:#ffffff; border:1px solid #c3c3c3; padding:2px;" align = "right">
200 / 50
    </td>
<td style="background-color:#ffffff; border:1px solid #c3c3c3; padding:2px;" align = "right">
<div style="color:black">968.72%</div>
</td>
<td style="background-color:#ffffff; border:1px solid #c3c3c3; padding:2px;" align = "right">
<div style="color:black">216.40%</div>
</td>
</tr>
<tr>
<td style="background-color:#f3f3f3; border:1px solid #c3c3c3; padding:2px;" align = "right">
200 / 55
    </td>
<td style="background-color:#f3f3f3; border:1px solid #c3c3c3; padding:2px;" align = "right">
<div style="color:black">1,506.61%</div>
</td>
<td style="background-color:#f3f3f3; border:1px solid #c3c3c3; padding:2px;" align = "right">
<div style="color:black">773.04%</div>
</td>
</tr>
<tr>
<td style="background-color:#ffffff; border:1px solid #c3c3c3; padding:2px;" align = "right">
220 / 45
    </td>
<td style="background-color:#ffffff; border:1px solid #c3c3c3; padding:2px;" align = "right">
<div style="color:black">2,506.34%</div>
</td>
<td style="background-color:#ffffff; border:1px solid #c3c3c3; padding:2px;" align = "right">
<div style="color:black">1,156.11%</div>
</td>
</tr>
<tr>
<td style="background-color:#f3f3f3; border:1px solid #c3c3c3; padding:2px;" align = "right">
220 / 50
    </td>
<td style="background-color:#f3f3f3; border:1px solid #c3c3c3; padding:2px;" align = "right">
<div style="color:black">3,207.70%</div>
</td>
<td style="background-color:#f3f3f3; border:1px solid #c3c3c3; padding:2px;" align = "right">
<div style="color:black">535.93%</div>
</td>
</tr>
<tr>
<td style="background-color:#ffffff; border:1px solid #c3c3c3; padding:2px;" align = "right">
220 / 55
    </td>
<td style="background-color:#ffffff; border:1px solid #c3c3c3; padding:2px;" align = "right">
<div style="color:black">2,486.55%</div>
</td>
<td style="background-color:#ffffff; border:1px solid #c3c3c3; padding:2px;" align = "right">
<div style="color:black">577.39%</div>
</td>
</tr>
</table>
<p>&nbsp;<br />
At first glance, it appears that the Moving Median indicator significantly under-performs the standard Moving Average indicator for these crossover systems.</p>
<p>Let&#8217;s look a bit deeper at the results with some basic statistical analysis:</p>
<table style="border:1px solid #c3c3c3; border-collapse:collapse;">
<tr>
<th style="background-color:#e5eecc; border:1px solid #c3c3c3; padding:5px;">
      Stats
    </th>
<th style="background-color:#e5eecc; border:1px solid #c3c3c3; padding:5px;">
      Average Sys.
    </th>
<th style="background-color:#e5eecc; border:1px solid #c3c3c3; padding:5px;">
      Median Sys.
    </th>
</tr>
<tr>
<td style="background-color:#ffffff; border:1px solid #c3c3c3; padding:2px;">
Mean Return
    </td>
<td style="background-color:#ffffff; border:1px solid #c3c3c3; padding:2px;" align = "right">
<div style="color:black">1514.97%</div>
</td>
<td style="background-color:#ffffff; border:1px solid #c3c3c3; padding:2px;" align = "right">
<div style="color:black">483.77%</div>
</td>
</tr>
<tr>
<td style="background-color:#f3f3f3; border:1px solid #c3c3c3; padding:2px;">
Std. Dev.
    </td>
<td style="background-color:#f3f3f3; border:1px solid #c3c3c3; padding:2px;" align = "right">
<div style="color:black">970.08%</div>
</td>
<td style="background-color:#f3f3f3; border:1px solid #c3c3c3; padding:2px;" align = "right">
<div style="color:black">326.67%</div>
</td>
</tr>
<tr>
<td style="background-color:#ffffff; border:1px solid #c3c3c3; padding:2px;">
Coefficient of Variation
    </td>
<td style="background-color:#ffffff; border:1px solid #c3c3c3; padding:2px;" align = "right">
0.64
    </td>
<td style="background-color:#ffffff; border:1px solid #c3c3c3; padding:2px;" align = "right">
0.68
    </td>
</tr>
<tr>
<td style="background-color:#f3f3f3; border:1px solid #c3c3c3; padding:2px;">
</td>
<td style="background-color:#f3f3f3; border:1px solid #c3c3c3; padding:2px;" align = "right">
    </td>
<td style="background-color:#f3f3f3; border:1px solid #c3c3c3; padding:2px;" align = "right">
    </td>
</tr>
<tr>
<td style="background-color:#ffffff; border:1px solid #c3c3c3; padding:2px;">
Median Return
    </td>
<td style="background-color:#ffffff; border:1px solid #c3c3c3; padding:2px;" align = "right">
<div style="color:black">968.72%</div>
</td>
<td style="background-color:#ffffff; border:1px solid #c3c3c3; padding:2px;" align = "right">
<div style="color:black">391.33%</div>
</td>
</tr>
<tr>
<td style="background-color:#f3f3f3; border:1px solid #c3c3c3; padding:2px;">
Median Absolute Deviation
    </td>
<td style="background-color:#f3f3f3; border:1px solid #c3c3c3; padding:2px;" align = "right">
<div style="color:black">347.37%</div>
</td>
<td style="background-color:#f3f3f3; border:1px solid #c3c3c3; padding:2px;" align = "right">
<div style="color:black">174.93%</div>
</td>
</tr>
<tr>
<td style="background-color:#ffffff; border:1px solid #c3c3c3; padding:2px;">
Coefficient of Variation
    </td>
<td style="background-color:#ffffff; border:1px solid #c3c3c3; padding:2px;" align = "right">
0.36
    </td>
<td style="background-color:#ffffff; border:1px solid #c3c3c3; padding:2px;" align = "right">
0.45
    </td>
</tr>
</table>
<p>&nbsp;<br />
The calculation confirms the under-performance of the Moving Median Crossover system. What about robustness you ask? Well, the Moving Median still scores worse than the Moving Average on both measures of uniformity/dispersion: the standard <a id="aptureLink_HPSun04jsJ" class='aptureEnhance' href="http://en.wikipedia.org/wiki/Coefficient%20of%20variation" target="_blank" rel="nofollow">Coefficient of Variation</a> (0.64 v 0.68) and its alternative cousin based on Median and <a href="http://en.wikipedia.org/wiki/Median_absolute_deviation" target="_blank" rel="nofollow">Median Absolute Deviation</a> (0.36 v 0.45): The Moving Average System produces more uniform (robust?) results!</p>
<p>Below is also a histogram of all 288 individual returns (per market per parameter combination, i.e. Wheat 180/45, Wheat 200/50, Silver 200/50, etc.):</p>
<p><img src="http://www.automated-trading-system.com/wp-content/uploads/2010/01/IndividualReturns.png" alt="IndividualReturns" title="IndividualReturns" width="495" height="370" class="alignnone size-full wp-image-1264" /></p>
<p>There is clearly more blue presence on the left side of the chart and more red one on the right side&#8230;</p>
<h3>A potential explanation</h3>
<p>Using some <em>inductive logic</em> (warning: this might be dangerous when dealing with data from <em>Extremistan<sup>*</sup></em>), I started eye-balling the charts in search for some clues as to why the Median under-performs the Average. Below is an example of what I found:</p>
<div id="attachment_1269" class="wp-caption alignnone" style="width: 506px"><img src="http://www.automated-trading-system.com/wp-content/uploads/2010/01/Cocoa-Crossover.png" alt="Crossovers for Cocoa 2004-2010" title="Cocoa-Crossover" width="496" height="339" class="size-full wp-image-1269" /><p class="wp-caption-text">Crossovers for Cocoa 2004-2010</p></div>
<p>The chart above only shows Moving Averages and Moving Medians (the prices have been removed to make the picture clearer). Average and Median seem to closely follow each other both on slow and fast sides. Indeed the bulk of the trades take place at roughly the same time (i.e. they both detect large trends fairly similarly).</p>
<p>However, if we zoom in over that red-circled congested area:</p>
<div id="attachment_1270" class="wp-caption aligncenter" style="width: 428px"><img src="http://www.automated-trading-system.com/wp-content/uploads/2010/01/Crossover-zommedin.png" alt="Zoomed-in portion of Cocoa chart" title="Crossover-zommedin" width="418" height="279" class="size-full wp-image-1270" /><p class="wp-caption-text">Zoomed-in portion of Cocoa chart</p></div>
<p>We can see that the Median Crossover system generates more signals than the Moving Average one (9 v 5). Trend following systems notoriously make big bucks in large moves but lose money in trend-less, range-bound markets &#8211; like the one being zoomed into. If the Moving Median Crossover system is more active in these sort of markets it will generate more losing trades while capturing similar big winners to the Moving Average Crossover system.</p>
<p>Intuitively, it could be hypothesized that the Moving Average evolves in a smoother manner and will generate smoother curves with less erratic moves and consequently less losing trades during trend-less markets &#8211; while the Moving Median does not generate a significant edge in detecting large trends.</p>
<p>One test is hardly enough to provide siginificant evidence, however this should give us some insights in the nature of the Moving Median indicator. The first insights being no increase in robustness and a drop in performance (when comparing total returns).</p>
<p>&nbsp;<br />
&nbsp;<br />
<sup>*</sup><em>Extremistan</em>: concept popularised by Nassim Taleb to describe the &#8220;province&#8221; where the total can be conceivably impacted by a single observation (e.g. financial data, wealth distribution). The opposite is Mediocristan: the province dominated by the mediocre, with few extreme successes or failures. No single observation can meaningfully affect the aggregate (e.g. human height and weight distribution). The bell curve is grounded in Mediocristan. There is a qualitative difference between Gaussians and scalable laws, much like gas and water.</p>
<p>For more info on Taleb&#8217;s terms, check his <a href="http://www.automated-trading-system.com/fooled-by-randomness-taleb" target="_blank" rel="no follow">Fooled by Randomness</a> <a href="http://www.fooledbyrandomness.com/glossary.pdf" target="_blank" rel="no follow">glossary (PDF)</a>.<!--more--></p>
]]></content:encoded>
			<wfw:commentRss>http://www.automated-trading-system.com/moving-median-better-indicator-than-moving-average/feed/</wfw:commentRss>
		<slash:comments>13</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>
	</channel>
</rss>

