<?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; Software</title>
	<atom:link href="http://www.automated-trading-system.com/category/software/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>Execution: Benefits of Algorithmic Trading for CTAs</title>
		<link>http://www.automated-trading-system.com/execution-benefits-of-algorithmic-trading-for-ctas/</link>
		<comments>http://www.automated-trading-system.com/execution-benefits-of-algorithmic-trading-for-ctas/#comments</comments>
		<pubDate>Mon, 25 Jul 2011 02:17:19 +0000</pubDate>
		<dc:creator>Jez Liberty</dc:creator>
				<category><![CDATA[Software]]></category>
		<category><![CDATA[algorithmic trading]]></category>
		<category><![CDATA[aspect]]></category>
		<category><![CDATA[slippage]]></category>

		<guid isPermaLink="false">http://www.automated-trading-system.com/?p=4150</guid>
		<description><![CDATA[Recently, Man AHL, a &#8220;Trend Following Wizard&#8221;, announced in this press release some of the benefits from their &#8220;hard work to increase trade efficiency&#8221;: In the past two years, the Asia desk has reduced Asian trading costs by more than 20%, and 98 per cent of regional trading can now be processed electronically […]. We [...]]]></description>
			<content:encoded><![CDATA[<p><img src="http://www.automated-trading-system.com/wp-content/uploads/2011/07/traffic-light-canary-wharf-wwarby.jpg" alt="Complex Traffic Light Tree at Canary Wharf" title="Complex Traffic Light Tree at Canary Wharf" width="380" height="291" class="alignnone size-full wp-image-4151" /></p>
<p>Recently, Man AHL, a &#8220;Trend Following Wizard&#8221;, announced in <a href="http://www.mangroupplc.com/media/news-from-man/2011/press-release-27may2011.jsf" target="_blank" rel="nofollow">this press release</a> some of the benefits from their &#8220;hard work to increase trade efficiency&#8221;:</p>
<blockquote><p>In the past two years, the Asia desk has <strong>reduced Asian trading costs by more than 20%</strong>, and 98 per cent of regional trading can now be processed electronically […].</p>
<p>We have honed our execution style and <strong>algorithmic trading</strong> services to boost risk management and performance […]. These improvements have enabled us to <strong>add new asset classes to our trading models</strong> and we&#8217;ve recently expanded trading of several instruments including Asian stock index futures, interest rate swaps, relative value strategies, and a number of Asian currencies.<br />
[Emphasis mine]</p></blockquote>
<h3>Algorithmic Trading: Really a Novelty?</h3>
<p>You will have noticed the use of <strong>&#8220;algorithmic trading&#8221;</strong> in the copy above.<br />
The recent rise of <em>High-Frequency Trading</em> (HFT) has placed algorithmic trading in the spotlight, making it appear as the new trendy (and controversial) development in financial markets.</p>
<p>But <em>algorithms</em> are not necessarily <span id="more-4150"></span>the overly complex and sophisticated processes used in HFT. As <em>Merriam-Webster</em> defines it, an algorithm is simply:</p>
<blockquote><p><em>&#8220;a step-by-step procedure for solving a problem or accomplishing some end, especially by a computer&#8221;</em>.</p></blockquote>
<p>For example, a simple traffic light could be operated based on a fairly straight-forward <em>algorithm</em> (cycling colors in a predetermined sequence and time interval), in the same way as a trading system can have simple rules for Buy and Sell signals, like MA cross-overs. In practice, the algorithms are obviously more complex, for both traffic lights and trading systems.</p>
<p>But any <em>mechanical</em> (a.k.a. rule-based) trading system, such as those Trend Following programs employed by most CTAs would fit in the &#8220;algorithmic trading&#8221; category. In effect, <strong>any system that can be back-tested has to be based on algorithms</strong>.</p>
<h3>A Duality in Algorithmic Trading Applications</h3>
<p>There is a distinction between <strong>alpha-generation</strong> models and <strong>order execution</strong> models. The former has been implemented by CTAs with algorithmic trading for decades (using rule-based systems), whereas the latter is usually what the term <em>algorithmic trading</em> refers to nowadays (<em>computerisation and automation of order flow in financial markets</em> &#8211; as defined in <a href="http://en.wikipedia.org/wiki/Algorithmic_trading" target="_blank" rel="nofollow">wikipedia</a>).</p>
<p>And this is naturally an area that also applies to CTAs. Whereas <a href="http://www.automated-trading-system.com/futures-trading-and-small-account/">small retail traders face the opposite problem</a>, CTAs&#8217; larger size can represent an issue in terms of market impact and slippage, especially when dealing in less liquid markets.</p>
<p>As the Man press release highlights, not only does execution algorithmic trading benefits CTAs in reducing trade friction, it also allows them to tap extra markets, usually less liquid.</p>
<h3>Example of Algorithmic Trading for Execution: Aspect Capital</h3>
<p>Employing seasoned traders to execute orders dictated by the &#8220;alpha model&#8221; is one way to increase efficiency in trade friction. In <a href="http://www.automatedtrader.net/articles/my-machine/614/empirical-execution-aspect-capital" target="_blank" rel="nofollow">this Automated Trader interview</a>, Robert Wakefield, then COO of Aspect Capital &#8211; another London-based Trend Following Wizard &#8211; explains how their approach of mixing algorithmic execution with a desk of human traders allowed Aspect to <strong>reduce their net trading costs from 400 to 80 basis points</strong>.</p>
<p>The article is a few years old (2007) but gives an interesting example of the evolution of execution algorithmic trading within the CTA space.</p>
<p>Some excerpts (emphasis mine):</p>
<blockquote><p>Ultimately, the focus for us is to use the execution strategies to <strong>reduce our footprint in the market</strong>. Our order flow is now definitely more difficult to identify and prey upon. An important input into the algorithm design stage is that our counterparties are becoming more sophisticated at exploiting systematic order flows. So delivering an order flow that is invisible is a key requirement for us in building up capacity in the trading models we are running and also protecting the returns generated from them. <strong>Minimising predation of our order flow</strong> is absolutely critical for us.</p></blockquote>
<blockquote><p>At the moment about <strong>90% of our electronic trading is managed by our algorithmic execution model</strong>.</p></blockquote>
<blockquote><p>Commodities have stood out over the past year in terms of reduced trading costs. That has been partly due to the fact that some commodities are trading side by side on the floor and electronically, which has thrown up opportunities for price improvement.<br />
In addition, we built some liquidity-seeking algorithms […] that allow us to trade instantly once our size and price conditions have been met. I think these algorithms have given us a real edge in commodity markets […] because we have been able to respond immediately while other participants have been looking at the floor price and the screen price and taking time to decide which price to trade.</p></blockquote>
<blockquote><p>We already have the capability to completely automate the execution process right from our &#8220;alpha models&#8221; (which generate the raw trading signals) through to our execution systems and the back office. However, while we have this capability, we still prefer to take advantage of the <strong>value that human traders bring to the trading process</strong>.</p></blockquote>
<blockquote><p>All signals generated by the alpha models are published as core position requests on the trading floor. However, we allow the traders a degree of freedom around these core positions, which we refer to as a &#8220;risk corridor&#8221;. Intriguingly, you sometimes find that the traders who outperform are those who do less trading and are at the lower boundary of the corridor. In range bound conditions the alpha model may wish to trade more than is actually ideal for the market conditions, so <strong>the trader can actually add value by doing less</strong>.</p></blockquote>
<p>You can read the full interview <a href="http://www.automatedtrader.net/articles/my-machine/614/empirical-execution-aspect-capital" target="_blank" rel="nofollow">there</a>.<br />
&nbsp;</p>
<div style="font-size: 0.8em;">Picture credits: <a href="http://www.flickr.com/photos/wwarby/2460655511/" rel="nofollow" target="_blank">wwarby</a> via flickr (CC)</div>
<p>&nbsp;</p>
]]></content:encoded>
			<wfw:commentRss>http://www.automated-trading-system.com/execution-benefits-of-algorithmic-trading-for-ctas/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Walk-Forward in Trading Blox: Back-Testing Adaptive Trading</title>
		<link>http://www.automated-trading-system.com/walk-forward-trading-blox/</link>
		<comments>http://www.automated-trading-system.com/walk-forward-trading-blox/#comments</comments>
		<pubDate>Wed, 08 Sep 2010 13:58:11 +0000</pubDate>
		<dc:creator>Jez Liberty</dc:creator>
				<category><![CDATA[Backtest]]></category>
		<category><![CDATA[Software]]></category>
		<category><![CDATA[Trading Blox]]></category>
		<category><![CDATA[walk-forward]]></category>

		<guid isPermaLink="false">http://www.automated-trading-system.com/?p=2866</guid>
		<description><![CDATA[A few months ago, I got quite interested when Trading Blox announced that they introduced a new walk-forward functionality in their latest version. I just got round to upgrading, and giving that walk-forward testing a go. Amongst other things, some of the chart features have been improved &#8211; as can be seen in the eye [...]]]></description>
			<content:encoded><![CDATA[<p><img src="http://www.automated-trading-system.com/wp-content/uploads/2010/09/surface-chart.png" alt="surface-chart" title="surface-chart" width="480" height="394" class="aligncenter size-full wp-image-2867" /></p>
<p>A few months ago, I got quite interested when Trading Blox announced that they introduced a <strong>new walk-forward functionality</strong> in their latest version. I just got round to upgrading, and giving that walk-forward testing a go. Amongst other things, some of the chart features have been improved &#8211; as can be seen in the <em>eye candy</em> above.</p>
<h3>How it works</h3>
<p>You can check this previous <a href="http://www.automated-trading-system.com/walk-forward-testing/">post for an explanation of how walk-forward works</a>, from a general point of view. Robert Pardo (usually credited with the invention of walk-forward) has also written <a href="http://www.amazon.com/exec/obidos/ASIN/0470128011/autotradblog-20" target="_blank" rel="nofollow">his book</a>few books</a> on the subject.</p>
<p>This new feature is a combination of small enhancements to the core application (ie. silent tests, dynamic date and starting equity settings, etc.) and a semi-custom script implementing the walk-forward testing procedure. It feels more like a (good) hack leveraging the core stepping functionality, rather than a functionality built from the ground up, but it does the job rather well (I looked at the underlying code and its ingenuity is actually pretty cool).<span id="more-2866"></span></p>
<p>A minor issue is that you have to work out the number of optimization/out-of-sample cycles. If you get that wrong, the test will not cover the desired time interval and it makes the process less automated. Apart from that, the settings are pretty straight-forward, you can choose lengths of optimization and out-of-sample phases as well as other options:</p>
<div id="attachment_2871" class="wp-caption aligncenter" style="width: 418px"><img src="http://www.automated-trading-system.com/wp-content/uploads/2010/09/walk-forward-options.png" alt="In the setting above, there are 8 cycles, each having a 5-year optimization phase and 1-year out-of-sample phase" title="walk-forward-options" width="408" height="246" class="size-full wp-image-2871" /><p class="wp-caption-text">In the settings above, there are 8 cycles, each having a 5-year optimization phase and 1-year out-of-sample phase</p></div>
<h3>Objective Function</h3>
<p>At the end of the <strong>optimization phase</strong> of each cycle, the system picks the best set of parameters to be used in the <strong>out-of-sample phase</strong>. However there are many ways to determine the <strong><em>best</em> system</strong>. Do you use raw CAGR, MAR, Sharpe ratio, etc.?</p>
<p>There is a need to define the <strong>objective function</strong> (also called <a href="http://www.automated-trading-system.com/bliss-function-quantify-trading-system-objective/">bliss function, as explained here</a>, which will be used to determine the best system performance.</p>
<p>Trading Blox calculates standard statistics (MAR, CAGR, Drawdown, etc.) which can all be used as the objective function, but also allows the implementation of custom statistics calculations. These <strong>custom statistics</strong> can then be used as the objective function.</p>
<h3>Output</h3>
<p>This is where you realise the functionality is not fully integrated into the app. The system shows the individual results of each out-of-sample runs:</p>
<p><img src="http://www.automated-trading-system.com/wp-content/uploads/2010/09/wf-results1.png" alt="wf-results" title="wf-results" width="480" height="112" class="aligncenter size-full wp-image-2874" /></p>
<p>The stats calculated relate to each out-of-sample run (1 year in my example), whereas ideally these should all be spliced together, to form <strong>one system</strong> with its own stats. Same applies to equity curves, which are charted year by year (as individual charts). It is still possible to access the Daily Equity log file to do this yourself but it would be nice to have it better automated. The fact that it is a script and not compiled core code might make it possible to customize it to implement this automation.</p>
<p>Another log file also allows you to investigate the results of each optimization run and check their performance:</p>

<div class="wp_syntax"><div class="code"><pre class="vb" style="font-family:monospace;">Starting optimization run ,225,2005-01-03, <span style="color: #8D38C9; font-weight: bold;">to</span> ,2010-01-01, <span style="color: #8D38C9; font-weight: bold;">with</span> starting equity ,166470686.069881530,
&nbsp;
Run ,225, of ,256, Stepped Parameters: ,
Name,<span style="color: #8D38C9; font-weight: bold;">Step</span> Value,Goodness Measure of ,64.497285767,
Run ( Index ),8.000000000,
Optimization Run,1.000000000,
Entry Breakout (days),20.000000000,
<span style="color: #E56717; font-weight: bold;">Exit</span> Breakout (days),10.000000000,
Starting optimization run ,226,2005-01-03, <span style="color: #8D38C9; font-weight: bold;">to</span> ,2010-01-01, <span style="color: #8D38C9; font-weight: bold;">with</span> starting equity ,166470686.069881530,
&nbsp;
&nbsp;
----------------------------------------,
Best goodness of ,64.497285767, was <span style="color: #151B8D; font-weight: bold;">on</span> run ,1.000000000,
----------------------------------------,
&nbsp;
Starting out of sample test ,241,2010-01-01, <span style="color: #8D38C9; font-weight: bold;">to</span> ,2010-09-07, <span style="color: #8D38C9; font-weight: bold;">with</span> starting equity ,166470686.069881530,</pre></div></div>

<h3>Test Results</h3>
<p>For my first &#8220;test ride&#8221; of the walk-forward functionality, I used the <em>good ol&#8217;</em> <strong>Donchian system</strong>.</p>
<p>The system parameters being tested are the Entry and Exit breakout lengths ranging from 20 to 50 days for the entry and 10 to 25 days for the exit.</p>
<p>The parameters for the walk-forward procedure are a <strong>5-year optimization phase and 1-year out-of-sample phase</strong> with the plain CAGR stat being used as the objective/bliss/goodness function. The dates of the test go from 1998 to 2010 (but bear in mind that the first out-of-sample result is from 2003, ie. 1998 to 2002 are used as first optimization period).</p>
<p>The results (year by year) are the ones shown in the section above.</p>
<p>For an interesting comparison, I ran a standard stepped test using the same Donchian system and parameter values. Check below how the walk-forward system performance stacks up against the range of outputs from the stepped test:</p>
<div id="attachment_2878" class="wp-caption aligncenter" style="width: 462px"><img src="http://www.automated-trading-system.com/wp-content/uploads/2010/09/perf-results.png" alt="walk-forward in yellow" title="perf-results" width="452" height="325" class="size-full wp-image-2878" /><p class="wp-caption-text">All test results with the walk-forward result in yellow</p></div>
<p>In hindsight, it would have been better to pick other systems that performed better, but the advantage of the walk-forward process is that it adapts itself to pick a system.</p>
<h3>In Closing</h3>
<p>The walk-forward functionality is definitely not a fully-fledged feature of Trading Blox (yet?) &#8211; however it does allow for some automation of the process. The fact that it is &#8220;open&#8221; is probably a good thing as it can be tinkered with and improved easily. A nice addition to the product&#8230;</p>
]]></content:encoded>
			<wfw:commentRss>http://www.automated-trading-system.com/walk-forward-trading-blox/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>ALGODEAL: new horizons for retail quant traders?</title>
		<link>http://www.automated-trading-system.com/algodeal-retail-quant-traders/</link>
		<comments>http://www.automated-trading-system.com/algodeal-retail-quant-traders/#comments</comments>
		<pubDate>Wed, 31 Mar 2010 10:39:20 +0000</pubDate>
		<dc:creator>Jez Liberty</dc:creator>
				<category><![CDATA[Backtest]]></category>
		<category><![CDATA[Software]]></category>
		<category><![CDATA[algodeal]]></category>
		<category><![CDATA[fees]]></category>

		<guid isPermaLink="false">http://www.automated-trading-system.com/?p=1996</guid>
		<description><![CDATA[Recently came across ALGODEAL, which aims to provide us, quant traders, a platform to backtest and implement live automated trading strategies, as well as access to institutional money. This appears to be a promising development in the world of retail quant traders. Quant Fund Management meets Crowd-Sourcing In an adaptation of the web 2.0 model, [...]]]></description>
			<content:encoded><![CDATA[<p>Recently came across <a href="https://beta.algodeal.com/home.html" target="_blank">ALGODEAL</a>, which aims to provide us, quant traders, a platform to backtest and implement live automated trading strategies, as well as access to institutional money. This appears to be a promising development in the world of retail quant traders.</p>
<p><img src="http://www.automated-trading-system.com/wp-content/uploads/2010/03/algodeal.png" alt="algodeal" title="algodeal" width="414" height="107" class="alignnone size-full wp-image-1997" /></p>
<h3>Quant Fund Management meets Crowd-Sourcing</h3>
<p>In an adaptation of the <em>web 2.0</em> model, the company aims to leverage the content (quant strategies) provided by their users. In order to attract these quant users, AlgoDeal do provide you the following:</p>
<ul>
<li>Free <strong>backtesting software</strong>: their proprietary java-based MarketRunner</li>
<li>Free <strong>infrastructure</strong>: computer grid to run backtests and optimizations and low-latency data/exchange connectivity</li>
<li>Free clean <strong>historical market data</strong>: covering 80 futures markets</li>
<li>Access to <strong>institutional funds</strong></li>
</ul>
<p>And in <em>good ol&#8217;</em> 2.0 fashion, this is still a <em>beta</em> platform&#8230;<span id="more-1996"></span></p>
<h3>The Business Model</h3>
<p>The access to the software, infrastructure and market data is completely free; but the guys at  AlgoDeal are not running a charity for <em>hedge-fund-less</em> quant traders&#8230;</p>
<p>For each backtest you receive a scorecard with each metrics evaluated (CAGR, Sharpe ratio, MaxDD, etc.) and a final score. AlgoDeal selects the best scoring systems and allocates its clients&#8217; funds to the selected strategies.</p>
<p>This is done via a legal agreement that ties you for a fixed-term, but the ownership of the strategy remains yours.<br />
And you get paid: 10% of the strategy profits (which would amount to 50% of the variable part in  a typical 2/20 fee arrangement).</p>
<h3>Techie&#8217;s corner</h3>
<p>So you&#8217;ll need java if you want to use AlgoDeal&#8217;s platform. There are 2 options, you can either edit the strategies directly on the website or download MarketRunner and run it in your favourite IDE (the only real viable option..) such as Eclipse, etc.</p>
<p>The whole grid aspect is hidden from you: it should just mean that the backtests and optimizations that you submit online should be parallelized and run faster.</p>
<p>Regarding the execution side of things for live trading, AlgoDeal have entered into an agreement with <a href="http://www.quanthouse.com/">QuantHouse</a> to provide fast access to markets (proximity hosting, exchange connectivity with proprietary fiber optic network, etc.).</p>
<p>Finally, the historical data is all continuous contracts, rolled automatically (no mention of what rolling algorithm is used). They currently only provide daily data going back from 1999 but expect to go down to 1-min frequency in the coming months.</p>
<h3>Beta version</h3>
<p>This is still a beta version and as a result things are still moving. AlgoDeal have a published Roadmap on the site which lists coming improvements over the next 3 months, such as risk management, improved money management, multi-strategy systems, etc.</p>
<p>The beta tag also means that this is not yet a final, stable release. One example of this last night: I could not get to run one of their canned quick start examples, simply getting the message:</p>
<blockquote><p>Something went wrong! some backtests failed</p></blockquote>
<p>However, the developers do seem to be responsive on the forum they maintain (they also communicate through their <a href="http://blog.algodeal.com/" target="_blank" rel="nofollow">blog</a>). There is also a fair deal of doc available.</p>
<h3>Free invites</h3>
<p>This beta release is by invite only and new registrations seem to be closed for now. However I contacted AlgoDeal directly to request a special &#8220;blogger&#8221; invite, which they kindly obliged. They also mentioned that they would allocate 100 invites for you, my readers:</p>
<blockquote><p>We can allocate an initial set of 100 logins to referrals from your blog, once they have left their email on our website ask them to send an email to support@algodeal.com with in the subject line &#8220;On behalf of Jez&#8217;s blog&#8221;</p></blockquote>
<p>Note: for the record, I am not associated with AlgoDeal in any way and I am not getting anything out of these invites. I just thought that sharing these might be of interest to you.</p>
<h3>First impressions</h3>
<p>It is obviously not as sophisticated (yet?) as a &#8220;proper&#8221; backtesting platform such as Trading Blox, and I only played with AlgoDeal and their simple canned examples on the online editor. I assume there will be lots of progress and improvements in the coming months, before their proper launch (Q2 2010?).</p>
<p>I think the real selling point for serious quant traders is the &#8220;easy&#8221; access to institutional money, provided that the platform is flexible enough to implement &#8220;sophisticated&#8221; strategies. I am not sure whether long-term Trend Following strategies are the best way to get selected on this platform (backtest market data only goes back to relatively recent 1999, typical higher return volatility might be an issue, etc.)</p>
<p>In any case, this is a &#8220;free&#8221; way to get access to a large quant fund infrastructure and capital raising without the hassles and headaches that come with setting up your own fund or working for one (and looking a much better option than covestor, KaChing or collective2). I do not know how much external capital AlgoDeal have secured for fund allocation, but each strategy could be allocated between $100k to $10M, and the 10% share of profits makes it potentially an attractive proposition.</p>
<p>A platform and space to watch&#8230;</p>
]]></content:encoded>
			<wfw:commentRss>http://www.automated-trading-system.com/algodeal-retail-quant-traders/feed/</wfw:commentRss>
		<slash:comments>17</slash:comments>
		</item>
		<item>
		<title>Vortex indicator</title>
		<link>http://www.automated-trading-system.com/vortex-indicator/</link>
		<comments>http://www.automated-trading-system.com/vortex-indicator/#comments</comments>
		<pubDate>Mon, 15 Feb 2010 10:59:02 +0000</pubDate>
		<dc:creator>Jez Liberty</dc:creator>
				<category><![CDATA[Backtest]]></category>
		<category><![CDATA[Code]]></category>
		<category><![CDATA[Software]]></category>
		<category><![CDATA[ADX]]></category>
		<category><![CDATA[DMI]]></category>
		<category><![CDATA[IPV]]></category>
		<category><![CDATA[Trading Blox]]></category>
		<category><![CDATA[vortex]]></category>
		<category><![CDATA[Welles Wilder]]></category>

		<guid isPermaLink="false">http://www.automated-trading-system.com/?p=1600</guid>
		<description><![CDATA[I recently came across the Vortex Indicator, which aims to leverage the chaotic science of fluid mechanics (vortices) into a new indicator. I decided to code up this interesting concept in Trading Blox. The indicator logic is described in the January issue of TASC (Technical Analysis of Stocks and Commodities) and sounds intriguing (link to [...]]]></description>
			<content:encoded><![CDATA[<p>I recently came across the <strong>Vortex Indicator</strong>, which aims to leverage the chaotic science of fluid mechanics (vortices) into a new indicator. I decided to code up this interesting concept in Trading Blox.</p>
<div id="attachment_1612" class="wp-caption aligncenter" style="width: 490px"><img src="http://www.automated-trading-system.com/wp-content/uploads/2010/02/VortexbyNASA.png" alt="Vortex is present in chaotic movements such as fluid mechanics - picture courtesy of NASA" title="VortexbyNASA" width="480" height="367" class="size-full wp-image-1612" /><p class="wp-caption-text">Vortex is present in chaotic movements such as fluid mechanics - picture courtesy of NASA</p></div>
<p>The indicator logic is described in the January issue of TASC (Technical Analysis of Stocks and Commodities) and sounds intriguing (<a href="http://www.traders.com/Reprints/PDF_reprints/VFX_VORTEX.PDF" target="_blank" rel="nofollow">link to PDF article</a>). Without rehashing the details of the indicator calculation, it is very similar to Welles Wilder&#8217;s <a href="http://www.csidata.com/studies/Directional_Movement_Index_(DI_and_-DI).html" target="_blank" rel="nofollow">Directional Movement Index Calculation (DMI)</a> except that Wilder&#8217;s Directional Movement (largest part of today&#8217;s range outside of yesterday&#8217;s range) is replaced by calculating the differences between today&#8217;s High and yesterday&#8217;s Low (positive Vortex Movement) and today&#8217;s Low and yesterday&#8217;s High (negative Vortex Movement).</p>
<p><img src="http://www.automated-trading-system.com/wp-content/uploads/2010/02/vortex.png" alt="vortex" title="vortex" width="354" height="164" class="alignnone size-full wp-image-1613" /><br />
<span id="more-1600"></span><br />
TASC provides the Vortex indicator implementations in a wide collection of backtesting platforms (<a href="http://www.traders.com/Documentation/FEEDbk_docs/2010/01/TradersTips.html" target="_blank" rel="nofollow">here</a>). <del datetime="2010-02-14T22:28:05+00:00">Unfortunately</del> the <strong>Trading Blox</strong> implementation is not provided, which provided me a perfect opportunity to test and learn my new &#8220;backtesting toy&#8221; out.<br />
<a name="flaw"></a></p>
<h3>System Logic Flaw?</h3>
<p>The authors of the indicator provide a sample Excel spreadsheet to illustrate their calculation. By replicating the logic in Excel to get a handle on it (<a href="http://www.automated-trading-system.com/wp-content/uploads/2010/02/VortexCalcs0.xls" target="_blank">link to Excel spreadsheet</a>), I uncovered what I think is a flaw in the logic of the indicator of the calculation.</p>
<p>The VM calculations take the absolute value of the difference of opposite price extremes (High and Low) between today and yesterday. The screenshot of this <a href="http://www.automated-trading-system.com/wp-content/uploads/2010/02/VortexFlaws.xls" target="_blank">Excel spreadsheet</a> below clearly illustrates that this is a problem when dealing with gaps.</p>
<p><img src="http://www.automated-trading-system.com/wp-content/uploads/2010/02/Vortex-Flaws.png" alt="Vortex Flaws" title="Vortex Flaws" width="476" height="784" class="alignnone size-full wp-image-1614" /></p>
<p>Additionally, one could argue that the simple summation/averaging of the VMs is different from the original DMI calculations which use <a href="http://www.csidata.com/studies/Welles_Wilder_Moving_Average.html" target="_blank" rel="nofollow">Wilder Moving Averages</a>.</p>
<p>I have emailed the authors of the indicator with a suggestion for a fix. I&#8217;ll relay their answer here.</p>
<h3>Trading Blox implementation</h3>
<p>First and foremost, this is a Trading Blox coding exercise so I was not too concerned about these flaws (although I might be tempted to implement my own version addessing both flaws later).</p>
<p>I suggest you follow the calculation logic on the PDF article or the Excel spreadsheet. Here is how I implemented the Vortex Indicator in Trading Blox:</p>
<h4>1: Create Auxiliary Block</h4>
<p>This will hold all indicators and implement their calculations. Call it Vortex Indicator.</p>
<h4>2: Create parameters</h4>
<p>There is one parameter: the period for the Vortex indicator (VI) calculation:</p>
<p><img src="http://www.automated-trading-system.com/wp-content/uploads/2010/02/viDaysParam.png" alt="viDaysParam" title="viDaysParam" width="399" height="309" class="alignnone size-full wp-image-1615" /></p>
<h4>3: Create Indicators</h4>
<p>These are the first-level calculations: the daily True Range (TR), and VM+ (plusVM) and VM- (minusVM).</p>
<div id="attachment_1616" class="wp-caption alignnone" style="width: 460px"><img src="http://www.automated-trading-system.com/wp-content/uploads/2010/02/plusVM.png" alt="VM+ indicator using a calculated formula" title="plusVM" width="450" height="306" class="size-full wp-image-1616" /><p class="wp-caption-text">VM+ indicator using a calculated formula</p></div>
<p>The code for each of these indicators is:</p>
<p>plusVM (VM+ is the difference between today&#8217;s High and yesterday&#8217;s Low):</p>

<div class="wp_syntax"><div class="code"><pre class="vb" style="font-family:monospace;">Abs(instrument.High - instrument.Low[1])</pre></div></div>

<p>minusVM (VM- is the difference between today&#8217;s Low and yesterday&#8217;s High):</p>

<div class="wp_syntax"><div class="code"><pre class="vb" style="font-family:monospace;">Abs(instrument.High[1]-instrument.Low)</pre></div></div>

<p>TR (standard True Range calculation):</p>

<div class="wp_syntax"><div class="code"><pre class="vb" style="font-family:monospace;">Max(instrument.High-instrument.Low,Abs(instrument.High-instrument.<span style="color: #8D38C9; font-weight: bold;">Close</span>[1]), Abs(instrument.Low-instrument.<span style="color: #8D38C9; font-weight: bold;">Close</span>[1]))</pre></div></div>

<h4>4: Create Instrument Permanent Variables (IPV)</h4>
<p>This is for next-level calculations (Sum of TR, Sum of VM+ and VM-, VI+ and VI-). Setting these up as IPV allow for their values to be made available to other blocks (such the Entry block of a system).</p>
<div id="attachment_1618" class="wp-caption alignnone" style="width: 470px"><img src="http://www.automated-trading-system.com/wp-content/uploads/2010/02/plusVI_IPV1.png" alt="Notice how the variable scope has been updated to &quot;System&quot;" title="plusVI_IPV" width="460" height="357" class="size-full wp-image-1618" /><p class="wp-caption-text">Notice how the variable scope has been updated to System</p></div>
<p>The values for these IPVs are updated in the block <em>Update Indicators</em> script:</p>
<p><img src="http://www.automated-trading-system.com/wp-content/uploads/2010/02/UpdateIndicators.png" alt="UpdateIndicators" title="UpdateIndicators" width="480" height="447" class="alignnone size-full wp-image-1619" /></p>

<div class="wp_syntax"><div class="code"><pre class="vb" style="font-family:monospace;">plusVMSum=Sum(plusVM,viDays,0)
minusVMSum=Sum(minusVM,viDays,0)
TRSum=Sum(TR,viDays,0)
plusVI=plusVMSum/TRSum
minusVI=minusVMSum/TRSum</pre></div></div>

<h3>Use in Trading Blox</h3>
<p>Adding the auxiliary block to any System will enable it to access the values of the vortex indicators.</p>
<p>Here is how it could be done for a simple reversal system switching from Short to Long when VI+ crosses with VI- (and vice-versa).</p>
<h4>Create an Entry Exit block</h4>
<p>The system will have the Vortex Indicator Auxiliary block and our new Entry Exit block.</p>
<h4>Add VI+ and VI- as IPV to the Entry Exit block</h4>
<p>This is just a declaration to indicate that the values of these indicators are calculated in another block (our Vortex Indicator Auxiliary block).</p>
<div id="attachment_1620" class="wp-caption alignnone" style="width: 470px"><img src="http://www.automated-trading-system.com/wp-content/uploads/2010/02/IPV_External.png" alt="The IPV is defined externally in another block (Vortex indicator)" title="IPV_External" width="460" height="241" class="size-full wp-image-1620" /><p class="wp-caption-text">The IPV is defined externally in another block (Vortex indicator)</p></div>
<p>The other parameters and indicators in this block are standard ATR Stop elements.</p>
<h4>Code up the entry formula</h4>
<p>Simple logic to enter long when VI+ is above VI- and no long position are in and opposite for short entry:</p>
<p><img src="http://www.automated-trading-system.com/wp-content/uploads/2010/02/Entry.png" alt="Entry" title="Entry" width="480" height="343" class="alignnone size-full wp-image-1621" /></p>

<div class="wp_syntax"><div class="code"><pre class="vb" style="font-family:monospace;">VARIABLES: pvi <span style="color: #151B8D; font-weight: bold;">TYPE</span>: Floating
pvi = plusVI
VARIABLES: nvi <span style="color: #151B8D; font-weight: bold;">TYPE</span>: Floating
nvi = minusVI
VARIABLES: pos <span style="color: #151B8D; font-weight: bold;">TYPE</span>: <span style="color: #F660AB; font-weight: bold;">String</span>
pos = instrument.position
&nbsp;
<span style="color: #8D38C9; font-weight: bold;">IF</span> 	plusVI &gt; minusVI <span style="color: #8D38C9; font-weight: bold;">AND</span>
	instrument.position &lt;&gt; <span style="color: #F660AB; font-weight: bold;">LONG</span> <span style="color: #8D38C9; font-weight: bold;">THEN</span>
&nbsp;
	<span style="color: #8D38C9; font-weight: bold;">IF</span> useATRStops <span style="color: #8D38C9; font-weight: bold;">THEN</span>
		broker.EnterLongOnOpen( instrument.<span style="color: #8D38C9; font-weight: bold;">close</span> - averageTrueRange * atrStop )
	<span style="color: #8D38C9; font-weight: bold;">ELSE</span>
		broker.EnterLongOnOpen
	ENDIF
&nbsp;
ENDIF
&nbsp;
<span style="color: #8D38C9; font-weight: bold;">IF</span>	plusVI &lt; minusVI <span style="color: #8D38C9; font-weight: bold;">AND</span>
	instrument.position &lt;&gt; SHORT <span style="color: #8D38C9; font-weight: bold;">THEN</span>
&nbsp;
	<span style="color: #8D38C9; font-weight: bold;">IF</span> useATRStops <span style="color: #8D38C9; font-weight: bold;">THEN</span>
		broker.EnterShortOnOpen( instrument.<span style="color: #8D38C9; font-weight: bold;">close</span> + averageTrueRange * atrStop )
	<span style="color: #8D38C9; font-weight: bold;">ELSE</span>
		broker.EnterShortOnOpen
	ENDIF
&nbsp;
ENDIF</pre></div></div>

<h3>Trading Blox test</h3>
<p>Although I would like to do a more complete test to compare the Vortex Indicator to the DMI, all I have time left for today is a simple run of the system described above. I arbitrarily chose 39 for the VI period and here is the result:</p>
<table style="border:1px solid #c3c3c3; border-collapse:collapse;">
<tr>
<th style="background-color:#e5eecc; border:1px solid #c3c3c3; padding:5px;">
      CAGR
    </th>
<th style="background-color:#e5eecc; border:1px solid #c3c3c3; padding:5px;">
      Sharpe ratio
    </th>
<th style="background-color:#e5eecc; border:1px solid #c3c3c3; padding:5px;">
      Max DD
    </th>
</tr>
<tr>
<td style="background-color:#ffffff; border:1px solid #c3c3c3; padding:2px;">
5.80%
    </td>
<td style="background-color:#ffffff; border:1px solid #c3c3c3; padding:2px;" align = "right">
<div style="color:black">0.10</div>
</td>
<td style="background-color:#ffffff; border:1px solid #c3c3c3; padding:2px;" align = "right">
<div style="color:black">42.4%</div>
</td>
</tr>
</table>
<p>&nbsp;<br />
<div id="attachment_1627" class="wp-caption alignnone" style="width: 500px"><img src="http://www.automated-trading-system.com/wp-content/uploads/2010/02/LogarithmicEquityGraph_vortex11.png" alt="Logarithmic Equity curve from Vortex indicator system" title="LogarithmicEquityGraph_vortex1" width="490" height="295" class="size-full wp-image-1627" /><p class="wp-caption-text">Logarithmic Equity curve from Vortex indicator system</p></div></p>
<p>And as a side note of caution when dealing with backtest results, I&#8217;ll show you a quick trick that will allow me to nearly double the CAGR (Compounded Annual Growth Rate) by not touching the system at all:</p>
<table style="border:1px solid #c3c3c3; border-collapse:collapse;">
<tr>
<th style="background-color:#e5eecc; border:1px solid #c3c3c3; padding:5px;">
      CAGR
    </th>
<th style="background-color:#e5eecc; border:1px solid #c3c3c3; padding:5px;">
      Sharpe ratio
    </th>
<th style="background-color:#e5eecc; border:1px solid #c3c3c3; padding:5px;">
      Max DD
    </th>
</tr>
<tr>
<td style="background-color:#ffffff; border:1px solid #c3c3c3; padding:2px;">
10.93%
    </td>
<td style="background-color:#ffffff; border:1px solid #c3c3c3; padding:2px;" align = "right">
<div style="color:black">0.26</div>
</td>
<td style="background-color:#ffffff; border:1px solid #c3c3c3; padding:2px;" align = "right">
<div style="color:black">33.0%</div>
</td>
</tr>
</table>
<p>&nbsp;<br />
<div id="attachment_1628" class="wp-caption alignnone" style="width: 500px"><img src="http://www.automated-trading-system.com/wp-content/uploads/2010/02/LogarithmicEquityGraph_vortex2.png" alt="Logarithmic Equity curve from Vortex indicator system (truncated period)" title="LogarithmicEquityGraph_vortex2" width="490" height="295" class="size-full wp-image-1628" /><p class="wp-caption-text">Logarithmic Equity curve from Vortex indicator system (truncated period)</p></div></p>
<p>Notice what happened there: I just dropped years 1996 to 1999 from the backtests. Et voila! Surely a trick employed by more than one dubious trading systems salesmen&#8230;</p>
<h3>Conclusion</h3>
<p><del datetime="2010-02-17T00:25:39+00:00">The authors claim that the Vortex indicator improve on the DMI invented by Welles Wilder</del> Update: the authors have sent me an email to clarify that they have not made such claim (I was merely interpolating, given the ressemblance of the Vortex indicator with the DMI). It would be interesting to test this as the idea of mixing chaos/fluid mechanics concepts to price movements is appealing. Fixing the indicator flaws would be good too. More to come&#8230; (update: on the <a href="http://www.automated-trading-system.com/free-code-improved-vortex/">next post</a>, I also explain the authors response to my claim of the indicator having flaws).</p>
<h4>Code download</h4>
<p>Please find below the individual components (blocks) for download:<br />
<a href="http://www.automated-trading-system.com/wp-content/uploads/2010/02/Vortex-Indicator.tbx">link to Vortex indicator block file</a> (tbx)<br />
<a href="http://www.automated-trading-system.com/wp-content/uploads/2010/02/VI-Entry-Exit.tbx">link to VI sample Entry Exit block</a> (tbx)</p>
]]></content:encoded>
			<wfw:commentRss>http://www.automated-trading-system.com/vortex-indicator/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>MMDI Portfolio Filter in Trading Blox</title>
		<link>http://www.automated-trading-system.com/mmdi-portfolio-filter-trading-blox/</link>
		<comments>http://www.automated-trading-system.com/mmdi-portfolio-filter-trading-blox/#comments</comments>
		<pubDate>Tue, 02 Feb 2010 12:21:08 +0000</pubDate>
		<dc:creator>Jez Liberty</dc:creator>
				<category><![CDATA[Backtest]]></category>
		<category><![CDATA[Futures]]></category>
		<category><![CDATA[Software]]></category>
		<category><![CDATA[Strategies]]></category>
		<category><![CDATA[robust]]></category>
		<category><![CDATA[screenshots]]></category>
		<category><![CDATA[Trading Blox]]></category>
		<category><![CDATA[Trend Following]]></category>

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

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

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

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

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

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

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

