<?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; Futures</title>
	<atom:link href="http://www.automated-trading-system.com/category/instruments/futures/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>Wed, 08 Sep 2010 20:32:31 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.4</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>VIX, Peso&#8230; Sometimes you just cannot trade it!</title>
		<link>http://www.automated-trading-system.com/vix-peso-sometimes-you-just-cannot-trade-it/</link>
		<comments>http://www.automated-trading-system.com/vix-peso-sometimes-you-just-cannot-trade-it/#comments</comments>
		<pubDate>Mon, 09 Aug 2010 10:20:42 +0000</pubDate>
		<dc:creator>Jez Liberty</dc:creator>
				<category><![CDATA[Futures]]></category>
		<category><![CDATA[peso]]></category>
		<category><![CDATA[roll yield]]></category>
		<category><![CDATA[VIX]]></category>

		<guid isPermaLink="false">http://www.automated-trading-system.com/?p=2671</guid>
		<description><![CDATA[Or a case for going short VIX despite high bullish consensus?
I have been going on about roll yield and term structure for a few posts, and through two very concrete examples we&#8217;ll see how it can affect your trading and system development
A reader recently mentioned a paper (pdf by Sloyer and Tolkin) presenting a theoretical [...]


Related posts:<ol><li><a href='http://www.automated-trading-system.com/trend-following-returns-breakdown/' rel='bookmark' title='Permanent Link: Trend Following returns breakdown'>Trend Following returns breakdown</a></li>
<li><a href='http://www.automated-trading-system.com/crude-oil-contango-and-roll-yield-for-commodity-trading/' rel='bookmark' title='Permanent Link: Crude Oil, Contango and Roll Yield for Commodity Trading'>Crude Oil, Contango and Roll Yield for Commodity Trading</a></li>
<li><a href='http://www.automated-trading-system.com/roll-yield-commodity-yield-curve/' rel='bookmark' title='Permanent Link: Roll Yield and Commodity Yield Curve'>Roll Yield and Commodity Yield Curve</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<h4>Or a case for going short VIX despite high bullish consensus?</h4>
<p>I have been going on about roll yield and term structure for a few posts, and through two very concrete examples we&#8217;ll see how it can affect your trading and system development</p>
<p>A reader recently mentioned a <a href="http://econ.duke.edu/dje/2008_Symp/Sloyer%20Tolkin.pdf" target="_blank" rel="nofollow">paper (pdf by Sloyer and Tolkin)</a> presenting a <em>theoretical</em> trading strategy which <strong>improves the risk-return profile of standard equity-bond portfolio by adding allocation to equity volatility</strong> represented by the <strong>VIX index</strong>. The idea sounds good on paper (no pun intended), but a &#8220;small&#8221; assumption might render the strategy impossible to implement practically:</p>
<blockquote><p>VIX futures can realistically be included as an asset in a passively managed portfolio as the futures can be rolled relatively cheaply from one contract to the next as each contract expires.</p></blockquote>
<h3>The Current VIX Situation</h3>
<p>Taking a look at the current VIX futures curve clearly invalidates the assumption above:</p>
<div id="attachment_2673" class="wp-caption alignnone" style="width: 490px"><a href="http://www.automated-trading-system.com/wp-content/uploads/2010/08/VIX-futures-curve.gif" target="_blank"><img src="http://www.automated-trading-system.com/wp-content/uploads/2010/08/VIX-futures-curve-small.gif" alt="VIX futures curve - click to zoom in" title="VIX-futures-curve-small" width="480" height="344" class="size-full wp-image-2673" /></a><p class="wp-caption-text">VIX futures curve - click to zoom in</p></div>
<p>At the current levels, the <strong>contango rate is over 100% annualized</strong> &#8211; definitely no <span id="more-2671"></span>&#8220;relatively cheap&#8221; roll yield. As we&#8217;ve seen with the <a href="http://www.automated-trading-system.com/crude-oil-contango-and-roll-yield-for-commodity-trading/">contango exhibited in Crude Oil in 2009</a>, futures performance failed to match the spot price &#8211; and with such a high contango rate in the VIX futures, the same would happen: <strong>spot price returns would be &#8220;eaten away&#8221; by the negative roll yield</strong>. Indeed, prices would have to raise by an annualized 100% just to counter the contango.</p>
<p>Sometimes a good theoretical idea fails at the practical implementation stage&#8230;</p>
<h3>Mexican Peso: Same Concept, Opposite Effect</h3>
<p>Coincidently, another reader was offering me a friendly warning regarding the use of spot market to drive signals for a futures trading strategy &#8211; as was described in <a href="http://www.automated-trading-system.com/better-trend-following-improved-roll-yield/">Better Trend Following through improved Roll Yield</a> (note: for practical reasons, the test in that post was done using front-month contract <em>as a proxy</em> for the spot market).</p>
<p>In effect, as is the case in the VIX futures, the roll yield part of the total return sometimes trumps the spot price moves. In these cases, <strong>looking solely at the spot market can be flawed</strong>.</p>
<p>This is very well illustrated by this Peso chart sent from our reader:</p>
<div id="attachment_2675" class="wp-caption alignnone" style="width: 490px"><a href="http://www.automated-trading-system.com/wp-content/uploads/2010/08/peso.png" target="_blank"><img src="http://www.automated-trading-system.com/wp-content/uploads/2010/08/peso-small.png" alt="The black curve almost continuously going down is the spot price, whereas the blue curve is a continuous futures contract (back-adjusted using front-month contracts) - click to zoom in" title="peso-small" width="480" height="239" class="size-full wp-image-2675" /></a><p class="wp-caption-text">The black curve almost continuously going down is the spot price, whereas the blue curve is a continuous futures contract (back-adjusted using front-month contracts) - click to zoom in</p></div>
<p>The strong divergence between both series meant that an investor/trader going short on the Peso, would have been &#8220;right&#8221; (ie. the Peso unarguably went down), yet would have lost money if using futures to implement her trade (as highlighted by the futures continuous contract going up).</p>
<p>This is another case where the <strong>roll yield has a stronger impact than the spot price move</strong>.</p>
<h3>Two Conclusions</h3>
<p>Despite the spot price usually grabbing most of the attention, the roll yield can be the driving factor to a futures market&#8217;s total return. This can seem counter-intuitive but <strong>on long-term timeframes, roll yield explains most of the market&#8217;s performance</strong> (as discussed in this <a href="http://papers.ssrn.com/sol3/papers.cfm?abstract_id=892387" target="_blank" rel="nofollow">separating the wheat from the chaff</a> paper I have linked to previously).</p>
<p>When looking at potential trades (in futures, or ETFs, which are sometimes no more than futures &#8220;wrappers&#8221; or even forex with cost of carry), one should <strong>weigh the spot price return potential against the term structure implied return</strong>. From a system development point of view, an idea might be to add a portfolio ranking/filter based on the implied yield vs. ATR (or other measure of &#8220;volatility&#8221;). </p>
<p>The second conclusion is that the market seems to <strong>reward those who trade against conventional wisdom</strong>. In that period covered by the Peso chart, most people were worried about further devaluations and were paying dear to hedge against this outcome. The hedge ended up costing them more than the cost of holding on to a devalued Peso. Alpha is finite and flowed to the <strong>minority </strong>being long the <em>falling</em> Peso&#8230; </p>
<p>Maybe time to short the VIX futures?</p>
<img src="http://www.automated-trading-system.com/?ak_action=api_record_view&id=2671&type=feed" alt="" />

<p>Related posts:<ol><li><a href='http://www.automated-trading-system.com/trend-following-returns-breakdown/' rel='bookmark' title='Permanent Link: Trend Following returns breakdown'>Trend Following returns breakdown</a></li>
<li><a href='http://www.automated-trading-system.com/crude-oil-contango-and-roll-yield-for-commodity-trading/' rel='bookmark' title='Permanent Link: Crude Oil, Contango and Roll Yield for Commodity Trading'>Crude Oil, Contango and Roll Yield for Commodity Trading</a></li>
<li><a href='http://www.automated-trading-system.com/roll-yield-commodity-yield-curve/' rel='bookmark' title='Permanent Link: Roll Yield and Commodity Yield Curve'>Roll Yield and Commodity Yield Curve</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://www.automated-trading-system.com/vix-peso-sometimes-you-just-cannot-trade-it/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Better Trend Following via improved Roll Yield</title>
		<link>http://www.automated-trading-system.com/better-trend-following-improved-roll-yield/</link>
		<comments>http://www.automated-trading-system.com/better-trend-following-improved-roll-yield/#comments</comments>
		<pubDate>Mon, 26 Jul 2010 09:49:22 +0000</pubDate>
		<dc:creator>Jez Liberty</dc:creator>
				<category><![CDATA[Futures]]></category>
		<category><![CDATA[Strategies]]></category>
		<category><![CDATA[Trend Following]]></category>
		<category><![CDATA[DB]]></category>
		<category><![CDATA[roll yield]]></category>

		<guid isPermaLink="false">http://www.automated-trading-system.com/?p=2514</guid>
		<description><![CDATA[To round off a series on backwardation, contango and roll yield (posts 1, 2 and 3), let&#8217;s put all this info together and use it in an innovative trading strategy to show how it can improve the performance of a Trend Following system by optimising its roll yield component (note: this could also be applied [...]


Related posts:<ol><li><a href='http://www.automated-trading-system.com/roll-yield-commodity-yield-curve/' rel='bookmark' title='Permanent Link: Roll Yield and Commodity Yield Curve'>Roll Yield and Commodity Yield Curve</a></li>
<li><a href='http://www.automated-trading-system.com/crude-oil-contango-and-roll-yield-for-commodity-trading/' rel='bookmark' title='Permanent Link: Crude Oil, Contango and Roll Yield for Commodity Trading'>Crude Oil, Contango and Roll Yield for Commodity Trading</a></li>
<li><a href='http://www.automated-trading-system.com/trend-following-returns-breakdown/' rel='bookmark' title='Permanent Link: Trend Following returns breakdown'>Trend Following returns breakdown</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<p>To round off a series on backwardation, contango and roll yield (posts <a href="http://www.automated-trading-system.com/crude-oil-contango-and-roll-yield-for-commodity-trading/">1</a>, <a href="http://www.automated-trading-system.com/trend-following-returns-breakdown/">2</a> and <a href="http://www.automated-trading-system.com/roll-yield-commodity-yield-curve/">3</a>), let&#8217;s put all this info together and use it in an innovative trading strategy to show how it can improve the performance of a Trend Following system by <strong>optimising its roll yield component</strong> (note: this could also be applied to other systems than Trend Following). The results are pretty interesting.</p>
<h3>DB Optimal Yield Index</h3>
<p>This idea of optimising roll yield is not a brand new approach, however I have never seen it applied to an active trading strategy.</p>
<p>In fact, I have only seen it applied in the <strong>Deutsche Bank Commodity Index</strong> (exact name is a mouthful: <em>Deutsche Bank Liquid Commodity Index &#8211; Optimum Yield Diversified Excess Return</em> &#8211; which I suspect has really only been devised to underlie their <a href="http://dbfunds.db.com/dbc/index.aspx" target="_blank" rel="nofollow">ETF fund</a> tracking it).</p>
<p>Deutsche Bank seems to have taken on-board the fact that <strong>roll yield represents a non-negligible aspect of futures/commodity investing</strong>. From the index/fund website:</p>
<blockquote><p>The Index is a rules-based index composed of futures contracts on 14 of the most heavily-traded and important physical commodities in the world.</p>
<p>Optimum Yield describes the process by which expiring futures contracts in the Index are replaced with new futures contracts. The <strong>Optimum Yield process</strong> seeks to pick the futures contract expiring in the next thirteen months that has the <strong>highest implied roll yield</strong>.</p></blockquote>
<p>In effect, since the fund is <em>always long</em>, it tries to buy the contract which offers the highest rate of <em>backwardation</em>, or at least the lowest rate of <em>contango</em>.</p>
<p>DB do seem to produce some excess return through that process, as displayed by this comparative chart, <em>taken from their marketing material</em>:</p>
<p><img src="http://www.automated-trading-system.com/wp-content/uploads/2010/07/DBC_Performance_History1.png" alt="DBC_Performance_History" title="DBC_Performance_History" width="499" height="243" class="alignnone size-full wp-image-2516" /></p>
<h3>Optimal Roll Yield Trend Following</h3>
<p>I wanted to check how a similar concept would perform on an active trading strategy such as a <strong>Trend Following system</strong>. <span id="more-2514"></span>Typically, in mechanical futures trading, one usually uses the front-month contract &#8212; makes it <em>easier to backtest</em> (only one back-adjusted continuous time series to handle) and <em>simpler to trade</em> (only one contract to monitor and trade).</p>
<p>However, in a new <strong>optimal roll yield</strong> approach, for each trading signal to buy or sell, one could have a theoritical choice to trade any available contracts and their associated maturities. For any given date where a trading signal occurs, one could check the futures contracts <strong>yield curve</strong> and determine the <strong>contract which will optimise the roll yield</strong> (highest rate of backwardation, or at least the lowest rate of contango for a BUY signal and the opposite for a SELL signal).</p>
<h3>The Methodology: MA Cross-over 50/20 with Optimal Roll Yield</h3>
<p>The <strong>two components</strong> of Trend Following return we are dealing with here are the returns from the <strong>spot price beta moves</strong> and the <strong>roll yields</strong> from the futures contracts (<a href="http://www.automated-trading-system.com/trend-following-returns-breakdown/">TF returns breakdown here</a>).</p>
<p>The idea is to generate the Trend Following signals based off the spot price movements and for each new signal, compute the yield curve to identify the contract which offers the most attractive roll yield (depending on the signal direction). For this example, I picked a very standard <strong>cross-over system using 50-day and 20-day MAs</strong>.</p>
<p>The process sequence looks like this:</p>
<ol>
<li>Generate the Trend Following strategy signals based off the spot price movements (ie crossovers between the spot price 50-day and 20-day MAs); and for each new signal:</li>
<li>Compute the yield curve to identify the contract which offers the most attractive roll yield (depending on the signal direction).</li>
<li>Buy/Sell that contract</li>
<li>Hold the position until either: 1) the contract expires (roll-over) or 2) the position is reversed (new signal + yield curve computation to pick the best yielding contract)</li>
</ol>
<p>The lookup for the &#8220;best&#8221; contract is limited to <strong>12 months in the future</strong>.</p>
<p>Note that roll-overs should happen less frequently than with a <em>standard</em> approach (because you might buy a contract maturing in 12 months and hold it for the full 12 months &#8211; as opposed to rolling over to the front-month contract every month).</p>
<h3>The Results for Crude Oil</h3>
<p>Because I coded some of the test algorithm outside of Trading Blox (see p.s. below for more details), I decided to keep it simple to start with, and ran the test on one instrument only, keeping working with <strong>Crude Oil</strong> (since it instigated this series on roll yield). </p>
<p>As a reference point, the performance of the 20-50 MA cross-over system on front-month contracts (&#8221;standard&#8221; approach) returned a CAGR of 10.25% with a MaxDD of 46.85% and an annualized Sharpe ratio of 0.37 (no trade costs or slippage included in the test).</p>
<p>OK &#8211; enough introduction, here are the comparison results:</p>
<p><img src="http://www.automated-trading-system.com/wp-content/uploads/2010/07/Chart-enhanced-roll-yield.gif" alt="Chart-enhanced-roll-yield" title="Chart-enhanced-roll-yield" width="429" height="335" class="alignnone size-full wp-image-2543" /></p>
<p>The chart shows it pretty clearly and the summary table confirms it:</p>
<table style="border:1px solid #c3c3c3; border-collapse:collapse;">
<tr>
<th style="background-color:#e5eecc; border:1px solid #c3c3c3; padding:5px;" rowspan=2>
      Statistic
    </th>
<th style="background-color:#e5eecc; border:1px solid #c3c3c3; padding:5px;" colspan=2>
      Roll Yield approach:
    </th>
<tr>
<th style="background-color:#e5eecc; border:1px solid #c3c3c3; padding:5px;">
      Standard
    </th>
<th style="background-color:#e5eecc; border:1px solid #c3c3c3; padding:5px;">
      Optimal
    </th>
</tr>
<tr>
<td style="background-color:#f3f3f3; border:1px solid #c3c3c3; padding:5px;">
End Balance (start: 10M)
    </td>
<td style="background-color:#f3f3f3; border:1px solid #c3c3c3; padding:5px;" align = "right">
<div style="color:black">73,517,650.00</div>
</td>
<td style="background-color:#f3f3f3; border:1px solid #c3c3c3; padding:5px;" align = "right">
<div style="color:black"> 131,778,260.00 </div>
</td>
</tr>
<tr>
<td style="background-color:#ffffff; border:1px solid #c3c3c3; padding:5px;">
CAGR
    </td>
<td style="background-color:#ffffff; border:1px solid #c3c3c3; padding:5px;" align = "right">
<div style="color:black">10.26%</div>
</td>
<td style="background-color:#ffffff; border:1px solid #c3c3c3; padding:5px;" align = "right">
<div style="color:black">13.45%</div>
</td>
</tr>
<tr>
<td style="background-color:#f3f3f3; border:1px solid #c3c3c3; padding:5px;">
Max Drawdown
    </td>
<td style="background-color:#f3f3f3; border:1px solid #c3c3c3; padding:5px;" align = "right">
<div style="color:black">46.85%</div>
</td>
<td style="background-color:#f3f3f3; border:1px solid #c3c3c3; padding:5px;" align = "right">
<div style="color:black">28.49%</div>
</td>
</tr>
<tr>
<td style="background-color:#ffffff; border:1px solid #c3c3c3; padding:5px;">
Average Drawdown
    </td>
<td style="background-color:#ffffff; border:1px solid #c3c3c3; padding:5px;" align = "right">
17.38%
    </td>
<td style="background-color:#ffffff; border:1px solid #c3c3c3; padding:5px;" align = "right">
10.27%
    </td>
</tr>
<tr>
<td style="background-color:#f3f3f3; border:1px solid #c3c3c3; padding:5px;">
MAR Ratio
    </td>
<td style="background-color:#f3f3f3; border:1px solid #c3c3c3; padding:5px;" align = "right">
<div style="color:black">0.22</div>
</td>
<td style="background-color:#f3f3f3; border:1px solid #c3c3c3; padding:5px;" align = "right">
<div style="color:black">0.47</div>
</td>
</tr>
<tr>
<td style="background-color:#ffffff; border:1px solid #c3c3c3; padding:5px;">
Modified Sharpe Ratio*
    </td>
<td style="background-color:#ffffff; border:1px solid #c3c3c3; padding:5px;" align = "right">
<div style="color:black">0.37</div>
</td>
<td style="background-color:#ffffff; border:1px solid #c3c3c3; padding:5px;" align = "right">
<div style="color:black">0.54</div>
</td>
</tr>
</table>
<p>&nbsp;<br />
The optimal roll yield approach seems to improve the overall system significantly, whatever metrics you wish to pick for comparison. Pretty pleasing results&#8230;</p>
<h3>Volume and Slippage Considerations</h3>
<p>However, there is an important aspect about trading in the front-month only: <strong>liquidity</strong>. And with liquidity come better fills and lower <a href="http://www.automated-trading-system.com/slippage-backtesting-realistic/">slippage &#8212; which can greatly impact trading system results</a>. </p>
<p>My initial assumption was that if the optimal yield concept was viable for a large player like DB to run a fund with, I should not worry about liquidity for a similar approach with Trend Following. By checking the actual volume figures for each contract bought/sold with the strategy, I quickly realised that some trades had been made on days with <em>very low volume</em> (ie <50) and "only" 83% of trades on a daily volume over 1,000. Oops, was I just chasing an elusive unicorn? A theoritical result impossible to to apply in practical real-life trading...</p>
<p>Adding a <strong>liquidity filter</strong> to the roll yield algorithm would allow to reject contracts for which daily volume is too low and avoid liquidity problems. How much would it affect performance, though?</p>
<p>Not too much actually:</p>
<p><img src="http://www.automated-trading-system.com/wp-content/uploads/2010/07/LiquidityFilter.png" alt="LiquidityFilter" title="LiquidityFilter" width="511" height="298" class="alignnone size-full wp-image-2545" /></p>
<p>The filter is pretty simple: when it computes the yield curve and checks for the contract with the best roll yield, it only considers contract months for which <strong>daily volume</strong> is <strong>over 5,000</strong>.</p>
<p>And for completeness, the table summarizing the three tests undertaken:</p>
<table style="border:1px solid #c3c3c3; border-collapse:collapse;">
<tr>
<th style="background-color:#e5eecc; border:1px solid #c3c3c3; padding:5px;" rowspan=2>
      Statistic
    </th>
<th style="background-color:#e5eecc; border:1px solid #c3c3c3; padding:5px;" colspan=3>
      Roll Yield approach:
    </th>
<tr>
<th style="background-color:#e5eecc; border:1px solid #c3c3c3; padding:5px;">
      Standard
    </th>
<th style="background-color:#e5eecc; border:1px solid #c3c3c3; padding:5px;">
      Optimal
    </th>
<th style="background-color:#e5eecc; border:1px solid #c3c3c3; padding:5px;">
      Optimal w/ Filter
    </th>
</tr>
<tr>
<td style="background-color:#f3f3f3; border:1px solid #c3c3c3; padding:5px;">
End Balance (start: 10M)
    </td>
<td style="background-color:#f3f3f3; border:1px solid #c3c3c3; padding:5px;" align = "right">
<div style="color:black">73,517,650.00</div>
</td>
<td style="background-color:#f3f3f3; border:1px solid #c3c3c3; padding:5px;" align = "right">
<div style="color:black"> 131,778,260.00 </div>
</td>
<td style="background-color:#f3f3f3; border:1px solid #c3c3c3; padding:5px;" align = "right">
<div style="color:black">  137,695,690.00 </div>
</td>
</tr>
<tr>
<td style="background-color:#ffffff; border:1px solid #c3c3c3; padding:5px;">
CAGR
    </td>
<td style="background-color:#ffffff; border:1px solid #c3c3c3; padding:5px;" align = "right">
<div style="color:black">10.26%</div>
</td>
<td style="background-color:#ffffff; border:1px solid #c3c3c3; padding:5px;" align = "right">
<div style="color:black">13.45%</div>
</td>
<td style="background-color:#ffffff; border:1px solid #c3c3c3; padding:5px;" align = "right">
<div style="color:black">13.69%</div>
</td>
</tr>
<tr>
<td style="background-color:#f3f3f3; border:1px solid #c3c3c3; padding:5px;">
Max Drawdown
    </td>
<td style="background-color:#f3f3f3; border:1px solid #c3c3c3; padding:5px;" align = "right">
<div style="color:black">46.85%</div>
</td>
<td style="background-color:#f3f3f3; border:1px solid #c3c3c3; padding:5px;" align = "right">
<div style="color:black">28.49%</div>
</td>
<td style="background-color:#f3f3f3; border:1px solid #c3c3c3; padding:5px;" align = "right">
<div style="color:black">35.56%</div>
</td>
</tr>
<tr>
<td style="background-color:#ffffff; border:1px solid #c3c3c3; padding:5px;">
Average Drawdown
    </td>
<td style="background-color:#ffffff; border:1px solid #c3c3c3; padding:5px;" align = "right">
17.38%
    </td>
<td style="background-color:#ffffff; border:1px solid #c3c3c3; padding:5px;" align = "right">
10.27%
    </td>
<td style="background-color:#ffffff; border:1px solid #c3c3c3; padding:5px;" align = "right">
12.28%
    </td>
</tr>
<tr>
<td style="background-color:#f3f3f3; border:1px solid #c3c3c3; padding:5px;">
MAR Ratio
    </td>
<td style="background-color:#f3f3f3; border:1px solid #c3c3c3; padding:5px;" align = "right">
<div style="color:black">0.22</div>
</td>
<td style="background-color:#f3f3f3; border:1px solid #c3c3c3; padding:5px;" align = "right">
<div style="color:black">0.47</div>
</td>
<td style="background-color:#f3f3f3; border:1px solid #c3c3c3; padding:5px;" align = "right">
<div style="color:black">0.38</div>
</td>
</tr>
<tr>
<td style="background-color:#ffffff; border:1px solid #c3c3c3; padding:5px;">
Modified Sharpe Ratio*
    </td>
<td style="background-color:#ffffff; border:1px solid #c3c3c3; padding:5px;" align = "right">
<div style="color:black">0.37</div>
</td>
<td style="background-color:#ffffff; border:1px solid #c3c3c3; padding:5px;" align = "right">
<div style="color:black">0.54</div>
</td>
<td style="background-color:#ffffff; border:1px solid #c3c3c3; padding:5px;" align = "right">
<div style="color:black">0.51</div>
</td>
</tr>
</table>
<p>&nbsp;</p>
<p>Note that even with the liquidity filter, slippage <em>might still be</em> a bit better in the front-month contract, as this is where a big chunk of the trading is concentrated. However, real-life testing is the only way to verify and quantify this difference.</p>
<p>To get an idea of how slippage would affect the system performance in general, I ran the standard approach system as a backtest in Trading Blox, with slippage set at a pessimistic 25%. Under these conditions, the system performance (CAGR) dropped &#8220;only&#8221; by 2.5 percentage points.</p>
<h3>Conclusion</h3>
<p>One of my main concerns regarding this strategy was the potential loss in &#8220;raw price moves&#8221; (ie the fact that price trends would not propagate as well in alternative contract months), but the strong correlation between the standard and optimized approach seems to indicate that improved roll yield return does not come at the cost of beta spot price moves return, therefore providing a direct bonus.</p>
<p>It is quite evident that liquidity can become an issue and that a liquidity filter should be employed at a minimum. Moreover Crude Oil, used for this example, is one of the largest traded physical commodity. Other products might not offer enough liquidity depth, far in the yield curve. DB, however, can implement its optimal yield approach over 14 different instruments, which indicates that there is scope for this approach to be employed on additional products to Crude Oil. I believe such approach could have its place in a fully diversified Trend Following system &#8211; but only applied to the most liquid instruments.</p>
<p>Finally the optimal approach <em>might</em> generate some additional slippage compared to the traditional approach. However, this extra slippage cost should still be outweighed by the extra roll yield return, as evidenced in the Trading Blox slippage impact test.</p>
<h3>Epilogue: Techie&#8217;s corner</h3>
<p>In terms of techical implementation, this is slightly more complicated than standard back-testing because each instrument must use multiple price streams (for each individual contract) and cannot be handled by standard back-testing packages (that I know of, or without heavy customisation).</p>
<p>To avoid re-developing a back-testing package from scratch, I used my trusted copy of Trading Blox to generate the &#8220;standard/non-optimal roll yield&#8221; MA cross-over system output for a single instrument (Crude Oil), which output several files providing the dates of the signals as well as other useful computations such as position sizing with number of contracts and running Total Equity values. Using this information, I ran a second pass of processing, by reading the signals and other info generated by Trading Blox, and looping through the individual contract data in order to pick, for each entry signal, the best contract on the yield curve (this second part was coded outside of Trading Blox).</p>
<p>&nbsp;<br />
&nbsp;<br />
*Note: the Modified Sharpe ratio is as per Jack Schwager&#8217;s definition in <a href="http://www.amazon.com/exec/obidos/ASIN/0471020575/autotradblog-20" target="_blank" rel="nofollow">Managed Futures, Myths and Truths</a>, which introduces interesting performance metrics. The Modified Sharpe ratio is simply a Sharpe ratio where Rf (risk-free rate of return) is set to 0 (makes it independent of leverage). mSR = E[R] / sd.</p>
<img src="http://www.automated-trading-system.com/?ak_action=api_record_view&id=2514&type=feed" alt="" />

<p>Related posts:<ol><li><a href='http://www.automated-trading-system.com/roll-yield-commodity-yield-curve/' rel='bookmark' title='Permanent Link: Roll Yield and Commodity Yield Curve'>Roll Yield and Commodity Yield Curve</a></li>
<li><a href='http://www.automated-trading-system.com/crude-oil-contango-and-roll-yield-for-commodity-trading/' rel='bookmark' title='Permanent Link: Crude Oil, Contango and Roll Yield for Commodity Trading'>Crude Oil, Contango and Roll Yield for Commodity Trading</a></li>
<li><a href='http://www.automated-trading-system.com/trend-following-returns-breakdown/' rel='bookmark' title='Permanent Link: Trend Following returns breakdown'>Trend Following returns breakdown</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://www.automated-trading-system.com/better-trend-following-improved-roll-yield/feed/</wfw:commentRss>
		<slash:comments>26</slash:comments>
		</item>
		<item>
		<title>Roll Yield and Commodity Yield Curve</title>
		<link>http://www.automated-trading-system.com/roll-yield-commodity-yield-curve/</link>
		<comments>http://www.automated-trading-system.com/roll-yield-commodity-yield-curve/#comments</comments>
		<pubDate>Mon, 19 Jul 2010 06:54:33 +0000</pubDate>
		<dc:creator>Jez Liberty</dc:creator>
				<category><![CDATA[Data]]></category>
		<category><![CDATA[Futures]]></category>
		<category><![CDATA[roll yield]]></category>
		<category><![CDATA[yield curve]]></category>

		<guid isPermaLink="false">http://www.automated-trading-system.com/?p=2478</guid>
		<description><![CDATA[
We have seen previously that backwardation and/or contango can induce a fairly large drift between the performance of an instrument&#8217;s spot market and its corresponding futures market.
This phenomenon can be described as roll yield of futures trading and I suggested it was one of the four components in Trend Following returns. As per that last [...]


Related posts:<ol><li><a href='http://www.automated-trading-system.com/crude-oil-contango-and-roll-yield-for-commodity-trading/' rel='bookmark' title='Permanent Link: Crude Oil, Contango and Roll Yield for Commodity Trading'>Crude Oil, Contango and Roll Yield for Commodity Trading</a></li>
<li><a href='http://www.automated-trading-system.com/better-trend-following-improved-roll-yield/' rel='bookmark' title='Permanent Link: Better Trend Following via improved Roll Yield'>Better Trend Following via improved Roll Yield</a></li>
<li><a href='http://www.automated-trading-system.com/vix-peso-sometimes-you-just-cannot-trade-it/' rel='bookmark' title='Permanent Link: VIX, Peso&#8230; Sometimes you just cannot trade it!'>VIX, Peso&#8230; Sometimes you just cannot trade it!</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<p><img src="http://www.automated-trading-system.com/wp-content/uploads/2010/07/3d-yield-curves.png" alt="3d-yield-curves" title="3d-yield-curves" width="421" height="300" class="aligncenter size-full wp-image-2479" /></p>
<p>We have seen <a href="http://www.automated-trading-system.com/crude-oil-contango-and-roll-yield-for-commodity-trading/">previously</a> that <strong>backwardation</strong> and/or <strong>contango</strong> can induce a fairly large drift between the performance of an instrument&#8217;s spot market and its corresponding futures market.</p>
<p>This phenomenon can be described as <strong>roll yield of futures trading</strong> and I suggested it was one of the <a href="http://www.automated-trading-system.com/trend-following-returns-breakdown/">four components in Trend Following returns</a>. As per that last post&#8217;s conclusion, breaking down the returns should allow to focus, study and improve a trading system&#8217;s individual component &#8211; and this is what we are doing here with the roll yield, by looking into the <strong>Commodity Yield Curve</strong>.</p>
<p>The roll yield had a negative impact in the Crude Oil example, however let&#8217;s explore how it could be turned into an <strong>extra source of profit</strong>&#8230;</p>
<h3>Term Structure &#8211; or Yield Curve</h3>
<p><strong>Term structure</strong> best applies to interest rates analysis. If we take the example of US Treasuries; they cover a wide range of maturities, from T-Bills (one year or less maturity)  , T-Notes (one year to ten years) to T-Bonds (up to thirty years). For any given date, each treasury is priced depending on its maturity and an implied yield can be derived for each maturity. Charting these yields for each maturity gives the <strong>yield curve</strong>, also called <strong>term structure of interest rates</strong>.<span id="more-2478"></span></p>
<p>Below can be found a &#8220;normal&#8221; (upward sloping) yield curve for US Treasuries (from last Friday) showing that yields went slightly down  in the middle of the curve whereas the short and long ends of the curve did not change much:</p>
<p><img src="http://www.automated-trading-system.com/wp-content/uploads/2010/07/yield-cruve.png" alt="yield-cruve" title="yield-cruve" width="484" height="271" class="alignnone size-full wp-image-2480" /></p>
<p>The yield curve, or term structures of interest rates is a major economic indicator, closely watched by many traders to gain insights in the market. You can read more about it at <a href="http://www.investopedia.com/university/advancedbond/advancedbond4.asp" target="_blank" rel="nofollow">investopedia</a> and <a href="http://en.wikipedia.org/wiki/Yield_curve" target="_blank" rel="nofollow">wikipedia</a>.</p>
<h3>Application in Futures Trading</h3>
<p><strong>Term structure</strong> can be similarly transposed to <strong>futures trading</strong>, which deals with the same concept of trading the same instrument (i.e. where a commodity like Corn replaces <em>money</em> used in the case of the <em>classic</em> yield curve) with different maturities (all different contracts and their various expiry/delivery months).</p>
<p>Note that the term <strong>Commodity Yield Curve</strong> is a bit of misnomer as the concept could be applied to any instrument traded in different maturities (i.e. all futures for instance).</p>
<h3>Commodity/Futures Yield Curve: How to Build it?</h3>
<p>The <strong>futures yield curve</strong> is a representation of the <strong>backwardation/contango rate</strong> for the <strong>different maturities of futures contracts</strong>. The contango/backwardation rates are calculated by taking the price difference between the spot/cash market price and the futures contract price. This difference can be expressed as a percentage (for x number of days: time to expiration of the futures contract) and then annualised to calculate an annual contango or backwardation rate, representing an implied yield for the specific maturity.</p>
<p>For example, if the spot market trades at 70 and the October contract (expiring in 90 days) trades at 71, the yield can be calculated as follows:</p>
<ol>
<li>Price difference = 71 &#8211; 70 = 1</li>
<li>Percentage price difference = 1/70 = 1.43% (for 90 days)</li>
<li>Annualised contango rate (yield) = (1.43% + 1)^(365/90) &#8211; 1 = 5.92%</li>
</ol>
<p>Performing this calculation for each contract/maturity would allow to chart a futures yield curve.</p>
<h3>Volatility of the Yield Curve</h3>
<p>I calculated and charted the Crude Oil yield curve in order to analyse and visualise the evolution of the contango/backwardation rates, both across the historical timeline and the range of contract maturities. This was done as discussed above for all contracts available for a given date.</p>
<p>Here is a sample chart using data from December 03 to January 04 where Crude Oil was trading in <em>backwardation</em>:</p>
<p><img src="http://www.automated-trading-system.com/wp-content/uploads/2010/07/backwardation-yield-curve.png" alt="backwardation-yield-curve" title="backwardation-yield-curve" width="493" height="411" class="alignnone size-full wp-image-2495" /></p>
<p>Each &#8220;ribbon&#8221; on the chart represents the yields for all 18 different maturities (1=short, 18=long) for a given date: each ribbon represents the yield curve for that day. All yields are negative because of the backwardated aspect of Crude Oil at the time. Backwardation rates have <em>reasonable </em>values (-15%/+5%) and the associated yield curves vary slightly across time, albeit maintaining a similar pattern.</p>
<p>However this snapshot was taken at relatively quiet times in the market. Fast forward to 2009 and you can see that the market now exhibits contango, with rates spiking to much higher values:</p>
<p><img src="http://www.automated-trading-system.com/wp-content/uploads/2010/07/contango-yield-curve.png" alt="contango-yield-curve" title="contango-yield-curve" width="490" height="404" class="alignnone size-full wp-image-2496" /></p>
<p>Adding any more dates to this chart would make it hardly readable, but to give an idea of how the term structure of Crude Oil can vary over a longer period of time, I have simply plotted the shortest end of the curve (i.e. yields for the contract with closest maturity), which you can imagine as a &#8220;vertical slice&#8221; of the 3-D chart alongside the date axis, where maturity = 1. Here is the chart:</p>
<p><img src="http://www.automated-trading-system.com/wp-content/uploads/2010/07/short-term-yield.png" alt="short-term-yield" title="short-term-yield" width="496" height="321" class="alignnone size-full wp-image-2497" /></p>
<p>There are spikes, alternation between contango and backwardation. It clearly displays some volatility and, for lack of a better term, a <em>character of its own</em>.</p>
<p>Note that because the yield is calculated as an implied value based solely on the price difference between contracts, some discrepancies in these contract prices (for whatever reason) would impact the curve in a more volatile and &#8220;artificial&#8221; way than if it did purely represent the fundamental yield factors (cost of carry, supply/demand and shortage, convenience yield, etc.)</p>
<h3>Some Observations</h3>
<p>The main observations are:</p>
<ul>
<li>Yield curves and their associated contango and backwardation rates evolve in a fairly volatile fashion across time.</li>
<li>For any given date, different contracts and their associated maturities offer different yields, possibly within a wide range of values.</li>
</ul>
<p>This can add an extra dimension to your trading decisions. The yield curve offers other opportunities (than the traditional front-month contract) when wanting to buy or sell any instrument via futures trading. These extra opportunities can be turned into an extra source of profit.</p>
<p>This is really an introduction to a next post, in which we will look into how we can use this information and <strong>apply it to a trading system to improve its roll yield component and enhance its overall performance</strong>.<br />
Stay tuned&#8230;</p>
<img src="http://www.automated-trading-system.com/?ak_action=api_record_view&id=2478&type=feed" alt="" />

<p>Related posts:<ol><li><a href='http://www.automated-trading-system.com/crude-oil-contango-and-roll-yield-for-commodity-trading/' rel='bookmark' title='Permanent Link: Crude Oil, Contango and Roll Yield for Commodity Trading'>Crude Oil, Contango and Roll Yield for Commodity Trading</a></li>
<li><a href='http://www.automated-trading-system.com/better-trend-following-improved-roll-yield/' rel='bookmark' title='Permanent Link: Better Trend Following via improved Roll Yield'>Better Trend Following via improved Roll Yield</a></li>
<li><a href='http://www.automated-trading-system.com/vix-peso-sometimes-you-just-cannot-trade-it/' rel='bookmark' title='Permanent Link: VIX, Peso&#8230; Sometimes you just cannot trade it!'>VIX, Peso&#8230; Sometimes you just cannot trade it!</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://www.automated-trading-system.com/roll-yield-commodity-yield-curve/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Crude Oil, Contango and Roll Yield for Commodity Trading</title>
		<link>http://www.automated-trading-system.com/crude-oil-contango-and-roll-yield-for-commodity-trading/</link>
		<comments>http://www.automated-trading-system.com/crude-oil-contango-and-roll-yield-for-commodity-trading/#comments</comments>
		<pubDate>Tue, 08 Jun 2010 10:19:35 +0000</pubDate>
		<dc:creator>Jez Liberty</dc:creator>
				<category><![CDATA[Futures]]></category>
		<category><![CDATA[backwardation]]></category>
		<category><![CDATA[contango]]></category>
		<category><![CDATA[rollover]]></category>

		<guid isPermaLink="false">http://www.automated-trading-system.com/?p=2385</guid>
		<description><![CDATA[
We have already discussed how roll yield can negatively affect the overall return of a commodity holding The impact of contango or backwardation can be relatively large compared to the overall return.
Petroleum has unfortunately been in the news lately. Nevertheless, Crude Oil performance last year gave us a good illustration of the impact that contango/backwardation [...]


Related posts:<ol><li><a href='http://www.automated-trading-system.com/roll-yield-commodity-yield-curve/' rel='bookmark' title='Permanent Link: Roll Yield and Commodity Yield Curve'>Roll Yield and Commodity Yield Curve</a></li>
<li><a href='http://www.automated-trading-system.com/trend-following-returns-breakdown/' rel='bookmark' title='Permanent Link: Trend Following returns breakdown'>Trend Following returns breakdown</a></li>
<li><a href='http://www.automated-trading-system.com/better-trend-following-improved-roll-yield/' rel='bookmark' title='Permanent Link: Better Trend Following via improved Roll Yield'>Better Trend Following via improved Roll Yield</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.automated-trading-system.com/wp-content/uploads/2010/06/OilBarrel-Magnera.jpg"><img src="http://www.automated-trading-system.com/wp-content/uploads/2010/06/OilBarrel-Magnera.jpg" alt="OilBarrel-Magnera" title="OilBarrel-Magnera" width="199" height="300" class="alignleft size-full wp-image-2386" /></a><br />
We have already discussed how <a href="http://www.automated-trading-system.com/practical-guide-to-etf-trading-systems-garner/">roll yield can negatively affect the overall return of a commodity holding</a> The impact of <a href="http://en.wikipedia.org/wiki/Contango" target="_blank" rel="nofollow">contango</a> or <a href="http://en.wikipedia.org/wiki/Normal_backwardation" target="_blank" rel="nofollow">backwardation</a> can be relatively large compared to the overall return.</p>
<p>Petroleum has unfortunately been in the news lately. Nevertheless, Crude Oil performance last year gave us a good illustration of the impact that contango/backwardation can have.</p>
<h3>Crude Oil &#8211; 2009</h3>
<p>Crude Oil&#8217;s had a fantastic year in 2009. The spot price bottomed around 35 and topped 80 to finish on a near +100% performance</p>
<p>Many would assume that quick and easy way to double their money was to invest in Crude Oil in 2009 (assuming you could time the top and bottom perfectly). This is without counting the strong effect of contango that would have eaten into the return.</p>
<p>This can be illustrated by the fact that the USO ETF &#8211; supposed to <em>reflect</em> the performance, less expenses, of the spot price of West Texas Intermediate (WTI) light, sweet crude oil &#8211; did not manage to emulate the levels of performance seen in the Crude Oil spot price in 2009:<span id="more-2385"></span></p>
<div id="attachment_2387" class="wp-caption alignnone" style="width: 508px"><img src="http://www.automated-trading-system.com/wp-content/uploads/2010/06/USO.png" alt="A &quot;mere&quot; +34% performance over 2009 pales in comparison with spot price performance" title="USO" width="498" height="217" class="size-full wp-image-2387" /><p class="wp-caption-text">A mere +34% performance over 2009 pales in comparison with spot price performance</p></div>
<p>This is, of course, because the ETF managers invest in Crude Oil futures and are subject to the same contango, which eats into their returns.</p>
<p>Below is a chart of several prices for Crude Oil in 2009:</p>
<img src="http://www.automated-trading-system.com/wp-content/uploads/2010/06/CL-2009.png" alt="my caption" title="CL-2009" width="440" height="289" class="size-full wp-image-2388" />
<ul>
<li>The spot price is the headline price.</li>
<li>The rolled contract price represents a back-adjusted contract, trading in the front-month contract and rolling over to the next contract before expiry.</li>
<li>Two other single contracts, with different maturities are also plotted.</li>
</ul>
<p>All prices are rebased to start 2009 at the same level as the spot price.</p>
<p>Whereas you cannot trade the spot price, you can trade using the 3 other contracts. Note how they all underperform the spot price performance: this is contango in action.</p>
<p>Most people call this a negative roll yield (long positions in a market in contango or short positions in a market in backwardation) because the drift is more apparent at time of rolling over to the new contract (which is priced dearer than the current contract), however the decay induced by the contango is gradual and erodes the price regularly &#8211; as can be seen in the further-dated contracts (the premium priced in the future-dated contract deflates gradually to zero at time of expiry).</p>
<p>The commodity <em>yield curve</em> is clearly an incidental impact on an overall trading strategy results, but it can also be used to form the basis of the strategy itself</p>
<h3>Term Structure Trading Strategy</h3>
<p>One such example of a strategy using term structure (aka. yield curve) as a trading signal is described in the paper<br />
<a href="http://papers.ssrn.com/sol3/papers.cfm?abstract_id=1127213" target="_blank">Tactical Allocation in Commodity Futures Markets: Combining Momentum and Term Structure Signals</a>.</p>
<blockquote><p><strong>ABSTRACT</strong>: This paper examines the combined role of momentum and term structure signals for the design of profitable trading strategies in commodity futures markets. With significant annualized alphas of 10.14% and 12.66% respectively, the momentum and term structure strategies appear profitable when implemented individually. With an abnormal return of 21.02%, a novel double-sort strategy that exploits both momentum and term structure signals clearly outperforms the single-sort strategies.</p></blockquote>
<p>The authors calculate the <em>roll return</em> for various instruments and select the most backwardated and contangoed markets. Only backwardated markets are allowed to be long and contangoed markets to be short. The increase in performance compared to a standard momentum strategy appears interesting.</p>
<h3>Term Structure as a Strategy Filter</h3>
<p>Another idea to explore is using term structure as a filter to a Trend Following strategy. Similarly to the concept explained above, one could prevent going short strongly backwardated contracts or long strongly contangoed contracts &#8211; basically avoid the markets where the odds are stacked against them.</p>
<p>I have not come across any such published test but found this paper:</p>
<p><a href="http://papers.ssrn.com/sol3/papers.cfm?abstract_id=892387" target="_blank" rel="nofollow">Separating the Wheat from the Chaff: Backwardation as the Long-Term Driver of Commodity Futures Performance; Evidence from Soy, Corn and Wheat Futures from 1950 to 2004</a></p>
<p>It gives interesting fundamental insights as to why markets might be in contango or backwardation and studies the impact or prediction power of the roll yield on a passive long investment strategy. One of their conclusions is that yield return rates start having predictive power when considered on a long-term basis (multi-year) as opposed to monthly measurements.</p>
<img src="http://www.automated-trading-system.com/?ak_action=api_record_view&id=2385&type=feed" alt="" />

<p>Related posts:<ol><li><a href='http://www.automated-trading-system.com/roll-yield-commodity-yield-curve/' rel='bookmark' title='Permanent Link: Roll Yield and Commodity Yield Curve'>Roll Yield and Commodity Yield Curve</a></li>
<li><a href='http://www.automated-trading-system.com/trend-following-returns-breakdown/' rel='bookmark' title='Permanent Link: Trend Following returns breakdown'>Trend Following returns breakdown</a></li>
<li><a href='http://www.automated-trading-system.com/better-trend-following-improved-roll-yield/' rel='bookmark' title='Permanent Link: Better Trend Following via improved Roll Yield'>Better Trend Following via improved Roll Yield</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://www.automated-trading-system.com/crude-oil-contango-and-roll-yield-for-commodity-trading/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 to [...]


Related posts:<ol><li><a href='http://www.automated-trading-system.com/trading-blox-teaser-review/' rel='bookmark' title='Permanent Link: Thinking of buying Trading Blox?'>Thinking of buying Trading Blox?</a></li>
<li><a href='http://www.automated-trading-system.com/walk-forward-trading-blox/' rel='bookmark' title='Permanent Link: Walk-Forward in Trading Blox: Back-Testing Adaptive Trading'>Walk-Forward in Trading Blox: Back-Testing Adaptive Trading</a></li>
<li><a href='http://www.automated-trading-system.com/free-code-improved-vortex/' rel='bookmark' title='Permanent Link: New: Free Code section &#8211; and improved Vortex'>New: Free Code section &#8211; and improved Vortex</a></li>
</ol>]]></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: #000080;">IF</span> ( mmdiIndicator &gt; 0 ) <span style="color: #000080;">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>
<img src="http://www.automated-trading-system.com/?ak_action=api_record_view&id=1447&type=feed" alt="" />

<p>Related posts:<ol><li><a href='http://www.automated-trading-system.com/trading-blox-teaser-review/' rel='bookmark' title='Permanent Link: Thinking of buying Trading Blox?'>Thinking of buying Trading Blox?</a></li>
<li><a href='http://www.automated-trading-system.com/walk-forward-trading-blox/' rel='bookmark' title='Permanent Link: Walk-Forward in Trading Blox: Back-Testing Adaptive Trading'>Walk-Forward in Trading Blox: Back-Testing Adaptive Trading</a></li>
<li><a href='http://www.automated-trading-system.com/free-code-improved-vortex/' rel='bookmark' title='Permanent Link: New: Free Code section &#8211; and improved Vortex'>New: Free Code section &#8211; and improved Vortex</a></li>
</ol></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>Mammoth Hedge Fund moves into Trend Following</title>
		<link>http://www.automated-trading-system.com/aqr-trend-following/</link>
		<comments>http://www.automated-trading-system.com/aqr-trend-following/#comments</comments>
		<pubDate>Thu, 28 Jan 2010 13:06:44 +0000</pubDate>
		<dc:creator>Jez Liberty</dc:creator>
				<category><![CDATA[Futures]]></category>
		<category><![CDATA[Trend Following]]></category>
		<category><![CDATA[AQR]]></category>
		<category><![CDATA[research paper]]></category>

		<guid isPermaLink="false">http://www.automated-trading-system.com/?p=1389</guid>
		<description><![CDATA[AQR is a top hedge fund, managing around $24B in Assets. Lately, they have been making noise about their moving into the Managed Futures space (a.k.a. Trend Following). They seem to be working at institutional investor&#8217;s acceptance of trend following as an &#8220;investment&#8221; concept. They might just be trying to catch up with another mammoth [...]


Related posts:<ol><li><a href='http://www.automated-trading-system.com/price-distributions-trend-following/' rel='bookmark' title='Permanent Link: Price Distributions and Trend Following'>Price Distributions and Trend Following</a></li>
<li><a href='http://www.automated-trading-system.com/better-trend-following-improved-roll-yield/' rel='bookmark' title='Permanent Link: Better Trend Following via improved Roll Yield'>Better Trend Following via improved Roll Yield</a></li>
<li><a href='http://www.automated-trading-system.com/weekend-reading/' rel='bookmark' title='Permanent Link: Weekend reading'>Weekend reading</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<p>AQR is a top hedge fund, managing around $24B in Assets. Lately, they have been making noise about their moving into the <em>Managed Futures</em> space (a.k.a. Trend Following). They seem to be working at institutional investor&#8217;s acceptance of trend following as an &#8220;investment&#8221; concept. They might just be trying to catch up with another mammoth hedge fund: MAN who have been strong in this space since taking AHL over.<br />
<img src="http://www.automated-trading-system.com/wp-content/uploads/2010/01/aqr1.png" alt="aqr" title="aqr" width="491" height="83" class="aligncenter size-full wp-image-1413" /></p>
<p>A <a href="http://www.automated-trading-system.com/wp-content/uploads/2010/01/UnderstandingManagedFutures.pdf" target="_blank"><strong>research paper</strong></a> (summarised below) was recently published by AQR, explaining some concepts of trend following.  </p>
<p>Clifford Asness, AQR Managing &#038; Founding Principal, was also invited to speak about it with his good friends at CNBC (he is also an ex-Goldman, so he surely has lots of connections with the media and government). The video is not that interesting but here it is below, anyway. If you&#8217;re short of time (aren&#8217;t we all?), I recommend you skip to the paper (8 pages) or the summary, which yield more interesting insights.<span id="more-1389"></span></p>
<p><object id="cnbcplayer" height="380" width="400" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0" ><param name="type" value="application/x-shockwave-flash"/><param name="allowfullscreen" value="true"/><param name="allowscriptaccess" value="always"/><param name="quality" value="best"/><param name="scale" value="noscale" /><param name="wmode" value="transparent"/><param name="bgcolor" value="#000000"/><param name="salign" value="lt"/><param name="movie" value="http://plus.cnbc.com/rssvideosearch/action/player/id/1378386599/code/cnbcplayershare"/><embed name="cnbcplayer" PLUGINSPAGE="http://www.macromedia.com/go/getflashplayer" allowfullscreen="true" allowscriptaccess="always" bgcolor="#000000" height="380" width="400" quality="best" wmode="transparent" scale="noscale" salign="lt" src="http://plus.cnbc.com/rssvideosearch/action/player/id/1378386599/code/cnbcplayershare" type="application/x-shockwave-flash" /><br />
</object></p>
<h3>Summary of Paper: Understanding Managed Futures</h3>
<p><a href="http://www.automated-trading-system.com/wp-content/uploads/2010/01/UnderstandingManagedFutures.pdf" target="_blank"><img src="http://www.automated-trading-system.com/wp-content/uploads/2009/12/Uncovering-the-Trend-Following-Strategy.png" alt="Understanding Managed Futures" title="Understanding Managed Futures" width="66" height="66" class="alignnone size-full wp-image-1117" /></a><br />
<a href="http://www.automated-trading-system.com/wp-content/uploads/2010/01/UnderstandingManagedFutures.pdf" target="_blank">Click to download paper</a></p>
<p>- They start with a chart displaying the Managed Futures &#8220;smile&#8221;, basically a scatter plot of Trend Following strategy return vs. S&#038;P 500 total return &#8211; making the point that Trend following performs best in case of <em>extreme</em> stock market moves (one of the main points they want to drive home throughout the paper is that Trend Following is a great portfolio diversificator with low correlation to other assets). They further <em>empirically</em> demonstrate this by pointing out Trend Following&#8217;s performance in Q4 2008 (strongly positive) in contrast to the global crash.</p>
<p>- The paper uses a hypothetical Trend following strategy for comparison and analysis. This strategy trades 60 liquid futures markets divided in the four asset classes defined by AQR (equities, commodities, bonds and currencies). To determine the trend, the strategy considers the excess return over cash of each instrument for the prior 12 months (a positive return results in a long position and a negative return results in a short position). The portfolio is equal-risk-weighted (i.e. normalised for annualised volatility) across the instruments and rebalanced every month.</p>
<p>- The second part breaks down the three parts of a trend and some behavioral biases or technical explanations for them:</p>
<ul>
<li><strong>Start of the trend and under-reaction</strong>, due to anchor and insufficient adjustment to new conditions (i.e. news, supply shock, etc.), disposition effect (selling winners too early) and market particpants fighting trends (central banks or commodity hedgers)</li>
<li><strong>Trend continuation and over-reaction</strong>, due to herding and feedback trading as well as confirmation bias (similar to the reflexivity concept explained by George Soros in <a href="http://www.amazon.com/exec/obidos/ASIN/0471445495/autotradblog-20" target="_blank" rel="nofollow">The Alchemy of Finance</a>) and Risk Management practices (stop losses being triggered generate more losses, etc.)</li>
<li><strong>End of the trend</strong> where the market comes to the realisation that prices have gone too far</li>
</ul>
<p>- The analysis of the strategy looks at the performance of each market and compares it to the overall strategy performance &#8211; noting the effect of the <em>free-lunch</em> that is <strong>diversification</strong>: The Sharpe ratio of the overall strategy is 1.3, higher than any of the individual market Sharpe ratio (all between 0 and 1).</p>
<p>- Another observation is the <strong>low correlation</strong> between the individual markets (average pair-wise correlation of 0.08) as well as between the overall strategy and various asset classes (Equities, Bonds and Commodities).</p>
<p>- Finally, they compare a 60/40 portfolio performance (60% Equities, 40% Bonds) with a hybrid portfolio (80% 60/40 portfolio and 20% Managed Futures) and show that return, standard deviation, Sharpe ratio, worst month and worst drawdown are all improved under the second scenario. I believe this is how they intend to market their new trend following funds: as a portfolio diversificator improving its overall variance-adjusted return</p>
<p>- In conclusion they highlight some of the risks (range-bound periods, high turnover and trading costs as well as manager fees) and finally (it is a marketing paper after all!) some of the <em>value-add</em> that a fund like theirs can provide (advanced strategies using rigorous quantitative methods over different time horizons, sophisticated risk management systems, portfolio optimisation and smart order execution algorithms, etc.)</p>
<p>The trend following space is just getting a bit more crowded&#8230;</p>
<img src="http://www.automated-trading-system.com/?ak_action=api_record_view&id=1389&type=feed" alt="" />

<p>Related posts:<ol><li><a href='http://www.automated-trading-system.com/price-distributions-trend-following/' rel='bookmark' title='Permanent Link: Price Distributions and Trend Following'>Price Distributions and Trend Following</a></li>
<li><a href='http://www.automated-trading-system.com/better-trend-following-improved-roll-yield/' rel='bookmark' title='Permanent Link: Better Trend Following via improved Roll Yield'>Better Trend Following via improved Roll Yield</a></li>
<li><a href='http://www.automated-trading-system.com/weekend-reading/' rel='bookmark' title='Permanent Link: Weekend reading'>Weekend reading</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://www.automated-trading-system.com/aqr-trend-following/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>How to get out of a locked-limit situation</title>
		<link>http://www.automated-trading-system.com/get-out-locked-limit-situation/</link>
		<comments>http://www.automated-trading-system.com/get-out-locked-limit-situation/#comments</comments>
		<pubDate>Tue, 26 Jan 2010 11:19:12 +0000</pubDate>
		<dc:creator>Jez Liberty</dc:creator>
				<category><![CDATA[Futures]]></category>
		<category><![CDATA[lock-limit]]></category>
		<category><![CDATA[options]]></category>

		<guid isPermaLink="false">http://www.automated-trading-system.com/?p=1374</guid>
		<description><![CDATA[
Locked-limit panicked trader?
photo: artemuestra@flickr

Every prudent trader will ensure they minimise their risk by placing stop-loss orders where they should get out of the market. This is one of trading basic truths:
Cut your losses short.
However there is one case where the Futures market will not let you exit at any price: when the market is locked-limit.
&#160;
&#160;
Locked-Limit
Most [...]


Related posts:<ol><li><a href='http://www.automated-trading-system.com/slippage-take-3-stop-limit-orders/' rel='bookmark' title='Permanent Link: Slippage &#8211; Take 3: Stop-Limit Orders'>Slippage &#8211; Take 3: Stop-Limit Orders</a></li>
<li><a href='http://www.automated-trading-system.com/balsara-money-management-strategies-for-futures-traders/' rel='bookmark' title='Permanent Link: Balsara: Money Management Strategies for Futures Traders'>Balsara: Money Management Strategies for Futures Traders</a></li>
<li><a href='http://www.automated-trading-system.com/trick-reduce-drawdowns/' rel='bookmark' title='Permanent Link: A trick to reduce Drawdowns'>A trick to reduce Drawdowns</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<div id="attachment_1378" style="float:left; margin-right:16px; margin-top:4px; width: 251px;"><img src="http://www.automated-trading-system.com/wp-content/uploads/2010/01/panicked-trader.png" alt="Locked-limit panicked trader? photo: artemuestra@flickr" title="panicked-trader" class="size-full wp-image-1378" style="float: left; margin-right: 16px; margin-top: 4px;" width="241" height="313">
<p class="wp-caption-text">Locked-limit panicked trader?<br />
photo: artemuestra@flickr</p>
</div>
<p>Every prudent trader will ensure they minimise their risk by placing stop-loss orders where they should get out of the market. This is one of trading basic truths:</p>
<blockquote><p>Cut your losses short.</p></blockquote>
<p>However there is one case where the Futures market will not let you exit at any price: when the market is <em>locked-limit.</em><span id="more-1374"></span><br />
&nbsp;<br />
&nbsp;</p>
<h3>Locked-Limit</h3>
<p>Most Futures market have a defined daily limit for price moves, at which point trading is suspended. The market is said to be <em>locked-limit</em> (either up or down). As a trader, the move might go against a position you have in the market and possibly right through your stop-loss &#8211; without any way for you to exit your position. </p>
<p>Your main concern should be to try and contain the loss as best as possible (markets can go <em>limit-up</em> or <em>limit-down</em> for a few days in a row &#8211; and possibly decimate your account in the process!)</p>
<h3>Surviving Locked-limit markets</h3>
<p>One option is to offset the Futures transaction in the Cash market. However for most traders, it is not practical or possible to deal with the Physical Commodity&#8230;</p>
<p><strong>Synthetic Futures contracts to the rescue:</strong><br />
A &#8220;lighter&#8221; way to implement an offsetting the Futures position is to trade an equal and opposite position by creating a <em>synthetic Futures contract</em> using options.</p>
<p>To hedge a short futures position a synthetic long futures can be employed: this options strategy simulates the payoff of a long futures position (unlimited profit, unlimited risk) by combining the buying of at-the-money call options (limited risk, unlimited profit) and the selling of an equal number of at-the-money put options  (unlimited risk, limited profit) of the same underlying futures and expiration month.</p>
<p>To hedge a long futures position, the reverse can be employed (synthetic short futures by selling call options and buying put options).</p>
<p>These are solutions for extreme cases&#8230; where it pays to be prepared with a plan in mind.</p>
<img src="http://www.automated-trading-system.com/?ak_action=api_record_view&id=1374&type=feed" alt="" />

<p>Related posts:<ol><li><a href='http://www.automated-trading-system.com/slippage-take-3-stop-limit-orders/' rel='bookmark' title='Permanent Link: Slippage &#8211; Take 3: Stop-Limit Orders'>Slippage &#8211; Take 3: Stop-Limit Orders</a></li>
<li><a href='http://www.automated-trading-system.com/balsara-money-management-strategies-for-futures-traders/' rel='bookmark' title='Permanent Link: Balsara: Money Management Strategies for Futures Traders'>Balsara: Money Management Strategies for Futures Traders</a></li>
<li><a href='http://www.automated-trading-system.com/trick-reduce-drawdowns/' rel='bookmark' title='Permanent Link: A trick to reduce Drawdowns'>A trick to reduce Drawdowns</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://www.automated-trading-system.com/get-out-locked-limit-situation/feed/</wfw:commentRss>
		<slash:comments>0</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 and [...]


Related posts:<ol><li><a href='http://www.automated-trading-system.com/robustness-definitions/' rel='bookmark' title='Permanent Link: Robustness? What robustness?'>Robustness? What robustness?</a></li>
<li><a href='http://www.automated-trading-system.com/state-of-trend-following-draft-201003/' rel='bookmark' title='Permanent Link: The State of Trend Following report &#8211; Draft V0.1'>The State of Trend Following report &#8211; Draft V0.1</a></li>
<li><a href='http://www.automated-trading-system.com/mmdi-portfolio-filter-trading-blox/' rel='bookmark' title='Permanent Link: MMDI Portfolio Filter in Trading Blox'>MMDI Portfolio Filter in Trading Blox</a></li>
</ol>]]></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&#8217;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>
<img src="http://www.automated-trading-system.com/?ak_action=api_record_view&id=1237&type=feed" alt="" />

<p>Related posts:<ol><li><a href='http://www.automated-trading-system.com/robustness-definitions/' rel='bookmark' title='Permanent Link: Robustness? What robustness?'>Robustness? What robustness?</a></li>
<li><a href='http://www.automated-trading-system.com/state-of-trend-following-draft-201003/' rel='bookmark' title='Permanent Link: The State of Trend Following report &#8211; Draft V0.1'>The State of Trend Following report &#8211; Draft V0.1</a></li>
<li><a href='http://www.automated-trading-system.com/mmdi-portfolio-filter-trading-blox/' rel='bookmark' title='Permanent Link: MMDI Portfolio Filter in Trading Blox'>MMDI Portfolio Filter in Trading Blox</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://www.automated-trading-system.com/moving-median-better-indicator-than-moving-average/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>Anatomy of a Futures transaction</title>
		<link>http://www.automated-trading-system.com/anatomy-futures-transaction/</link>
		<comments>http://www.automated-trading-system.com/anatomy-futures-transaction/#comments</comments>
		<pubDate>Thu, 19 Nov 2009 13:12:27 +0000</pubDate>
		<dc:creator>Jez Liberty</dc:creator>
				<category><![CDATA[Futures]]></category>
		<category><![CDATA[Software]]></category>
		<category><![CDATA[broker]]></category>
		<category><![CDATA[ccp]]></category>
		<category><![CDATA[clearing]]></category>
		<category><![CDATA[counterparty]]></category>
		<category><![CDATA[exchange]]></category>
		<category><![CDATA[FCM]]></category>
		<category><![CDATA[introducing broker]]></category>

		<guid isPermaLink="false">http://www.automated-trading-system.com/?p=735</guid>
		<description><![CDATA[When looking around for automated trading platforms, you soon realise that the offerings are numerous and all seem to take a different form or approach (i.e. TradeStation vs. Interactive Brokers vs. NinjaTrader vs. Zen-Fire vs. eSignal vs. TradersStudio, etc. &#8211; the list is very long!).
To understand what they all offer, it is important to first [...]


Related posts:<ol><li><a href='http://www.automated-trading-system.com/backtesting-trading-platform/' rel='bookmark' title='Permanent Link: How to decide on a Backtesting and Trading Platform'>How to decide on a Backtesting and Trading Platform</a></li>
<li><a href='http://www.automated-trading-system.com/futures-contract-naming-convention/' rel='bookmark' title='Permanent Link: Futures Contract naming convention'>Futures Contract naming convention</a></li>
<li><a href='http://www.automated-trading-system.com/unfair-advantage-api-code-c-extract-futures-continuous-data/' rel='bookmark' title='Permanent Link: Unfair Advantage API Code (C#): Extract Futures Continuous data'>Unfair Advantage API Code (C#): Extract Futures Continuous data</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<p>When looking around for automated trading platforms, you soon realise that the offerings are numerous and all seem to take a different form or approach (i.e. <em>TradeStation vs. Interactive Brokers vs. NinjaTrader vs. Zen-Fire vs. eSignal vs. TradersStudio</em>, etc. &#8211; the list is very long!).<br />
To understand what they all offer, it is important to first situate <strong>all the actors on the chain of transactions</strong> that a trade generates.</p>
<p>Here is a &#8220;gradual&#8221; description of how a Futures trade takes place with all intermediaries involved:</p>
<h3>A BUYER AND A SELLER</h3>
<p>In its most basic form a transaction involves 2 parties: <strong>a buyer and a seller</strong>.<br />
<div id="attachment_740" class="wp-caption aligncenter" style="width: 349px"><img src="http://www.automated-trading-system.com/wp-content/uploads/2009/10/anatomy5.png" alt="A buyer transacts directly with a seller" title="anatomy5" width="339" height="193" class="size-full wp-image-740" /><p class="wp-caption-text">A buyer transacts directly with a seller</p></div></p>
<h3>THE EXCHANGE: A CENTRAL &#8220;MEETING&#8221; PLACE</h3>
<p><span id="more-735"></span><br />
However buyers need to find sellers and vice-versa. This is where <strong>exchanges</strong> come into play. They are a central place where trading takes place.</p>
<p>For example, the <em>Chicago Board of Trade</em> (CBOT) is the central place where wheat trading takes place. All sellers and buyers meet and agree on transaction prices there. Exchanges also enforce rules such as <strong>standardised terms</strong> (e.g. wheat futures contract provides for delivery of 5,000 bushels of any of several varieties of wheat during March, May, July, September, or December).<br />
<div id="attachment_741" class="wp-caption aligncenter" style="width: 510px"><img src="http://www.automated-trading-system.com/wp-content/uploads/2009/10/anatomy4.png" alt="All buyers and sellers come to the exchange to transact" title="anatomy4" width="500" height="236" class="size-full wp-image-741" /><p class="wp-caption-text">All buyers and sellers come to the exchange to transact</p></div></p>
<h3>COUNTERPARTY RISK</h3>
<p>Futures contracts are an agreement between two parties for future delivery of an underlying (e.g. wheat) in exchange for a Cash amount (settlement) dictated by the agreed price. Up until settlement, there is risk that one of the parties will not be able to fulfil its obligation and result in a financial loss to the other party. This is called <em>Counterparty Risk</em>.</p>
<p>To avoid this situation, an intermediary, part of the exchange, will <strong>guarantee the trade</strong>. This is the <strong>Central CounterParty</strong>. All trades are actually given up to the Central CounterParty &#8211; which means that technically you buy from the CCP and your counterparty (the other side of the trade) sells to the CCP.</p>
<p>The CCP enforces each party to maintain adequate levels of <strong>initial and variation margin</strong> to cover any potential losses. All of the CCP trades are cleared through its <strong>clearing house</strong>.<br />
<div id="attachment_744" class="wp-caption aligncenter" style="width: 510px"><img src="http://www.automated-trading-system.com/wp-content/uploads/2009/10/anatomy3.png" alt="The exchange provides a Central CounterParty and Clearing House to act as a guarantee between buyer and seller." title="anatomy3" width="500" height="234" class="size-full wp-image-744" /><p class="wp-caption-text">The exchange provides a Central CounterParty and Clearing House to act as a guarantee between buyer and seller.</p></div></p>
<h3>BROKER INTERMEDIATION</h3>
<p>Now, there are millions of buyers and sellers that want to trade on the exchange. The exchange is not going to deal with all buyers and sellers. Instead, an exchange is a B2B-only platform where <strong>broker-dealer</strong> firms place their trades between each other. </p>
<p>For a buyer to trade, she needs to go through a broker to place her order/trade on the exchange. However broker-dealers (also called <em>Futures Commission Merchant</em> &#8211; FCM) are large independent firms, or part of large investment/commercial banks. As such they will not deal with most clients (retail and small institutional). Those clients would go through <strong>Introducing Brokers</strong> (IB), which will act as an extra intermediary between the client (you) and the exchange in a B2C fashion &#8211; delegating the trade execution, back-office operations, etc. to the FCM.</p>
<p>There is a further distinction between FCM:</p>
<ul>
<li><strong>Clearing FCM</strong>, which is a clearing member of an exchange</li>
<li><strong>Non-clearing FCM</strong>, which must clear its trade through a clearing FCM</li>
</ul>
<div id="attachment_745" class="wp-caption aligncenter" style="width: 510px"><img src="http://www.automated-trading-system.com/wp-content/uploads/2009/10/anatomy2.png" alt="The picture gets fuller with broker intermediaries: Introducing Brokers, clearing and non-clearing FCM." title="anatomy2" width="500" height="228" class="size-full wp-image-745" /><p class="wp-caption-text">The picture gets fuller with broker intermediaries: Introducing Brokers, clearing and non-clearing FCM.</p></div>
<h3>HOW TRADING TAKES PLACE AT THE EXCHANGE</h3>
<p>In the old days, most trading took place in <strong>open outcry</strong>, on the trading floor of the exchange, between the local representatives of the broker-dealer firms (traders, brokers, market-makers/specialists). Floor traders stand in a trading pit to call out orders, prices, and quantities of a particular commodity by making &#8220;crazy hand gestures&#8221; (think of the last scene of <a href="http://www.amazon.com/exec/obidos/ASIN/B000O59A16/autotradblog-20" target="_blank" rel="nofollow">Trading Places</a>). Note that open outcry is pre-dated by <strong>blackboard trading</strong>.</p>
<p><strong>Electronic trading</strong> has emerged in the last decades and gradually replaced open outcry. The electronic platform of an exchange (e.g. <em>e-cbot</em> for CBOT) is essentially a matching engine which all broker-dealers connect to and submit their orders.<br />
<div id="attachment_746" class="wp-caption aligncenter" style="width: 510px"><img src="http://www.automated-trading-system.com/wp-content/uploads/2009/10/anatomy1.png" alt="The full picture." title="anatomy1" width="500" height="235" class="size-full wp-image-746" /><p class="wp-caption-text">The full picture.</p></div></p>
<p>With the advent of electronic trading a new class of brokers has appeared: <strong>Direct Access Trading</strong> (DAT) brokers. They offer their clients (including retail) an electronic platform that allows for a direct access to the exchange (as opposed to more traditional online retail brokers, which are just an electronic IB). DAT brokers usually offer to retail investors low transaction costs and high execution speed.</p>
<p>I hope I have not forgotten anything. If so, please let me know in the comments. In a next post I will investigate how the various automated trading platforms fit into that model.</p>
<img src="http://www.automated-trading-system.com/?ak_action=api_record_view&id=735&type=feed" alt="" />

<p>Related posts:<ol><li><a href='http://www.automated-trading-system.com/backtesting-trading-platform/' rel='bookmark' title='Permanent Link: How to decide on a Backtesting and Trading Platform'>How to decide on a Backtesting and Trading Platform</a></li>
<li><a href='http://www.automated-trading-system.com/futures-contract-naming-convention/' rel='bookmark' title='Permanent Link: Futures Contract naming convention'>Futures Contract naming convention</a></li>
<li><a href='http://www.automated-trading-system.com/unfair-advantage-api-code-c-extract-futures-continuous-data/' rel='bookmark' title='Permanent Link: Unfair Advantage API Code (C#): Extract Futures Continuous data'>Unfair Advantage API Code (C#): Extract Futures Continuous data</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://www.automated-trading-system.com/anatomy-futures-transaction/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Unfair Advantage API Code (C#): Extract Futures Continuous data</title>
		<link>http://www.automated-trading-system.com/unfair-advantage-api-code-c-extract-futures-continuous-data/</link>
		<comments>http://www.automated-trading-system.com/unfair-advantage-api-code-c-extract-futures-continuous-data/#comments</comments>
		<pubDate>Sun, 04 Oct 2009 15:37:09 +0000</pubDate>
		<dc:creator>Jez Liberty</dc:creator>
				<category><![CDATA[Backtest]]></category>
		<category><![CDATA[Code]]></category>
		<category><![CDATA[Data]]></category>
		<category><![CDATA[Futures]]></category>
		<category><![CDATA[Software]]></category>
		<category><![CDATA[API]]></category>
		<category><![CDATA[C#]]></category>
		<category><![CDATA[CSI]]></category>
		<category><![CDATA[rollover]]></category>
		<category><![CDATA[screenshots]]></category>
		<category><![CDATA[Unfair Advantage]]></category>

		<guid isPermaLink="false">http://www.automated-trading-system.com/?p=279</guid>
		<description><![CDATA[As mentioned in the previous post on retrieving Back-Adjusted Contracts using the RetrieveBackAdjustedContract2 function of the Unfair Advantage API, I have coded up this very simple project to read a list of Futures underlying instruments, retrieve a proportionally back-adjusted contract for each of the instruments and oputput it to a file.
Getting started with the API
Fire [...]


Related posts:<ol><li><a href='http://www.automated-trading-system.com/unfair-advantage-csi/' rel='bookmark' title='Permanent Link: I just got myself an Unfair Advantage&#8230;'>I just got myself an Unfair Advantage&#8230;</a></li>
<li><a href='http://www.automated-trading-system.com/continuous-contract-options/' rel='bookmark' title='Permanent Link: Continuous Contract options'>Continuous Contract options</a></li>
<li><a href='http://www.automated-trading-system.com/unfair-advantage-api-retrieve-back-adjusted-contracts-function/' rel='bookmark' title='Permanent Link: Unfair Advantage API: Retrieve Back-Adjusted Contracts function'>Unfair Advantage API: Retrieve Back-Adjusted Contracts function</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<p>As mentioned in the previous post on <a href="http://www.automated-trading-system.com/unfair-advantage-api-retrieve-back-adjusted-contracts-function/" target="_blank">retrieving Back-Adjusted Contracts using the RetrieveBackAdjustedContract2 function of the Unfair Advantage API</a>, I have coded up this very simple project to read a list of Futures underlying instruments, retrieve a proportionally back-adjusted contract for each of the instruments and oputput it to a file.</p>
<h3>Getting started with the API</h3>
<p>Fire up your favourite IDE/language that supports COM Interoperability (I am using Visual C# 2008 Express Edition), start Console Application project and add a reference to the Unfair Advantage API. For this you just need to &#8220;Add reference&#8221; and browse to the Unfair Advantage installation folder and select the main EXE (uad.exe). This gives access to the CSI UA API.</p>
<div id="attachment_288" class="wp-caption aligncenter" style="width: 606px"><img src="http://www.automated-trading-system.com/wp-content/uploads/2009/09/UA-C-reference1.jpg" alt="Add UA into your project and &quot;Bob&#039;s your Uncle!&quot;" title="UA-C#-reference" width="500" height="457" class="size-full wp-image-288" /><p class="wp-caption-text">Add UA into your project and &quot;Bob's your Uncle!&quot;</p></div>
<h3>Simple extraction code</h3>
<p>The rest is fairly simple as long as you<span id="more-279"></span> <a href="http://www.automated-trading-system.com/unfair-advantage-api-retrieve-back-adjusted-contracts-function/" target="_blank">understand the RetrieveBackAdjustedContract2 parameters</a>.<br />
The code below takes 2 parameters: an input file name containing the list of markets to extract and a folder name to extract each continuous contract to. It sets specific UA session parameters and calls the RetrieveBackAdjustedContract2 with specific variables to obtain the concatenation desired. Each continuous contract is output to a folder in a .txt file.<br />
The file containing the list of markets is of the following format (CSI number, Symbol, Market name):<br />
&#8230;<br />
8,CT,Cotton<br />
&#8230;</p>
<h3>The code</h3>
<p>Please find the code <a href="http://www.automated-trading-system.com/pages/csharp-uaapi-continuouscontract.html" target="_blank">there</a> (very nicely formatted thanks to <a href="http://www.manoli.net/csharpformat/" target="_blank" rel="nofollow">this great tool by manoli</a>). You can also download the Program.cs file:<br />
<a href='http://www.automated-trading-system.com/wp-content/uploads/2009/09/Program.cs'><img src="http://www.automated-trading-system.com/wp-content/uploads/2009/09/Program.cs.jpg" alt="Program.cs" title="Program.cs" width="162" height="58" class="aligncenter size-full wp-image-287" /></a></p>
<img src="http://www.automated-trading-system.com/?ak_action=api_record_view&id=279&type=feed" alt="" />

<p>Related posts:<ol><li><a href='http://www.automated-trading-system.com/unfair-advantage-csi/' rel='bookmark' title='Permanent Link: I just got myself an Unfair Advantage&#8230;'>I just got myself an Unfair Advantage&#8230;</a></li>
<li><a href='http://www.automated-trading-system.com/continuous-contract-options/' rel='bookmark' title='Permanent Link: Continuous Contract options'>Continuous Contract options</a></li>
<li><a href='http://www.automated-trading-system.com/unfair-advantage-api-retrieve-back-adjusted-contracts-function/' rel='bookmark' title='Permanent Link: Unfair Advantage API: Retrieve Back-Adjusted Contracts function'>Unfair Advantage API: Retrieve Back-Adjusted Contracts function</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://www.automated-trading-system.com/unfair-advantage-api-code-c-extract-futures-continuous-data/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
