<?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; robust</title>
	<atom:link href="http://www.automated-trading-system.com/tag/robust/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>Bliss recipe with a robustness spice</title>
		<link>http://www.automated-trading-system.com/bliss-recipe-robustness-spice/</link>
		<comments>http://www.automated-trading-system.com/bliss-recipe-robustness-spice/#comments</comments>
		<pubDate>Thu, 04 Feb 2010 10:58:29 +0000</pubDate>
		<dc:creator>Jez Liberty</dc:creator>
				<category><![CDATA[Backtest]]></category>
		<category><![CDATA[bliss function]]></category>
		<category><![CDATA[optimisation]]></category>
		<category><![CDATA[robust]]></category>

		<guid isPermaLink="false">http://www.automated-trading-system.com/?p=1489</guid>
		<description><![CDATA[This post is trying to present a process to determine your bliss function, as a follow-up to the previous post introducing the bliss function concept. We&#8217;ve seen that the bliss function is not a universal function but needs to encapsulate your own criteria for evaluating a trading system. Similarly to popular dishes, everybody has got [...]]]></description>
			<content:encoded><![CDATA[<p>This post is trying to present a process to determine your bliss function, as a follow-up to the <a href="http://www.automated-trading-system.com/bliss-function-quantify-trading-system-objective/">previous post introducing the bliss function concept</a>.<br />
<div id="attachment_1495" class="wp-caption alignleft" style="width: 260px"><img src="http://www.automated-trading-system.com/wp-content/uploads/2010/02/MasterChef.png" alt="Master Chef Paul Fraser - photo: Peter-Duke@flickr" title="MasterChef" width="250" height="310" class="size-full wp-image-1495" /><p class="wp-caption-text">Master Chef Paul Fraser - photo: Peter-Duke@flickr</p></div>We&#8217;ve seen that the bliss function is not a universal function but needs to encapsulate <em>your own</em> criteria for evaluating a trading system. Similarly to popular dishes, everybody has got their own recipe based on their personal preferences.<br />
&nbsp;</p>
<p>Well, &#8220;building&#8221; your bliss function is a bit like making up your own recipe: you first have to choose the main ingredients (return, variance, risk, etc.) and mix them in a way that makes sense and in the right proportions. Most great chefs perfect their recipes through <em>trial and error</em>. The process can equally be applied to the bliss function.<br />
&nbsp;<br />
Please note that my bliss function recipe is not finished. I am merely floating the idea of how I am planning to establish my <em> bliss equation</em>. Please feel free to comment if you have any comments on super ingredients you know about: at the Au.Tra.Sy restaurant, everybody can help in the cuisine!</p>
<h3>Main ingredients and proportions</h3>
<p>First, you have to decide what will be in your recipe. The base ingredients will probably be return, variance and risk. These can be declined in several flavours which you must choose. In the <a href="http://www.automated-trading-system.com/bliss-function-quantify-trading-system-objective/">previous bliss function post</a>, we looked at the following comparison of 2 different systems:<span id="more-1489"></span></p>
<div id="attachment_1307" class="wp-caption alignnone" style="width: 356px"><img src="http://www.automated-trading-system.com/wp-content/uploads/2010/01/SyssX-SysY.png" alt="test caption" title="SyssX-SysY" width="346" height="209" class="size-full wp-image-1307" /><p class="wp-caption-text">MAR = CAGR / MaxDD (MaxDD = worst drawdown)</p></div>
<p>This led us to conclude that neither CAGR nor MAR were a good performance and variance measure on their own. From that observation came the idea of using:</p>
<p><code>ln(CAGR + 1) x MAR</code></p>
<p>We then added some more ingredients to complete the recipe such as:</p>
<p><code>Bliss = ln(CAGR + 1) x MAR - 0.5 x ME - 0.1 x TimeInMkt%</code></p>
<p>This would be our base recipe. The process here is just to use common sense (based on your preferences) to build a tentative bliss function equation</p>
<h3>tinkering with ingredients and proportions</h3>
<p>This is the stage where great recipes are made!</p>
<p>If you set out to invent a dish, you&#8217;ll pick up the ingredients that you want to use and mix them with common sense (as we have done above). However, your first attempt will surely need some adjustments (that chocolate cake never turns perfect the first time!)</p>
<p>Test your equation on any system equity curve and stats that you can put your hands on. Use your back-testing software output, real-life fund performance reports, or just make them up: you just want some data to run your equation on.</p>
<p>You should have some ideas of which systems you prefer naturally. Your mission is simply to run the equation on all these systems and make sure that the bliss function ranks them as per your natural preferences. If it does not, you need to tinker with the recipe/equation.</p>
<p>What caused the divergence between the function output and your natural choice? How can you adjust the formula to rectify this? You&#8217;ll probably have to change some coefficients, add some smoothing functions, add a minor ingredient, add some extra logic, etc.</p>
<p>The downside: it is a long, on-going process, maybe a process that does not appear very scientific: but we are not trying to find a universal truth here &#8211; rather your own truth. And unless you can formulate it right off the bat, you have no alternative but <em>trial and error</em></p>
<h3>An extra ingredient: robustness</h3>
<p>That could be chef Jez Liberty&#8217;s signature ingredient &#8211; that makes people love or hate that recipe&#8230;</p>
<p>What we want to measure here is how the system is robust. We&#8217;ve seen that <a href="http://www.automated-trading-system.com/robustness-definitions/">there are multiple ways to define and measure robustness</a>. For this, let&#8217;s concentrate on robustness to slight parameter variation. The process would be three-fold (assuming you are already happy with one robustness-less bliss function equation):</p>
<ul>
<li>Run a backtest of your system with different parameter values</li>
<li>Calculate the bliss value for each of the sub-system/parameter value generated in your backtest</li>
<li>Establish a <em>robustness score</em> for each sub-system/parameter value based on the variance of its own bliss value compared to the bliss values of its neigbouring parameter values</li>
</ul>
<p>A picture will illustrate this more clearly. Imagine that the following is a chart of our bliss values (for each parameter value tested):<br />
<img src="http://www.automated-trading-system.com/wp-content/uploads/2010/02/robustness-parameters.png" alt="robustness-parameters" title="robustness-parameters" width="400" height="265" class="alignnone size-full wp-image-1491" /></p>
<p>The 16th parameter value produces the best bliss value, but its neighbouring values are pretty low: its robustness score would penalise it. On the other hand, parameter #11 seems fairly close to its four closest neighbours and it should get a positive score.</p>
<p>One robustness coefficient (Rob), calculated for each parameter value, could be:<br />
<code>Rob = sd(all) / sd(param,n_neigh)</code><br />
where:<br />
sd(param,neigh) would be the standard deviation of the bliss values across the parameter observed and its <em>n</em> neighbours (e.g. n=4 would consider a group of 5 bliss values)<br />
sd(all) would be the standard deviation across all parameters</p>
<p>The new <em>robust</em> bliss value would be adjusted by Rob such as:<br />
<code>Bliss<sub>new</sub> = Bliss<sub>old</sub> x Rob</code></p>
<p>Of course you would have to tinker with this Rob formula, possibly change the formula a fair bit. But this gives you a base to start working with and test against sample backtest results.</p>
<h3>one main problem</h3>
<p>That robustness measure is only good <em>intra-system</em>, for taking into account which parameter sets are more robust.</p>
<p>This does not allow to compare multiple systems from a robustness point of view. But for this, you just have to start the same <em>thought process</em> again: how do you want to measure robustness for a given system and compare it against another one?</p>
<p>A starting point might be to apply some variations to the trading systems, maybe a 10% variation on the parameter values, a bit of light price &#8220;scrambling&#8221; (i.e. update your price series by adding 0.1% to the close), etc. Measure the variance of the bliss values across these variations for different systems and update the bliss value by this <em>variance score</em>.</p>
<h3>the proof in the pudding?</h3>
<p>At the end of the day, the bliss function is trying to aggregate many aspects of a trading system (performance, variance, risk, robustness, etc.) into one single value. The concept is attractive but the recipe might fail to capture all the subtleties of the ingredients.</p>
<p>Imagine mixing together a <a href="http://www.mydish.co.uk/recipe/2225/Banana%20Banoffee%20Pie" target="_blank" rel="nofollow">banoffee pie</a> with <a href="http://users.skynet.be/RICHIUSO.SOSPEL/HTML/RICHIUSO301.htm#ratatouille" target="_blank" rel="nofollow">ratatouille nicoise</a>, an entrecote, some <a href="http://en.wikipedia.org/wiki/Maroilles_(cheese)" target="_blank" rel="nofollow">Maroilles cheese</a> and a Corn and Clam Chowder all rinsed down with some <a href="http://en.wikipedia.org/wiki/Kaoliang">Kaoliang</a>&#8230; An extreme comparison, you may say but you get the idea (ps: try some of these dishes &#8211; individually &#8211; they are very nice!)</p>
]]></content:encoded>
			<wfw:commentRss>http://www.automated-trading-system.com/bliss-recipe-robustness-spice/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>MMDI Portfolio Filter in Trading Blox</title>
		<link>http://www.automated-trading-system.com/mmdi-portfolio-filter-trading-blox/</link>
		<comments>http://www.automated-trading-system.com/mmdi-portfolio-filter-trading-blox/#comments</comments>
		<pubDate>Tue, 02 Feb 2010 12:21:08 +0000</pubDate>
		<dc:creator>Jez Liberty</dc:creator>
				<category><![CDATA[Backtest]]></category>
		<category><![CDATA[Futures]]></category>
		<category><![CDATA[Software]]></category>
		<category><![CDATA[Strategies]]></category>
		<category><![CDATA[robust]]></category>
		<category><![CDATA[screenshots]]></category>
		<category><![CDATA[Trading Blox]]></category>
		<category><![CDATA[Trend Following]]></category>

		<guid isPermaLink="false">http://www.automated-trading-system.com/?p=1447</guid>
		<description><![CDATA[David Varadi, from the very good CSS Analytics blog, pointed me to his interesting findings on a Mean Median Divergence Indicator (MMDI) he devised as a replacement to the standard MACD. I wanted to test the MMDI as a follow-up to Moving Median: a better indicator than Moving Average?. This also provided a good opportunity [...]]]></description>
			<content:encoded><![CDATA[<p>David Varadi, from the <a href="http://cssanalytics.wordpress.com/" target="_blank">very good CSS Analytics blog</a>, pointed me to his <a href="http://cssanalytics.wordpress.com/2009/08/06/meanmedian-divergence-a-great-trend-indicator-part-1/" target="_blank">interesting findings on a Mean Median Divergence Indicator</a> (MMDI) he devised as a replacement to the standard MACD.</p>
<p>I wanted to test the MMDI as a follow-up to <a href="http://www.automated-trading-system.com/moving-median-better-indicator-than-moving-average/">Moving Median: a better indicator than Moving Average?</a>. This also provided a good opportunity to test Trading Blox (which <a href="">I am thinking of buying</a>).</p>
<h3>MMDI: What is it?</h3>
<p>In short, this is an indicator very similar to the MACD, except that the short moving average of the MACD is replaced by a moving median.</p>
<h3>Portfolio Filter: Trade with the trend</h3>
<p>One concept often used to improve the edge of a trading system is to look at 2 or more timeframes. The main  timeframe (shorter one) is used for triggering trading signals (eg Donchian Channel breakouts), and the longer timeframe is used to determine the direction of the main trend. The filter rules prevent any trade signal to be taken if it goes against the main trend.</p>
<h3>Trading Blox: a componentized testing framework</h3>
<p>A great feature of Trading Blox is that it provides you with a <em>skeleton workflow</em> that forms the framework for the backtesting process. What this means is that Trading Blox implements and runs its logical workflow in the <em>simulation loop</em> (ie read data, update indicators, check entry signals, check exit signals, post-simulation scripts, etc.) but provides you with hooks at every step (about 35 hooks per simulation loop) where you can write your own code for customisation (with access to Trading Blox internal objects).<span id="more-1447"></span></p>
<p>Next is the concept of <em>blocks</em>, which represent the different components of a trading systems (Entry signals, Money Management, Risk Management, Portfolio Filter, etc.). These blocks are easily reusable in any system and implement the functionality required via the code contained in their scripts.</p>
<p>One such block we are interested in for today is the MACD Portfolio Filter:</p>
<div id="attachment_1458" class="wp-caption aligncenter" style="width: 460px"><img src="http://www.automated-trading-system.com/wp-content/uploads/2010/02/MACDPortfolioFilter.png" alt="MACD Portfolio Filter Blox" title="MACDPortfolioFilter" width="450" height="291" class="size-full wp-image-1458" /><p class="wp-caption-text">MACD Portfolio Filter Blox</p></div>
<p>This block stops the system from opening new trades in the opposite direction to the trend (the direction of the trend is derived from the MACD value).</p>
<h3>MMDI Portfolio Filter</h3>
<p>It was easy to use the standard Donchian channel system that ships with Trading Blox and replace its MACD Portfolio filter block by an implementation of the MMDI Portfolio filter. All it took was a copy of that block and an update of some of the scripts to implement the MMDI indicator and the filtering based on its value.</p>
<p>Indicator calculation:</p>

<div class="wp_syntax"><div class="code"><pre class="vb" style="font-family:monospace;">mmdiIndicator=Median(ohlcDiv4,mmdiShort)-emaIndicator</pre></div></div>

<p>Filtering code (long side):</p>

<div class="wp_syntax"><div class="code"><pre class="vb" style="font-family:monospace;">[...]
<span style="color: #008000;">' If positive, then allow long trades
</span><span style="color: #8D38C9; font-weight: bold;">IF</span> ( mmdiIndicator &gt; 0 ) <span style="color: #8D38C9; font-weight: bold;">THEN</span>
	instrument.AllowLongTrades
ENDIF
[...]</pre></div></div>

<p>And applying the new block (MMDI Portfolio Filter) to the system in the system editor screen:<br />
<div id="attachment_1458" class="wp-caption alignleft" style="width: 490px"><img src="http://www.automated-trading-system.com/wp-content/uploads/2010/02/SystemEditorMMDI.png" alt="SystemEditorMMDI" title="SystemEditorMMDI" width="480" height="343" class="alignleft size-full wp-image-1464" /><p class="wp-caption-text">System Editor</p></div><br />
&nbsp;<br />
&nbsp;</p>
<h3>Test Scenario</h3>
<p>The test is a comparison of the standard Donchian Channel breakout Tend Following system with MACD Portfolio Filter against its variation using the MMDI Portfolio Filter.</p>
<p>In order to get more data points (and to test Trading Blox parameter stepping), the comparison was run over a combination of system parameters:<br />
- Long MMDI Moving Average: 200, 250 and 300<br />
- Short MMDI Moving Median: 50, 62 and 74<br />
- Donchian Channel Length (Entry): 20, 30 and 40<br />
- Donchian Channel Length (Exit): 15<br />
- Stop level: 2 x ATR(40)<br />
- Slippage: 15% of ATR (+3% at rollover)<br />
- Commissions: $12.50 per contract<br />
- Dates: 01/01/2001 to 09/30/2010<br />
- Instruments: 28 liquid futures (currencies, commodities, financials)</p>
<h3>Test Results</h3>
<p>Here are the two results tables produced by Trading Blox, showing a few stats for each system tested:</p>
<div id="attachment_1450" class="wp-caption aligncenter" style="width: 310px"><a href="http://www.automated-trading-system.com/wp-content/uploads/2010/02/MACD_Results.png" target="_blank"><img src="http://www.automated-trading-system.com/wp-content/uploads/2010/02/MACD_Results-300x182.png" alt="MACD Portfolio Filter Results" title="MACD_Results" width="300" height="182" class="size-medium wp-image-1450" /></a><p class="wp-caption-text">MACD Portfolio Filter Results - click to expand</p></div>
<div id="attachment_1451" class="wp-caption aligncenter" style="width: 310px"><a href="http://www.automated-trading-system.com/wp-content/uploads/2010/02/MMDI_Results.png" target="_blank"><img src="http://www.automated-trading-system.com/wp-content/uploads/2010/02/MMDI_Results-300x180.png" alt="MMDI Portfolio Filter results" title="MMDI_Results" width="300" height="180" class="size-medium wp-image-1451" /></a><p class="wp-caption-text">MMDI Portfolio Filter results - click to expand</p></div>
<p>Looking at the CAGR and Sharpe ratio on aggregate, here is the how the systems compare:</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;">
      MACD Sys.
    </th>
<th style="background-color:#e5eecc; border:1px solid #c3c3c3; padding:5px;">
      MMDI Sys.
    </th>
</tr>
<tr>
<td style="background-color:#ffffff; border:1px solid #c3c3c3; padding:2px;">
Median CAGR
    </td>
<td style="background-color:#ffffff; border:1px solid #c3c3c3; padding:2px;" align = "right">
<div style="color:black">13.94%</div>
</td>
<td style="background-color:#ffffff; border:1px solid #c3c3c3; padding:2px;" align = "right">
<div style="color:black">15.58%</div>
</td>
</tr>
<tr>
<td style="background-color:#f3f3f3; border:1px solid #c3c3c3; padding:2px;">
CAGR Median Absolute Deviation
    </td>
<td style="background-color:#f3f3f3; border:1px solid #c3c3c3; padding:2px;" align = "right">
<div style="color:black">1.68%</div>
</td>
<td style="background-color:#f3f3f3; border:1px solid #c3c3c3; padding:2px;" align = "right">
<div style="color:black">1.83%</div>
</td>
</tr>
<tr>
<td style="background-color:#ffffff; border:1px solid #c3c3c3; padding:2px;">
CAGR Coefficient of Variation
    </td>
<td style="background-color:#ffffff; border:1px solid #c3c3c3; padding:2px;" align = "right">
0.1205
    </td>
<td style="background-color:#ffffff; border:1px solid #c3c3c3; padding:2px;" align = "right">
0.1175
    </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 Sharpe ratio
    </td>
<td style="background-color:#ffffff; border:1px solid #c3c3c3; padding:2px;" align = "right">
<div style="color:black">0.42</div>
</td>
<td style="background-color:#ffffff; border:1px solid #c3c3c3; padding:2px;" align = "right">
<div style="color:black">0.45</div>
</td>
</tr>
<tr>
<td style="background-color:#f3f3f3; border:1px solid #c3c3c3; padding:2px;">
Sharpe ratio Median Absolute Deviation
    </td>
<td style="background-color:#f3f3f3; border:1px solid #c3c3c3; padding:2px;" align = "right">
<div style="color:black">0.06</div>
</td>
<td style="background-color:#f3f3f3; border:1px solid #c3c3c3; padding:2px;" align = "right">
<div style="color:black">0.07</div>
</td>
</tr>
<tr>
<td style="background-color:#ffffff; border:1px solid #c3c3c3; padding:2px;">
Sharpe ratio Coefficient of Variation
    </td>
<td style="background-color:#ffffff; border:1px solid #c3c3c3; padding:2px;" align = "right">
0.1429
    </td>
<td style="background-color:#ffffff; border:1px solid #c3c3c3; padding:2px;" align = "right">
0.1556
    </td>
</tr>
</table>
<h3>Conclusions</h3>
<p>First on Trading Blox: it was fairly straight-forward to code up this new indicator and system. The stepped parameter tests were also really quick to run (<1 min). Still pretty pleased and feeling at ease with it.</p>
<p>The test results show a small improvement in the MMDI favour. A possible explanation might be that the more volatile nature of the moving median (as illustrated in the <a href="http://www.automated-trading-system.com/moving-median-better-indicator-than-moving-average/">moving median indicator post</a>) allows it to pick up changes in trend faster (and get in them at an earlier, better price).</p>
<p>The whipsawing produced in the Moving Median crossover run would normally take place during range-bound markets, where few Donchain breakouts would happen, therefore cancelling the extra noise and losses associated with them.</p>
<p>Might be worth investigating further&#8230;<br />
&nbsp;<br />
&nbsp;<br />
PS: David&#8217;s code for MMDI on TradeStation is available for free on his <a href="http://www.dvindicators.com/indicator/mmdi/" target="_blank">dvindicators.com website</a></p>
<p>PS2: As a comparison, and to illustrate the impact of a portfolio filter, here are the results for the same system without any Portfolio Filter:</p>
<div id="attachment_1469" class="wp-caption aligncenter" style="width: 310px"><a href="http://www.automated-trading-system.com/wp-content/uploads/2010/02/NoFilterResults.png" target="_blank"><img src="http://www.automated-trading-system.com/wp-content/uploads/2010/02/NoFilterResults-300x56.png" alt="Only 3 sets of results as the MACD/MMDI stepped parameters have been removed" title="NoFilterResults" width="300" height="56" class="size-medium wp-image-1469" /></a><p class="wp-caption-text">Only 3 sets of results as the MACD/MMDI stepped parameters have been removed  - click to expand</p></div>
<p>Without the trend filter applied to the portfolio, the Donchian channel breakout system now exhibits a negative performance (-2.68% on average across the 3 backtests). The trend is definitely your friend!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.automated-trading-system.com/mmdi-portfolio-filter-trading-blox/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<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>Robustness? What robustness?</title>
		<link>http://www.automated-trading-system.com/robustness-definitions/</link>
		<comments>http://www.automated-trading-system.com/robustness-definitions/#comments</comments>
		<pubDate>Thu, 17 Dec 2009 12:53:06 +0000</pubDate>
		<dc:creator>Jez Liberty</dc:creator>
				<category><![CDATA[Backtest]]></category>
		<category><![CDATA[eckhardt]]></category>
		<category><![CDATA[optimisation]]></category>
		<category><![CDATA[robust]]></category>

		<guid isPermaLink="false">http://www.automated-trading-system.com/?p=1175</guid>
		<description><![CDATA[Stepping back from the story of the cockroach and the cheetah, it seems that robustness is all about survival. For an automated trading system, this means the system &#8220;survives and thrives&#8221; after you decide to put it &#8220;live&#8221;. However there are different ways to look at robustness in a mechanical trading system. Different definitions for [...]]]></description>
			<content:encoded><![CDATA[<p><img src="http://www.automated-trading-system.com/wp-content/uploads/2009/12/3976143160_c81a7d53e3.jpg" alt="Orchid: a robust flower - photo by purplemattfish@flickr" title="Orchid: a robust flower - photo by purplemattfish@flickr" width="300" height="300" style="float:left; margin-right:16px; margin-top:4px;"/>Stepping back from the <a href="http://www.automated-trading-system.com/cheetah-cockroach-robust/">story of the cockroach and the cheetah</a>, it seems that robustness is all about <em>survival</em>. For an automated trading system, this means the system &#8220;survives and thrives&#8221; after you decide to put it &#8220;live&#8221;.</p>
<p>However there are different ways to look at <em>robustness</em> in a mechanical trading system.</p>
<h3>Different definitions for robustness</h3>
<p>Trading system robustness usually implies that the system exhibits similar performance when subject to slight variations. However thinking about it, you realise that this can mean several things:<span id="more-1175"></span></p>
<ul>
<li>Robustness to future prices (the survival aspect)</li>
<li>Robustness to internal changes (i.e. variation in system parameters)</li>
<li>Robustness to external changes (i.e. variation in price data)</li>
<li>Robustness in system design</li>
<li>Robustness in system testing</li>
</ul>
<p>Also check that <a href="http://www.tradingblox.com/forum/viewtopic.php?t=7120 ">Trading Blox forum post</a> for more discussion on robustness (some of which directly inspired ideas in this post).</p>
<p>There are 2 assumptions that can be made:</p>
<p>The first: a system robust to changes (internal and external) will likely be robust to future prices: this is because markets always evolve and changes &#8211; and your system should be able to cope with these changes.</p>
<p>The second one is that creating a system using robust concepts and procedures, both in design and testing, should ensure that the system will show robustness.</p>
<h3>Robust system design</h3>
<p>This generally starts with a trading strategy that makes sense, with few parameters, not many bells and whistles (we do not want the Ferrari that looks good and go fast round the track but which can not go over speed bumps or underground car parks&#8230; Well, I do really&#8230;but you get the point! ;-)</p>
<p>Another aspect to consider when aiming to build a robust trading system is illustrated by this quote from Bill Eckhardt who aims to use robust tools and components in his systems:</p>
<blockquote><p>We developed all our systems exclusively in-house so there aren’t any sort of publicly recognizable indicators I could mention. We definitely use non-linear systems and non-linear indicators. Linear indicators, such as filters with moving averages, have been mined dry. </p></blockquote>
<p>In statistics, the median is a more robust tool than the mean/average (it is les subject to underlying data changes such as outliers). Possibly, using median instead of average in a trading strategy is more robust. A moving &#8220;median&#8221; crossover system would show more robustness than using a classic moving average crossover system &#8211; this is something I am planning to test out.</p>
<h3>Robust system testing</h3>
<p>The main aspect of robust system testing is to ensure that the back-test is realistic and that no over-fitting takes place. We will not go too much in detail as these have been well documented (I recommend <a href="http://www.amazon.com/exec/obidos/ASIN/047126847X/autotradblog-20" target="_blank" rel="nofollow">Perry Kaufman&#8217;s book</a> which has a whole chapter on System Testing and robustness).</p>
<p>Important points are good quality data, in-sample vs. out-of-sample data, realistic assumptions (costs, slippage, etc.), logic in the strategy.</p>
<h3>Robustness to internal changes</h3>
<p>This is when you change the parameters of the trading system. It is probably fairly easy to test and measure. Assume you have a Donchian Channel Breakout system with Channel length at 20 days and ATR-based stop at 30 days with a multiplier of 2.</p>
<p>A robust system would exhibit very similar performance with slightly different parameters: the robustness could be quantified by measuring the overall difference/standard deviation in system&#8217;s performance when varying parameters (for example in a range of +/- 10%), e.g. Donchian Channel Breakout system with Channel length at 22 days and ATR-based stop at 33 days with a multiplier of 1.8, etc.</p>
<h3>Robustness to external changes</h3>
<p>Here, this is mainly the &#8220;parameters&#8221; of the price data that can be amended to test for robustness. There are quite a few things that can be changed such as the set of instruments traded (small permutations should not affect performance drastically), testing period (system performs similarly over all time periods), or even random slight amendments in actual prices.</p>
<h3>Robustness to future prices</h3>
<p>Unfortunately future price data is pretty hard to come by (CSI are pretty good but they <em>only</em> provide historical data! Feel free to email me if you have found a good provider ;-), so you obviously cannot test your system for future price robustness before putting it live.</p>
<p>Arguably, the aim of focusing on robustness with the four previous points is to ensure that the system performs equally well on future prices. However these four robustness aspects in a trading system can only act as a <em>proxy</em> for future prices robustness.</p>
<p>Although we, as trading system developers, like to gain some sort of &#8220;comforting&#8221; certainty, we have to keep in mind that the future will be unpredictable, markets will change, and therefore designing a system to trade future prices will always contain some degree of uncertainty. It is up to us to decide (and predict) what parameters and proxies are important to ensure robustness in the future.</p>
<p>This might sound like a paradox, but designing an automated trading system involves more <em>discretion and prediction</em> than one would think.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.automated-trading-system.com/robustness-definitions/feed/</wfw:commentRss>
		<slash:comments>8</slash:comments>
		</item>
		<item>
		<title>The Cheetah and the Cockroach: a robust story</title>
		<link>http://www.automated-trading-system.com/cheetah-cockroach-robust/</link>
		<comments>http://www.automated-trading-system.com/cheetah-cockroach-robust/#comments</comments>
		<pubDate>Fri, 04 Dec 2009 10:59:45 +0000</pubDate>
		<dc:creator>Jez Liberty</dc:creator>
				<category><![CDATA[Backtest]]></category>
		<category><![CDATA[Strategies]]></category>
		<category><![CDATA[cheetah]]></category>
		<category><![CDATA[cockroach]]></category>
		<category><![CDATA[Michael Clarke]]></category>
		<category><![CDATA[robust]]></category>

		<guid isPermaLink="false">http://www.automated-trading-system.com/?p=1088</guid>
		<description><![CDATA[Anybody researching automated trading systems quickly comes to realise that robustness is very much a required aspect of any system. Robust systems are sturdy and able to withstand all that the markets can throw at them without collapsing in ruin. To explore this further, let&#8217;s study the animal world with the Cheetah and the Cockroach [...]]]></description>
			<content:encoded><![CDATA[<p>Anybody researching automated trading systems quickly comes to realise that robustness is very much a required aspect of any system. Robust systems are sturdy and able to withstand all that the markets can throw at them without collapsing in ruin.</p>
<p>To explore this further, let&#8217;s study the animal world with the Cheetah and the Cockroach &#8211; bearing in mind how they would compare to trading systems.</p>
<h3>The Animal Metaphor</h3>
<p><img src="http://www.automated-trading-system.com/wp-content/uploads/2009/12/cheetah.gif" alt="A running cheetah" title="A running cheetah" width="140" height="60" style="float:left; margin-right:12px; margin-bottom:8px; margin-top:4px;" />A Cheetahs is a highly specialised and elegant predator. It is a fascinating animal, the fastest on this Earth. However, despite this status, its survival is in jeopardy&#8230;<br />
A cheetah mostly hunts gazelles (ideal size/speed ratio) in vast expanses of land (so as to use their speed). Changes in their environment (types of prey, habitat, terrain, competition from other predators) makes them lose their advantage (edge) and they struggle to hunt anything and survive.</p>
<p><img src="http://www.automated-trading-system.com/wp-content/uploads/2009/12/cockroach.gif" alt="cockroach" title="cockroach" width="91" height="65" style="float:left; margin-right:12px; margin-bottom:4px; margin-top:4px;" />Whereas cockroaches suffer from a vile and dirty reputation, they are very tough little critters, being able to survive in a vast array of unhospitable conditions with barely any food (they are rumoured to be able to survive a nuclear war &#8211; although that seems to be an <a href="http://www.abc.net.au/science/articles/2006/02/23/1567313.htm" target="_blank" rel="nofollow">urban myth</a>).<span id="more-1088"></span></p>
<h3>Back to Trading Systems</h3>
<p>You will have guessed it: the Cockroach &#8220;trading system&#8221; is more likely to be robust than the Cheetah &#8220;trading system&#8221;. Today it might not be pretty compared to the Cheetah, but the Cockroach can adpat to changing conditions. In 100,000 years, it will still probably be around unlike Cheetahs.</p>
<p>What this means is that you might back-test a system that looks very exciting (a Cheetah &#8211; maybe a curve-fitted backtested system) but chances are: it will not survive very long, unlike a trading system that might look a &#8220;bit dull&#8221; in comparison but offers great robustness (the Cockroach).</p>
<h3>How do you know if your trading system is robust</h3>
<p>As we could see robustness in a trading system means that changing the conditions under which the system runs should not have significant impact on its performance. In practice this means that by changing either of:
<ul>
<li>Date range: all the returns should not come from a specific period</li>
<li>Type of markets: if it works on Grains and Metals, it should also work on Interest Rates and Currencies</li>
<li>Parameters of the trading decision tools (i.e. indicators): if a MA of 20 is chosen, a MA of 18, 19, 21 or 22 for example should not alter system performance significantly</li>
</ul>
<p>the characteristics of the trading system should stay similar</p>
<p>To illustrate this point in the real world, listen to Michael Clarke&#8217;s (a <a href="http://www.automated-trading-system.com/resources/trend-following-wizards-fund-performance/">Trend Following Wizard</a>) description of his trading programs:</p>
<blockquote><p>CCM&#8217;s philosophy when developing a model is to test it using a large pool of commodity interests, approximately 105, with data as far back as 1945. In order for the model to be accepted into CCM&#8217;s portfolio of available models, it must trade all 105 markets using the same rules and parameters and the results should indicate excellent performance characteristics for the vast majority (at least 90%) of the markets and for the group of markets as a whole. Also no model is accepted unless it shows stability of performance during tests involved with shifting parameters and altering rules. Much effort has been expended in developing tools to assist in this effort to assure robustness of the models. I consider the software we have developed in this area to be one of our edges in the markets.
</p></blockquote>
<h3>In closing</h3>
<p>I hope this metaphor helps you thrive for robustness: <strong>Don&#8217;t try to build a Cheetah, better build a Cockroach!</strong> It will have better chances of survival &#8211; even though it does not look too pretty.</p>
<p>I believe a trading system robustness is pivotal to its success; and will carry on with a series of posts covering this topic: How to measure robustness? How to make your system robust? Can walk-forward be robust?</p>
<p>PS: Just as I was getting ready to publish this post, I saw <a href="http://www.mebanefaber.com/2009/12/03/where-have-all-the-sharpe-ratios-over-1-gone/" target="_blank" alt="Where have all the sharpe ratios over 1 gone?">this post from Mebane Faber</a> relaying a study from <a href="http://www.blackstarfunds.com/" target="_blank">BlackStar funds</a> showing that long-time survivor CTAs all exhibit a Sharpe ratio below 1 (not so attractive) whereas all Sharpe ratios above 1 &#8220;disappear&#8221; after time. Quite a useful chart proving the point! All the cockroaches seem to out-live the cheetahs&#8230;</p>
]]></content:encoded>
			<wfw:commentRss>http://www.automated-trading-system.com/cheetah-cockroach-robust/feed/</wfw:commentRss>
		<slash:comments>8</slash:comments>
		</item>
	</channel>
</rss>

