<?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; screenshots</title>
	<atom:link href="http://www.automated-trading-system.com/tag/screenshots/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.automated-trading-system.com</link>
	<description>Systematic Trading research and development, with a flavour of Trend Following</description>
	<lastBuildDate>Tue, 07 Feb 2012 09:58:33 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>MMDI Portfolio Filter in Trading Blox</title>
		<link>http://www.automated-trading-system.com/mmdi-portfolio-filter-trading-blox/</link>
		<comments>http://www.automated-trading-system.com/mmdi-portfolio-filter-trading-blox/#comments</comments>
		<pubDate>Tue, 02 Feb 2010 12:21:08 +0000</pubDate>
		<dc:creator>Jez Liberty</dc:creator>
				<category><![CDATA[Backtest]]></category>
		<category><![CDATA[Futures]]></category>
		<category><![CDATA[Software]]></category>
		<category><![CDATA[Strategies]]></category>
		<category><![CDATA[robust]]></category>
		<category><![CDATA[screenshots]]></category>
		<category><![CDATA[Trading Blox]]></category>
		<category><![CDATA[Trend Following]]></category>

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

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

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

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

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

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

		<guid isPermaLink="false">http://www.automated-trading-system.com/?p=1225</guid>
		<description><![CDATA[Dear readers, I hope you enjoyed the holiday break. I wish you a happy New Year &#8211; may it bring you progress and success in your automated trading endeavours! I wanted to start this year with an idea I left off last year, when investigating robustness: Using the median as a more robust tool than [...]]]></description>
			<content:encoded><![CDATA[<p>Dear readers, I hope you enjoyed the holiday break. I wish you a happy New Year &#8211; may it bring you progress and success in your automated trading endeavours!</p>
<p>I wanted to start this year with an idea I left off last year, when <a href="http://www.automated-trading-system.com/robustness-definitions/">investigating robustness</a>: <em>Using the median as a more robust tool than the ubiquitous mean (or average).</em> This will be covered in the next post via a TradersStudio simulation results. To do that, I had to re-import some data from <em>CSI Unfair Advantage</em> to <em>TradersStudio</em>. I thought a &#8220;how-to&#8221; post on this would be useful &#8211; if only as an aide-memoire for next time (note-taking and documentation are important after all&#8230;)</p>
<h3>Extract CSI Data</h3>
<p>The first step is to extract the data from the CSI database into text files<span id="more-1225"></span><br />
(by the way, CSI have a 20% discount running until the end of January &#8211; just check their <a href="http://www.csidata.com/" target="_blank" rel="nofollow">homepage</a>).<br />
This can be done with <a href="http://www.automated-trading-system.com/unfair-advantage-api-code-c-extract-futures-continuous-data/">code using the Unfair Advantage API</a>.</p>
<p>Pick all the instruments to be extracted and create a &#8220;contracts.param&#8221; file containing the CSI number for those instruments in the first column (comma-separated file with other columns being ignored). The CSI numbers can be found on their website (like <a href="http://www.csidata.com/cgi-bin/newspaperwrap.pl?file=/csiweb/ua/FactsheetHtml/CME.htm&#038;fmt=nomenu&#038;title=CME%20-%20Chicago%20Mercantile%20Exchange" rel="nofollow" target="_blank">here for the CME Futures</a>) or in their Unfair Advantage software UI. Running the EXE code will generate one file for each instrument (proportionally back-adjusted contract) in the following format:</p>

<div class="wp_syntax"><div class="code"><pre class="objc" style="font-family:monospace;"><span style="color: #2400d9;">19900403</span>,<span style="color: #2400d9;">199006</span>,<span style="color: #2400d9;">0</span>,<span style="color: #2400d9;">240</span>,<span style="color: #2400d9;">110</span>,<span style="color: #2400d9;">918</span>,<span style="color: #2400d9;">503</span>,<span style="color: #2400d9;">2</span>,<span style="color: #2400d9;">0</span>,<span style="color: #2400d9;">1.59</span>,<span style="color: #2400d9;">1.655</span>,<span style="color: #2400d9;">1.58</span>,<span style="color: #2400d9;">1.635</span>,<span style="color: #2400d9;">1.635</span>,<span style="color: #2400d9;">1.635</span>,<span style="color: #2400d9;">1.635</span>
<span style="color: #2400d9;">19900404</span>,<span style="color: #2400d9;">199006</span>,<span style="color: #2400d9;">0</span>,<span style="color: #2400d9;">84</span>,<span style="color: #2400d9;">127</span>,<span style="color: #2400d9;">656</span>,<span style="color: #2400d9;">721</span>,<span style="color: #2400d9;">3</span>,<span style="color: #2400d9;">0</span>,<span style="color: #2400d9;">1.6</span>,<span style="color: #2400d9;">1.65</span>,<span style="color: #2400d9;">1.599</span>,<span style="color: #2400d9;">1.62</span>,<span style="color: #2400d9;">1.62</span>,<span style="color: #2400d9;">1.62</span>,<span style="color: #2400d9;">1.62</span>
<span style="color: #2400d9;">19900405</span>,<span style="color: #2400d9;">199006</span>,<span style="color: #2400d9;">0</span>,<span style="color: #2400d9;">57</span>,<span style="color: #2400d9;">112</span>,<span style="color: #2400d9;">554</span>,<span style="color: #2400d9;">885</span>,<span style="color: #2400d9;">4</span>,<span style="color: #2400d9;">0</span>,<span style="color: #2400d9;">1.615</span>,<span style="color: #2400d9;">1.635</span>,<span style="color: #2400d9;">1.61</span>,<span style="color: #2400d9;">1.615</span>,<span style="color: #2400d9;">1.615</span>,<span style="color: #2400d9;">1.615</span>,<span style="color: #2400d9;">1.615</span>
<span style="color: #2400d9;">19900406</span>,<span style="color: #2400d9;">199006</span>,<span style="color: #2400d9;">0</span>,<span style="color: #2400d9;">62</span>,<span style="color: #2400d9;">136</span>,<span style="color: #2400d9;">436</span>,<span style="color: #2400d9;">1092</span>,<span style="color: #2400d9;">5</span>,<span style="color: #2400d9;">0</span>,<span style="color: #2400d9;">1.615</span>,<span style="color: #2400d9;">1.635</span>,<span style="color: #2400d9;">1.61</span>,<span style="color: #2400d9;">1.625</span>,<span style="color: #2400d9;">1.625</span>,<span style="color: #2400d9;">1.625</span>,<span style="color: #2400d9;">1.625</span></pre></div></div>

<h3>Load in TradersStudio</h3>
<p>The second step is to load the files in TradersStudio. Copy all generated text files in a dedicated data directory (you might have to rename them as TradersStudio allowed filename length is fairly short, i.e. 10-15 characters).<br />
Create the relevant mapping file (<a href='http://www.automated-trading-system.com/wp-content/uploads/2010/01/txtinfo.txt' target="_blank">txtinfo.txt</a>) in the data directory. The mapping file should read:</p>

<div class="wp_syntax"><div class="code"><pre class="objc" style="font-family:monospace;">delimit<span style="color: #002200;">=</span>,
skip<span style="color: #002200;">=</span><span style="color: #2400d9;">0</span>
dt<span style="color: #002200;">=</span><span style="color: #2400d9;">1</span>
ti<span style="color: #002200;">=</span><span style="color: #2400d9;">0</span>
op<span style="color: #002200;">=</span><span style="color: #2400d9;">10</span>
hi<span style="color: #002200;">=</span><span style="color: #2400d9;">11</span>
lo<span style="color: #002200;">=</span><span style="color: #2400d9;">12</span>
cl<span style="color: #002200;">=</span><span style="color: #2400d9;">13</span>
vol<span style="color: #002200;">=</span><span style="color: #2400d9;">6</span>
oi<span style="color: #002200;">=</span><span style="color: #2400d9;">7</span>
dtformat<span style="color: #002200;">=</span>CCYYMMDD
tiformat<span style="color: #002200;">=</span></pre></div></div>

<p>In TradersStudio, menu Data Manager/Add Data Links, point to the relevant data directory with the following options:</p>
<p><a href="http://www.automated-trading-system.com/wp-content/uploads/2010/01/DataManager.png" target="_blank"><img src="http://www.automated-trading-system.com/wp-content/uploads/2010/01/DataManager-300x259.png" alt="DataManager" title="DataManager" width="300" height="259" class="alignnone size-medium wp-image-1226" /></a></p>
<p><a href="http://www.automated-trading-system.com/wp-content/uploads/2010/01/InstrumentType.png" target="_blank"><img src="http://www.automated-trading-system.com/wp-content/uploads/2010/01/InstrumentType-300x195.png" alt="InstrumentType" title="InstrumentType" width="300" height="195" class="alignnone size-medium wp-image-1228" /></a></p>
<p>If all goes well, this will load the data in the system (errors I encountered were due to file names being too long).</p>
<h3>Data Universe: Contract meta-data</h3>
<p>The third step is to populate the meta-data (margin, min tick move, etc.) for each instrument in TradersStudio. This is done via the menu Data Manager/Data Universe.</p>
<p><a href="http://www.automated-trading-system.com/wp-content/uploads/2010/01/DataUniverse-MetaData.png" target="_blank"><img src="http://www.automated-trading-system.com/wp-content/uploads/2010/01/DataUniverse-MetaData-293x300.png" alt="DataUniverse-MetaData" title="DataUniverse-MetaData" width="293" height="300" class="alignnone size-medium wp-image-1227" /></a></p>
<p>Once done, the instruments can be used just by adding them to any session.</p>
<p>As mentioned earlier the next post will be a test comparing moving average and moving median indicators.</p>
<p><strong>Note</strong>: You can receive a <a href="http://www.automated-trading-system.com/csi" target="_blank" rel="nofollow">10% discount on CSI data subscriptions</a> (use coupon code LIBERTY)</p>
]]></content:encoded>
			<wfw:commentRss>http://www.automated-trading-system.com/csi-data-into-tradersstudio/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Amibroker vs TradersStudio: comparison</title>
		<link>http://www.automated-trading-system.com/amibroker-v-tradersstudio-comparison/</link>
		<comments>http://www.automated-trading-system.com/amibroker-v-tradersstudio-comparison/#comments</comments>
		<pubDate>Mon, 16 Nov 2009 10:18:38 +0000</pubDate>
		<dc:creator>Jez Liberty</dc:creator>
				<category><![CDATA[Backtest]]></category>
		<category><![CDATA[Software]]></category>
		<category><![CDATA[afl]]></category>
		<category><![CDATA[amibroker]]></category>
		<category><![CDATA[comparison]]></category>
		<category><![CDATA[screenshots]]></category>
		<category><![CDATA[tradersstudio]]></category>

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

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

		<guid isPermaLink="false">http://www.automated-trading-system.com/?p=188</guid>
		<description><![CDATA[As mentioned previously in What everybody ought to know about continuous Futures contracts, there are multiple ways to concatenate Futures contracts. Unfair Advantage offers a rich choice of concatenation algorithms &#8211; I will use UA as the base for this post. Please also refer to the Unfair Advantage online manual. Let&#8217;s look at the different [...]]]></description>
			<content:encoded><![CDATA[<p>As mentioned previously in <a href="http://www.automated-trading-system.com/what-everybody-ought-to-know-about-continous-futures-contracts" target="_blank">What everybody ought to know about continuous Futures contracts</a>, there are multiple ways to <strong>concatenate Futures contracts</strong>. Unfair Advantage offers a rich choice of concatenation algorithms &#8211; I will use UA as the base for this post.<br />
Please also refer to the <a rel="nofollow" href="http://www.csidata.com/custserv/onlinehelp/OnlineManual/" target="_blank">Unfair Advantage online manual</a>.</p>
<div id="attachment_224" class="wp-caption alignnone" style="width: 470px"><img class="size-full wp-image-224" title="Copper Continuous Contract" src="http://www.automated-trading-system.com/wp-content/uploads/2009/09/Corn-Continuous-Contract.jpg" alt="Continuous contracts allow you to chart Futures contract prices in one long time-series (here Copper ranging from 1965 to 2009)" width="460" height="193" /><p class="wp-caption-text">Continuous contracts allow you to chart Futures contract prices in one long time-series (here Copper ranging from 1965 to 2009)</p></div>
<p>Let&#8217;s look at the different possibilities:</p>
<h3>Non-adjusted contracts</h3>
<p>Take the front-month contract (nearest expiration date) and roll it over into the next one at expiration date. This generates a series of actual traded prices. But <span id="more-188"></span>as we discussed in our previous post, it does have negative impacts when used for back-testing because of the potential big gaps at roll-over times.</p>
<h3>Standard Back-Adjusted contracts</h3>
<p>A solution to this &#8220;big gap&#8221; problem is to move each contract up or down by a certain amount (the gap value) so that the rollover junction is continuous. This is <em>point-based adjustment</em> and is usualy performed &#8220;backwards&#8221;. You would start from the current contract, move the previous contract by a set amount, then subsequently move each of the anterior contracts to eliminate each gap you come across until the first contract of the timeseries.</p>
<h3>Proportionally Back-Adjusted contracts</h3>
<p>But as we saw in the last post, this <em>point-based adjustment</em> is not ideal either, as it loses the relative price differences and can even make past prices become negative. This is where <em>ratio-based adjustment</em> comes to the rescue.<br />
By applying a relative or <em>proportional</em> adjustment for each contract you will be able to maintain the historical price ratios and rid remove the gaps. This is equivalent to stock split adjustments in the Equities world. This is also done backwards &#8211; starting from the most recent contract going back, one by one, to the first contract in the series.<br />
Again, please check <a href="http://www.automated-trading-system.com/what-everybody-ought-to-know-about-continous-futures-contracts" target="_blank">the last post</a> for more details on the issues discussed above.</p>
<h3>Forward-Adjusted contracts</h3>
<p>Both <em>point-based adjustment</em> and <em>ratio-based adjustment</em> are usually worked out backwards &#8211; this allows to keep reference of the real/actual traded price in the current contract. However the same logic can be applied forward (start from the first contract and adjust your way up to the last contract). This will result in different contract values to back-adjusted contracts (but ratios would stay identical in case of proportional adjustments).</p>
<h3>Nth Nearest contracts</h3>
<p>This is a slight variation to all cases discussed above. Instead of always considering the nearest contract (ie front-month), you can decide to look at the <em>nth nearest</em> contract instead. For example, in Copper, the 3rd nearest contract is currently March 2010: HGH10. Once the current front-month contract expires (October 2009: HGV09), you would roll into the next available 3rd nearest contract which is May 2010: HGK10.<br />
This process should insulate you from possible more volatile price changes in the front-month contract around expiration time.</p>
<h3>Gann contract</h3>
<p>Gann contracts use a specific contract month and roll over only to the same contract in the next year. A March Gann contract, for example, consists of the nearest March contract for each day.</p>
<h3>Perpetual Contracts™</h3>
<p>This is an algorithm trademarked by CSI. To avoid the &#8220;gap&#8221; problem around rollover time, CSI have decided to smooth the transition phase out. The shift from one contract to the next one(s) spreads over time. The algorithm uses a time-weighted average of different expiration date contracts to gradually shift from the front-month to the further month as expiration date approaches. You can find more details <a rel="nofollow" href="http://www.csidata.com/cgi-bin/getManualPage.pl?URL=perpetualcontract(r)charts.htm" target="_blank">in the UA manual</a>.</p>
<h3>Other parameters: when to roll-over?</h3>
<p>You can roll-over right at expiration time. However this does not reflect actual trading activity, where physical roll-over (ie money flowing from one contract to the next) takes place earlier.<br />
You can decide to always roll-over n days before expiration but you can also decide to track actual market activity to trigger the roll-over. You would observe Open interest or Volume and roll-over when one of them shifts from one contract to another. This is a much more realistic approach.</p>
<p>Here is a screenshot of the settings I have used in Unfair Advantage to extract and concatenate the data, it is proportionally forward-adjusted with a roll-over triggered by a 2 consecutive shifts in Open Interest, but less than 5 days prior to expiration:</p>
<div id="attachment_196" class="wp-caption alignnone" style="width: 510px"><img class="size-full wp-image-196" title="Unfair Advantage Proportionally Forward-Adjusted Contract" src="http://www.automated-trading-system.com/wp-content/uploads/2009/09/UnfairAdvantage-Proportionally-Forward-Adjusted-Contract.jpg" alt="Unfair Advantage settings to generate a Proportionally Forward-Adjusted Contract " width="500" height="354" /><p class="wp-caption-text">Unfair Advantage settings to generate a Proportionally Forward-Adjusted Contract</p></div>
<h3>To be continued&#8230;</h3>
<p>There are many more options which will all be addressed in a further post detailing how to use the Unfair Advantage API to extract data directly from your own code (Exciting!).</p>
<p><strong>Note</strong>: You can receive a <a href="http://www.automated-trading-system.com/csi" target="_blank" rel="nofollow">10% discount on CSI data subscriptions</a> (use coupon code LIBERTY)</p>
]]></content:encoded>
			<wfw:commentRss>http://www.automated-trading-system.com/continuous-contract-options/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>What Everybody Ought to Know About Continous Futures Contracts</title>
		<link>http://www.automated-trading-system.com/what-everybody-ought-to-know-about-continous-futures-contracts/</link>
		<comments>http://www.automated-trading-system.com/what-everybody-ought-to-know-about-continous-futures-contracts/#comments</comments>
		<pubDate>Tue, 22 Sep 2009 10:43:27 +0000</pubDate>
		<dc:creator>Jez Liberty</dc:creator>
				<category><![CDATA[Backtest]]></category>
		<category><![CDATA[Data]]></category>
		<category><![CDATA[Futures]]></category>
		<category><![CDATA[rollover]]></category>
		<category><![CDATA[screenshots]]></category>

		<guid isPermaLink="false">http://www.automated-trading-system.com/?p=115</guid>
		<description><![CDATA[And how to avoid easy common mistakes when choosing which data to use to back-test a trading strategy on Futures&#8230; This is a &#8220;long-ish&#8221; post but I believe essential for good-practice back-testing. No long-term continuity Futures are specific in the way they trade in series of short-lived contracts that are only active for a few [...]]]></description>
			<content:encoded><![CDATA[<p>And how to avoid easy common mistakes when choosing which data to use to back-test a trading strategy on Futures&#8230; This is a &#8220;long-ish&#8221; post but I believe essential for good-practice back-testing.</p>
<h3>No long-term continuity</h3>
<p>Futures are specific in the way they trade in series of short-lived contracts that are only active for a few months (the most active contract for Silver at the moment is SIZ09 i.e. Dec 09 Silver 5,000 oz &#8211; see <a href="http://www.automated-trading-system.com/futures-contract-naming-convention/">this post for Futures Symbology</a>. Around mid-December most activity will roll-over to the March contract SIH10).<br />
This is different to stocks which offer a continuous stream of prices (generally since start of trading). In order to back-test a system on historical futures data, you need to &#8220;stitch&#8221; the futures contract prices to generate a similar continuous stream of prices.</p>
<h3>The $64,000 Question: How do you stitch the data?</h3>
<p>Easy, you might say: just chain all the contracts one after the other. But <span id="more-115"></span>there are always multiple contracts trading concurrently with different expiration dates (for Silver currently December 09, March 10, May 10, etc.). One accepted rule (in testing, but also in trading) is to always consider the front-month contract (nearest expiration date contract) and roll the price series into the next front-month contract around expiration time. That selection process determines the actual contract to consider for any given date. Now, it is &#8220;just&#8221; a matter of stitching them up together.</p>
<h3>But&#8230;</h3>
<p>As you might know, <a href="http://www.investorwords.com/1067/contango.html" target="_blank" rel="nofollow">contango</a>, <a href="http://www.investorwords.com/382/backwardation.html" target="_blank" rel="nofollow">backwardation</a> and other factors (crop seasons, etc.) generate a difference in the price of different expiration date contracts. In effect, when comes the time to move from one contract to the next, there will most likely be a gap between the old contract price and the new contract price. These gaps can be substantial and make your data appear disjointed.</p>
<div id="attachment_171" class="wp-caption alignnone" style="width: 310px"><a href="http://www.automated-trading-system.com/wp-content/uploads/2009/09/continuous-contract-1.jpg" target="_blank"><img src="http://www.automated-trading-system.com/wp-content/uploads/2009/09/continuous-contract-1-300x205.jpg" alt="Cocoa March 2005 (yellow) and June 2005 (Green) contracts - a big price gap exists at the time of transition between the 2 contracts" title="continuous-contract-1" width="300" height="205" class="size-medium wp-image-171" /></a><p class="wp-caption-text">Cocoa March 2005 (yellow) and June 2005 (Green) contracts - a big price gap exists at the time of transition between the 2 contracts</p></div>
<h3>The distorting &#8220;Panama canal&#8221; method</h3>
<p>One of the workarounds (described by Ed Seykota in his <a href="http://www.seykota.com/tribe/TSP/Continuous/index.htm" target="_blank" rel="nofollow">Panama article</a>) is to raise or lower each of the series one after the other so that each contract joins without a gap (similar to the boats going through the Panama canal). There are several problems with this “primitive&#8221; method:
<ul>
<li>You introduce a trend bias (by always lowering or raising prices at rollover time, the impact over time will introduce a large drift. Far past data could even become negative)</li>
<li>You are losing relative price difference (shifting all prices by an absolute amount has that effect: 10 to 11 is +10% but add 100 to both for an extreme case and 110 to 111 becomes less than +1%).</li>
</ul>
<div id="attachment_171" class="wp-caption alignnone" style="width: 310px"><a href="http://www.automated-trading-system.com/wp-content/uploads/2009/09/continuous-contract-2.jpg" target="_blank"><img src="http://www.automated-trading-system.com/wp-content/uploads/2009/09/continuous-contract-2-300x205.jpg" alt="The March contract (in yellow) has been lowered to eliminate the gap with the the June contract" title="continuous-contract-1" width="300" height="205" class="size-medium wp-image-171" /></a><p class="wp-caption-text">The March contract (in yellow) has been lowered to eliminate the gap with the the June contract. This distorts the relative price difference: the 25% move from 1480 to 1850 becomes a 27% move from 1380 to 1750.</p></div>
<h3>Taking a leaf from the Equities book</h3>
<p>The right approach seems to consider each contract roll-over in a similar fashion to a classic “stock-split&#8221; on Equities. When a stock splits, you effectively get X shares for every Y shares that you hold and the price is adjusted accordingly to reflect market capitalization. If a company performs a 10-for-1 split (meaning you get 10 new shares for every share that you hold), the price will effectively be divided by 10 after the split is effected – and historical data will normally be divided by 10 to represent the prices in the same “terms&#8221; as today (and therefore avoid showing a big price gap during the split). The historical data is &#8220;back-adjusted&#8221; by applying a proportional ratio related to the stock split (ratio=1/10 here).</p>
<h3>Proportional back-adjustment splicing for Futures contracts</h3>
<p>For Futures contract we can apply the same process of proportional back-adjustment at every contract roll-over. You would determine the adjustment ratio by dividing the price of the new contract by the price of the old contract. This ensures a constant relative (percentage-wise) relationship between any prices across the trading history.<br />
<div id="attachment_171" class="wp-caption alignnone" style="width: 310px"><a href="http://www.automated-trading-system.com/wp-content/uploads/2009/09/continuous-contract-3.jpg" target="_blank"><img src="http://www.automated-trading-system.com/wp-content/uploads/2009/09/continuous-contract-3-300x205.jpg" alt="The March contract has been lowered to join the newer contract with no gap. This has been done by multiplying the whole price series for that contract by 6% = 1850/1750 (prices before/after roll-over)." title="continuous-contract-3" width="300" height="205" class="size-medium wp-image-171" /></a><p class="wp-caption-text">The March contract has been lowered to join the newer contract with no gap. This has been done by multiplying the whole price series for that contract by 6% = 1850/1750 (prices before/after roll-over). This keeps the relative price difference: The 25% move highlighted stays a 25% move. You can see that the junction price is identical to the previous chart but the intermediate low circled in red has been raised (along with the whole series) to maintain the existing price ratio.</p></div></p>
<p>There might still be some concerns related to actual tick size vs. calculated tick size compared to the minimum tick size (a parameter you should probably take into account in your strategy) but proportional adjustments seems to be the best compromise because of the points highlighted above</p>
<p>There are many other ways to aggregate historical Futures data as well as other parameters to consider (nothing is ever so simple!) which I will address in a later post.</p>
<p><strong>Credits</strong>: This issue first came to my attention and described in detail by Thomas Stridsman in his two interesting Trading Systems books:<br />
<a href="http://www.automated-trading-system.com/trading-systems-that-work" target="_blank" rel="nofollow">Trading Systems that work</a> and <a href="http://www.automated-trading-system.com/trading-systems-money-management" target="_blank" rel="nofollow">Trading Systems and Money Management</a><br />
<a href="http://www.automated-trading-system.com/trading-systems-that-work" target="_blank" rel="nofollow"><img src="http://www.automated-trading-system.com/wp-content/uploads/2009/09/Stridsman-Trading-Systems-that-work.jpg" alt="Stridsman Trading Systems that work" title="Stridsman Trading Systems that work" width="100" height="125" class="alignnone size-full wp-image-126" /></a>&nbsp;&nbsp;<a href="http://www.automated-trading-system.com/trading-systems-money-management" target="_blank" rel="nofollow"><img src="http://www.automated-trading-system.com/wp-content/uploads/2009/09/Stridsman-Trading-Systems-Money-Management.jpg" alt="Stridsman Trading Systems and Money Management" title="Stridsman Trading Systems and Money Management" width="100" height="125" class="alignnone size-full wp-image-127" /></a></p>
<p><strong>Note</strong>: You can receive a <a href="http://www.automated-trading-system.com/csi" target="_blank" rel="nofollow">10% discount on CSI data subscriptions</a> (use coupon code LIBERTY)</p>
]]></content:encoded>
			<wfw:commentRss>http://www.automated-trading-system.com/what-everybody-ought-to-know-about-continous-futures-contracts/feed/</wfw:commentRss>
		<slash:comments>12</slash:comments>
		</item>
		<item>
		<title>I just got myself an Unfair Advantage&#8230;</title>
		<link>http://www.automated-trading-system.com/unfair-advantage-csi/</link>
		<comments>http://www.automated-trading-system.com/unfair-advantage-csi/#comments</comments>
		<pubDate>Tue, 15 Sep 2009 09:48:54 +0000</pubDate>
		<dc:creator>Jez Liberty</dc:creator>
				<category><![CDATA[Data]]></category>
		<category><![CDATA[Futures]]></category>
		<category><![CDATA[Software]]></category>
		<category><![CDATA[CSI]]></category>
		<category><![CDATA[screenshots]]></category>
		<category><![CDATA[Unfair Advantage]]></category>

		<guid isPermaLink="false">http://www.automated-trading-system.com/?p=9</guid>
		<description><![CDATA[What is this Unfair Advantage? Well, I have just purchased End Of Day historical futures data from Commodity Systems Inc. and this is how they call their Software/Database! Admittedly it is supposed to be a very good data feed that Google and Yahoo use for their respective Finance portal. They are also recommended by back-testing [...]]]></description>
			<content:encoded><![CDATA[<h3>What is this Unfair Advantage?</h3>
<p>Well, I have just purchased End Of Day historical futures data from <a rel="nofollow" href="http://www.csidata.com/" target="_blank">Commodity Systems Inc.</a> and this is how they call their Software/Database!</p>
<p>Admittedly it is supposed to be a very good data feed that Google and Yahoo use for their respective Finance portal. They are also recommended by back-testing software companies (<a rel="nofollow" href="http://www.tradingblox.com/" target="_blank">Trading Blox</a>, <a rel="nofollow" href="http://www.amibroker.com/" target="_blank">Amibroker</a>, etc.). Futures magazine also ran a <a rel="nofollow" href="http://www.csidata.com/csi/reviews/reprintsep99.html" target="_blank">piece</a> listing them as the &#8220;cleanest&#8221; data around (back in 99).</p>
<div id="attachment_75" class="wp-caption alignnone" style="width: 130px"><a rel="nofollow" href="http://www.csidata.com/csi/reviews/reprintsep99.html" target="_blank"><img title="Futures article - CSI historical data" src="http://www.automated-trading-system.com/wp-content/uploads/2009/08/CSI-Futures-99.jpg" alt="Futures article - CSI historical data" width="120" height="150" /></a><p class="wp-caption-text">Futures article - CSI historical data</p></div>
<h3>Why CSI?</h3>
<p>I chose them because <span id="more-9"></span>they appear to have credibility, good quality data, compatibility with Trading Blox and <a rel="nofollow" href="http://www.tradersstudio.com/" target="_blank">TradersStudio</a> and I was interested in their Futures contracts splicing/concatenation algorithm choice. I am not really interested in all the &#8220;bells and whistles&#8221; that come with the software (charting, analysis, etc.) but they might become useful. My primary interest is to feed the data to a back-testing software.</p>
<h3>Getting up and running: in a breeze</h3>
<p>After downloading the install (500MB!) the software installs itself very quickly and starts downloading the latest database updates. You are supposed to run updates every so often to keep the database current. Once it is done you can start playing with the data within Unfair Advantage. The docs (both online and printed) are pretty good too.</p>
<h3>Wide choice of markets and contract types</h3>
<p>There are about 900 futures in the database and you can pretty much splice them as you want &#8211; to recreate different TimeSeries. I&#8217;ll explore futures contract concatenation in a later post but to give you a taster of the Unfair Advantage &#8220;menu&#8221; you can &#8220;order&#8221; a CBT Corn (Floor + Electronic trading) in a March Gann Series format as a &#8220;starter&#8221; followed by CME Lean Hogs (Floor Trading only) proportionally back-adjusted with roll-overs triggered by Open Interest shifts as your &#8220;main&#8221;; and finally a Perpetual Contract of Robusta Coffee on EuroNext. Of course these are just examples (I&#8217;ll explain all these type of contracts in a follow-up post). Full functionality can be found <a rel="nofollow" href="http://www.csidata.com/cgi-bin/getManualPage.pl?URL=perpetualcontract(r)charts.htm" target="_blank">here</a>, all Futures coverage can be found <a rel="nofollow" href="http://www.csidata.com/cgi-bin/newspaperwrap.pl?file=/csiweb/ua/FactsheetHtml/cdbfact.htm&amp;fmt=nomenu&amp;title=World%20Futures%20Factsheet" target="_blank">there</a> and finally <a href="https://csidata2.com/cgi-bin/ua_order_form.pl" target="_blank" rel="nofollow">pricing options</a>.</p>
<h3>Export functionality</h3>
<p>For each of these contracts that you add to the Unfair Advantage portfolio, you can define several export formats that will generate specific files ready to be imported to your favourite back-testing tool. There is also an API that allows you to access the data to allow for some automation &#8211; this will definitely prove handy further down the line.</p>
<h3>The User Interface &#8211; screenshots</h3>
<p>Here is what the software looks like:<br />
<img class="alignnone size-full wp-image-92" title="CSI Unfair Advantage Main window" src="http://www.automated-trading-system.com/wp-content/uploads/2009/08/CSI-UnfairAdvantage-1.jpg" alt="CSI Unfair Advantage Main window" width="500" height="298" /><br />
Main window &#8211; the portfolio on the left-hand side contains all contracts you would want to follow while the right-hand side displays the current contract as a chart.</p>
<p><img class="alignnone size-full wp-image-93" title="CSI Unfair Advantage Contract Selection Window" src="http://www.automated-trading-system.com/wp-content/uploads/2009/08/CSI-UnfairAdvantage-2.jpg" alt="CSI Unfair Advantage Contract Selection Window" width="500" height="268" /><br />
Contract selection screen: a myriad of options to splice the data.</p>
<h3>In closing</h3>
<p>I feel pretty satisfied with what I got and eager to dig more into the software/data and play with it. The application seems intuitive enough and if CSI are as good as their reputation implies, this should increase back-test results quality. Promising&#8230;</p>
<p><strong>Note</strong>: You can receive a <a href="http://www.automated-trading-system.com/csi" target="_blank" rel="nofollow">10% discount on CSI data subscriptions</a> (use coupon code LIBERTY)</p>
]]></content:encoded>
			<wfw:commentRss>http://www.automated-trading-system.com/unfair-advantage-csi/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

