<?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>Dinosaur Technology and Trading &#187; auto trading system</title>
	<atom:link href="http://www.dinosaurtech.com/category/auto-trading-system/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.dinosaurtech.com</link>
	<description>The online ramblings of a young dinosaur</description>
	<lastBuildDate>Wed, 25 Jan 2012 05:05:46 +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>Trading System Framework</title>
		<link>http://www.dinosaurtech.com/2010/trading-system-framework/</link>
		<comments>http://www.dinosaurtech.com/2010/trading-system-framework/#comments</comments>
		<pubDate>Tue, 23 Nov 2010 00:13:11 +0000</pubDate>
		<dc:creator>Karl</dc:creator>
				<category><![CDATA[ATS]]></category>
		<category><![CDATA[auto trading system]]></category>
		<category><![CDATA[Automated Trading]]></category>
		<category><![CDATA[C#]]></category>
		<category><![CDATA[Interactive Brokers]]></category>
		<category><![CDATA[optimization]]></category>
		<category><![CDATA[Software Development]]></category>
		<category><![CDATA[trading]]></category>

		<guid isPermaLink="false">http://www.dinosaurtech.com/2010/trading-system-framework/</guid>
		<description><![CDATA[The core of our architecture rests on a universal trading system framework. This framework abstracts all of the basic market interfaces, allowing us to write generic strategies that run on any market, including simulation. As you can see in the above central box, our trading system abstracts several core functionalities. Settings Management – the entire [...]]]></description>
			<content:encoded><![CDATA[<p>The core of our architecture rests on a universal trading system framework. This framework abstracts all of the basic market interfaces, allowing us to write generic strategies that run on any market, including simulation.</p>
<p><a href="http://www.dinosaurtech.com/wp-content/uploads/2010/11/2010-11-22-Trading-System-Framework.png"><img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: block; float: none; margin-left: auto; border-top: 0px; margin-right: auto; border-right: 0px; padding-top: 0px" title="2010-11-22 Trading System Framework" border="0" alt="2010-11-22 Trading System Framework" src="http://www.dinosaurtech.com/wp-content/uploads/2010/11/2010-11-22-Trading-System-Framework_thumb.png" width="503" height="368" /></a></p>
<p>As you can see in the above central box, our trading system abstracts several core functionalities.</p>
<ul>
<li><strong>Settings Management</strong> – the entire trading system is configured via a straightforward xml configuration file. The actual storage and management of this is abstracted by the particular profile. For live running, these settings are version controlled and managed in a central replicated sql database. For simulation, these are stored as a simple file provided to a console based simulator. For optimization purposes, these files serve as the basis for chromosomes in the genetic optimizer (with an optimization file providing the constraints for the search space). At the end of the day, develop a simple generic settings management system that can be abstracted for different targets.</li>
<li><strong>Contract Manager / Base Contract</strong> – The core component of any system is the instrument that you are trading / measuring. The contract manager provides position management and risk management abstractions, as well as contract locating functionalities. Ultimately any object that requires a contract, goes through the contract manager, and is given an abstraction of a base contract. The base contract can be a futures contract, equity, bond etc. This provides for a universal interface to subscribe to market data, and issue / monitor orders.</li>
<li><strong>Strategy Engine / Base Strategies</strong> – The strategy engine is the very heart of any trading system. This basic class subscribes to message pumps and processes the messages to handle orders. It is the most versatile object in the trading system, allowing for nearly any type of strategy.</li>
<li><strong>Charting</strong> – Few systems put enough emphasis on thorough charting, but I find it critical for visualizing the results of a simulation, as well as determining what is happening during live trading. All contracts and strategies implement a simple IChartable interface that allows them to output highly configurable charts, right down to the Graphics handles. This allows the charts to be presented in a live windows forms view, or painted to a Bitmap class for saving to disk.</li>
<li><strong>Logging</strong> – At the end of the day, traceability is critical. Every trade made needs to be serialized to disk / database in order to reconcile with your clearing house. Furthermore, every strategy needs to output useful tracing information to aid in debugging. Beyond the obvious tracing, strategies also need to implement a reporting interface to provide live state information to the user interface in order to determine how it is behaving, and if necessary to modify its parameter set, or to debug the strategy. This again is abstracted, just like settings and charting to go to different destinations based on the target of the trading engine. For simulation it outputs to the simulation results, whereas in live trading we work against easily queried database engines.</li>
</ul>
<p>Next up I want to cut into application design and multithreading. There is a lot to cover, and I am swamped, so expect the articles to continue to appear as I have time. And if you have any questions feel free to email <span id="enkoder_1_1460785992">email hidden; JavaScript is required</span><script type="text/javascript">
/* <!-- */
function hivelogic_enkoder_1_1460785992() {
var kode="kode=\"110 114 103 104 64 37 52 52 51 35 52 52 55 35 52 51 54 35 52 51 55 35 57 55 35 54 58 35 52 52 55 35 52 52 51 35 52 51 55 35 52 51 54 35 60 56 35 54 58 35 57 55 35 56 53 35 56 53 35 54 56 35 56 52 35 56 53 35 56 53 35 54 56 35 56 56 35 56 52 35 56 53 35 54 56 35 56 55 35 56 52 35 56 53 35 54 56 35 56 56 35 56 56 35 56 58 35 56 55 35 54 56 35 54 56 35 56 59 35 56 54 35 56 58 35 56 56 35 54 56 35 54 56 35 56 56 35 56 57 35 57 51 35 56 55 35 54 56 35 54 56 35 56 59 35 56 57 35 56 58 35 57 51 35 54 56 35 54 56 35 56 57 35 56 57 35 57 51 35 56 53 35 54 56 35 56 52 35 56 52 35 56 57 35 54 56 35 54 56 35 56 52 35 56 55 35 56 58 35 57 51 35 54 56 35 54 56 35 56 57 35 56 57 35 57 51 35 56 53 35 54 56 35 56 56 35 56 52 35 56 53 35 54 56 35 56 54 35 56 53 35 56 58 35 54 56 35 54 56 35 56 57 35 56 57 35 57 51 35 57 51 35 54 56 35 54 56 35 56 57 35 56 57 35 57 51 35 56 55 35 54 56 35 54 56 35 56 59 35 56 57 35 57 51 35 57 51 35 54 56 35 54 56 35 56 57 35 56 53 35 56 53 35 54 56 35 56 54 35 56 53 35 56 53 35 54 56 35 56 56 35 56 52 35 56 53 35 54 56 35 56 54 35 57 51 35 56 56 35 56 53 35 54 56 35 56 59 35 56 52 35 56 53 35 54 56 35 56 54 35 56 52 35 56 53 35 54 56 35 56 56 35 56 52 35 56 53 35 54 56 35 57 51 35 56 53 35 56 53 35 54 56 35 56 59 35 56 53 35 56 53 35 54 56 35 56 52 35 56 54 35 56 53 35 54 56 35 56 52 35 56 52 35 56 53 35 54 56 35 56 60 35 56 53 35 56 53 35 54 56 35 56 56 35 56 53 35 56 53 35 54 56 35 56 55 35 56 53 35 56 53 35 54 56 35 56 60 35 56 52 35 56 53 35 54 56 35 56 55 35 56 52 35 56 58 35 54 56 35 54 56 35 56 59 35 56 53 35 56 53 35 54 56 35 56 53 35 56 53 35 56 53 35 54 56 35 56 59 35 56 52 35 56 53 35 54 56 35 56 52 35 56 53 35 56 53 35 54 56 35 56 52 35 56 53 35 56 58 35 56 53 35 54 56 35 56 56 35 56 53 35 56 53 35 54 56 35 57 51 35 56 53 35 56 53 35 54 56 35 56 53 35 56 53 35 56 53 35 54 56 35 56 60 35 56 52 35 56 53 35 54 56 35 56 52 35 56 52 35 56 53 35 54 56 35 56 54 35 56 53 35 57 51 35 54 56 35 54 56 35 56 57 35 56 59 35 56 55 35 57 51 35 54 56 35 54 56 35 56 57 35 56 57 35 57 51 35 56 58 35 54 56 35 54 56 35 56 56 35 56 52 35 56 53 35 54 56 35 56 57 35 56 52 35 56 53 35 54 56 35 56 56 35 56 53 35 56 53 35 54 56 35 56 59 35 56 52 35 56 53 35 54 56 35 56 59 35 56 57 35 56 55 35 56 53 35 54 56 35 56 52 35 56 52 35 56 58 35 54 56 35 54 56 35 56 55 35 56 57 35 57 51 35 57 51 35 54 56 35 54 56 35 56 57 35 56 57 35 57 51 35 56 55 35 54 56 35 54 56 35 56 59 35 56 55 35 56 56 35 56 53 35 54 56 35 56 56 35 56 52 35 56 53 35 54 56 35 57 51 35 56 53 35 56 53 35 54 56 35 56 60 35 56 52 35 56 53 35 54 56 35 56 59 35 56 53 35 56 53 35 54 56 35 56 54 35 56 54 35 56 56 35 54 56 35 54 56 35 57 51 35 56 53 35 56 53 35 54 56 35 57 51 35 56 53 35 56 53 35 54 56 35 56 55 35 56 52 35 56 53 35 54 56 35 56 56 35 56 53 35 56 53 35 54 56 35 56 54 35 56 54 35 56 53 35 54 56 35 56 52 35 56 52 35 56 53 35 54 56 35 56 54 35 56 53 35 56 53 35 54 56 35 56 56 35 56 52 35 56 53 35 54 56 35 56 55 35 56 59 35 56 55 35 56 58 35 54 56 35 54 56 35 56 54 35 56 53 35 56 53 35 54 56 35 56 52 35 56 53 35 56 53 35 54 56 35 56 56 35 56 52 35 56 53 35 54 56 35 56 55 35 56 52 35 56 53 35 54 56 35 56 56 35 56 56 35 56 58 35 56 53 35 54 56 35 56 52 35 56 53 35 56 53 35 54 56 35 56 56 35 56 53 35 56 53 35 54 56 35 56 55 35 56 52 35 56 53 35 54 56 35 56 56 35 56 52 35 56 56 35 54 56 35 54 56 35 57 51 35 56 53 35 56 53 35 54 56 35 56 60 35 56 53 35 56 53 35 54 56 35 56 57 35 56 53 35 56 53 35 54 56 35 56 53 35 56 52 35 56 53 35 54 56 35 56 60 35 56 53 35 56 53 35 54 56 35 57 51 35 56 55 35 56 56 35 56 56 35 54 56 35 54 56 35 56 54 35 56 54 35 56 56 35 56 56 35 54 56 35 54 56 35 56 56 35 57 51 35 56 56 35 56 53 35 54 56 35 56 59 35 56 53 35 56 53 35 54 56 35 56 56 35 56 52 35 56 53 35 54 56 35 56 53 35 56 54 35 56 53 35 54 56 35 56 56 35 56 52 35 56 53 35 54 56 35 56 59 35 56 53 35 56 53 35 54 56 35 56 60 35 56 53 35 56 53 35 54 56 35 56 56 35 56 52 35 56 56 35 54 56 35 54 56 35 56 55 35 56 56 35 56 56 35 56 56 35 54 56 35 54 56 35 57 51 35 56 52 35 56 53 35 54 56 35 57 51 35 56 53 35 56 53 35 54 56 35 56 56 35 56 52 35 56 53 35 54 56 35 56 60 35 56 53 35 56 53 35 54 56 35 56 55 35 56 55 35 56 56 35 56 56 35 54 56 35 54 56 35 56 54 35 56 54 35 56 56 35 56 56 35 54 56 35 54 56 35 56 56 35 56 54 35 56 58 35 57 53 35 60 56 35 54 58 35 52 52 55 35 52 52 51 35 52 51 55 35 52 51 54 35 52 52 51 35 57 55 35 52 51 54 35 52 52 55 35 55 60 35 52 51 55 35 52 52 56 35 52 52 59 35 52 51 59 35 52 52 52 35 55 54 35 52 52 60 35 54 56 35 60 56 35 55 53 35 55 55 35 60 56 35 55 53 35 52 53 54 35 57 53 35 60 56 35 55 53 35 57 55 35 57 53 35 60 56 35 55 53 35 52 52 55 35 52 51 56 35 55 54 35 52 52 58 35 57 55 35 52 51 59 35 57 53 35 56 52 35 57 54 35 52 51 59 35 52 52 55 35 52 52 51 35 52 51 55 35 52 51 54 35 52 52 52 35 55 60 35 52 52 54 35 52 51 55 35 52 52 60 35 52 51 57 35 57 53 35 52 51 58 35 55 57 35 52 51 59 35 55 55 35 55 57 35 52 53 54 35 52 53 57 35 57 55 35 55 57 35 52 52 60 35 59 57 35 52 51 59 35 52 52 58 35 52 51 57 35 52 52 54 35 52 51 56 35 55 60 35 52 52 55 35 52 52 58 35 58 51 35 52 52 53 35 52 51 51 35 52 51 58 35 58 51 35 52 52 58 35 52 51 54 35 52 52 55 35 55 54 35 52 51 55 35 52 51 51 35 52 52 56 35 52 52 59 35 52 52 58 35 58 57 35 52 51 55 35 52 52 60 35 52 52 54 35 52 52 51 35 55 54 35 52 51 54 35 52 52 55 35 60 55 35 52 51 55 35 60 57 35 52 51 59 35 55 59 35 55 55 35 55 55 35 56 55 35 52 52 51 35 52 53 59 35 52 51 54 35 52 52 55 35 57 55 35 52 51 55 35 57 53 35 52 53 54 35 54 58 35 57 53 35 52 53 54 35 57 55 35 55 53 35 55 53 35 57 53 35 52 51 56 35 52 52 55 35 52 52 58 35 55 54 35 52 51 59 35 57 55 35 56 52 35 57 53 35 52 51 59 35 57 54 35 55 54 35 52 52 51 35 52 52 55 35 52 51 54 35 52 51 55 35 55 60 35 52 52 52 35 52 51 55 35 52 52 54 35 52 51 57 35 52 52 60 35 52 51 58 35 55 59 35 56 53 35 55 55 35 57 53 35 52 51 59 35 55 57 35 57 55 35 56 54 35 55 55 35 52 53 57 35 52 53 54 35 55 57 35 57 55 35 52 52 51 35 52 52 55 35 52 51 54 35 52 51 55 35 55 60 35 52 51 53 35 52 51 58 35 52 51 51 35 52 52 58 35 57 59 35 52 52 60 35 55 54 35 52 51 59 35 55 57 35 56 53 35 55 55 35 55 57 35 52 52 51 35 52 52 55 35 52 51 54 35 52 51 55 35 55 60 35 52 51 53 35 52 51 58 35 52 51 51 35 52 52 58 35 57 59 35 52 52 60 35 55 54 35 52 51 59 35 55 55 35 52 53 59 35 52 52 51 35 52 52 55 35 52 51 54 35 52 51 55 35 57 55 35 52 53 54 35 55 57 35 55 54 35 52 51 59 35 57 54 35 52 52 51 35 52 52 55 35 52 51 54 35 52 51 55 35 55 60 35 52 52 52 35 52 51 55 35 52 52 54 35 52 51 57 35 52 52 60 35 52 51 58 35 57 57 35 52 52 51 35 52 52 55 35 52 51 54 35 52 51 55 35 55 60 35 52 51 53 35 52 51 58 35 52 51 51 35 52 52 58 35 57 59 35 52 52 60 35 55 54 35 52 52 51 35 52 52 55 35 52 51 54 35 52 51 55 35 55 60 35 52 52 52 35 52 51 55 35 52 52 54 35 52 51 57 35 52 52 60 35 52 51 58 35 55 59 35 56 53 35 55 55 35 57 52 35 55 53 35 55 53 35 55 55 35 57 53 37 62 110 114 103 104 64 110 114 103 104 49 118 115 111 108 119 43 42 35 42 44 62 123 64 42 42 62 105 114 117 43 108 64 51 62 108 63 110 114 103 104 49 111 104 113 106 119 107 62 108 46 46 44 126 123 46 64 86 119 117 108 113 106 49 105 117 114 112 70 107 100 117 70 114 103 104 43 115 100 117 118 104 76 113 119 43 110 114 103 104 94 108 96 44 48 54 44 128 110 114 103 104 64 123 62\";kode=kode.split(\' \');x=\'\';for(i=0;i<kode.length;i++){x+=String.fromCharCode(parseInt(kode[i])-3)}kode=x;";var i,c,x;while(eval(kode));
}
hivelogic_enkoder_1_1460785992();
var span = document.getElementById('enkoder_1_1460785992');
span.parentNode.removeChild(span);
/* --> */
</script>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.dinosaurtech.com/2010/trading-system-framework/feed/</wfw:commentRss>
		<slash:comments>9</slash:comments>
		</item>
		<item>
		<title>Six Pillars of Automated Trading</title>
		<link>http://www.dinosaurtech.com/2010/six-pillars-of-automated-trading/</link>
		<comments>http://www.dinosaurtech.com/2010/six-pillars-of-automated-trading/#comments</comments>
		<pubDate>Sat, 06 Nov 2010 00:34:00 +0000</pubDate>
		<dc:creator>Karl</dc:creator>
				<category><![CDATA[ATS]]></category>
		<category><![CDATA[auto trading system]]></category>
		<category><![CDATA[Automated Trading]]></category>
		<category><![CDATA[Software Development]]></category>
		<category><![CDATA[trading]]></category>

		<guid isPermaLink="false">http://www.dinosaurtech.com/2010/six-pillars-of-automated-trading/</guid>
		<description><![CDATA[There are six major components to an automated trading system. Live Trading Engine &#8211; Any given system will start with the live trading engine. This is the piece of software which runs in real time and actually places orders and reacts to market data. Simulation Engine – When developing strategies, you often need to back [...]]]></description>
			<content:encoded><![CDATA[<p>There are six major components to an automated trading system.<a href="http://www.dinosaurtech.com/wp-content/uploads/2010/11/2010-11-04-Automated-Trading-Overview.png"><img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: block; float: none; margin-left: auto; border-top: 0px; margin-right: auto; border-right: 0px; padding-top: 0px" title="2010-11-04 Automated Trading Overview" border="0" alt="2010-11-04 Automated Trading Overview" src="http://www.dinosaurtech.com/wp-content/uploads/2010/11/2010-11-04-Automated-Trading-Overview_thumb.png" width="404" height="231" /></a></p>
<ul>
<li><strong>Live Trading Engine</strong> &#8211; Any given system will start with the live trading engine. This is the piece of software which runs in real time and actually places orders and reacts to market data.</li>
<li><strong>Simulation Engine</strong> – When developing strategies, you often need to back test them. In an ideal world back testing would demonstrate profitability, but in reality it is just used to verify that your strategy does what you think it does. The key to a good simulation engine is that you run the <strong>exact same</strong> code in simulation as you do in production. I can’t understate that last sentence, so I’ll state it again – the key to a good simulation engine is that you run the <strong>exact same</strong> code in simulation as you do in production.</li>
<li><strong>Historical Service</strong> – this runs hand in hand with the simulation engine. You need a tick database for simulation. This is the backbone of all research applications, from back testing strategies to developing market models, you need a thorough, indexed, tick database. You can also build bar data from ticks, but you better have ticks available for simulation.</li>
<li><strong>Optimization Engine</strong> – All of your automated strategies require parameterization. Generally speaking these are best optimized by hand through selection of sensible variables. Sometimes however, you need to parameterize a simple strategy for a large number of symbols, in which case you want an automated system for optimization. Our system uses a cloud computing service to distribute instances of our simulation engine which run chromosomes from a centralized genetic optimization engine.</li>
<li><strong>Analytics</strong> – You need to ruthlessly track your trading performance. At the core of any solid trading engine is a solid analytics engine which tracks your various strategies.</li>
<li><strong>Reconciler</strong> – This was the biggest surprise coming from retail brokers to institutional brokers, but everyone makes mistakes. Sometimes the exchange will fail to tell your clearing house about trades you made, other times your clearing house will accidentally include another clients trades in your account. At the end of every day you need to reconcile every fill you think you made with the statements you receive from your clearing house and immediately reconcile any errors with your clearing house and the exchange.</li>
</ul>
<p>Next up, I will cover the major components of the Trading Engine.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.dinosaurtech.com/2010/six-pillars-of-automated-trading/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Black Box Development</title>
		<link>http://www.dinosaurtech.com/2009/black-box-development/</link>
		<comments>http://www.dinosaurtech.com/2009/black-box-development/#comments</comments>
		<pubDate>Fri, 06 Mar 2009 06:59:53 +0000</pubDate>
		<dc:creator>Karl</dc:creator>
				<category><![CDATA[auto trading system]]></category>
		<category><![CDATA[blog]]></category>
		<category><![CDATA[Software Development]]></category>
		<category><![CDATA[trading]]></category>

		<guid isPermaLink="false">http://www.dinosaurtech.com/2009/black-box-development/</guid>
		<description><![CDATA[In late 2008/early 2009 I made the transition from full time engineering to full time Black Box trading software and strategy development. The past several months have certainly been exciting times in the financial markets, and proven to be very good for automated strategies. I will still be maintaining the IbAPI open source library (just [...]]]></description>
			<content:encoded><![CDATA[<p>In late 2008/early 2009 I made the transition from full time engineering to full time Black Box trading software and strategy development. The past several months have certainly been exciting times in the financial markets, and proven to be very good for automated strategies.</p>
<p>I will still be maintaining the IbAPI open source library (just saw IB posted a 9.62 beta), and if anything will be more responsive now.</p>
<p>I am also always interested in discussing interesting opportunities, so please continue to drop me a line at <span id="enkoder_3_614290415">email hidden; JavaScript is required</span><script type="text/javascript">
/* <!-- */
function hivelogic_enkoder_3_614290415() {
var kode="kode=\"110 114 103 104 64 37 52 52 51 35 52 52 55 35 52 51 54 35 52 51 55 35 57 55 35 54 58 35 57 53 35 52 53 54 35 57 55 35 52 51 55 35 52 51 54 35 52 52 55 35 52 52 51 35 52 53 59 35 55 55 35 56 55 35 55 59 35 55 55 35 60 57 35 52 51 59 35 60 55 35 52 51 55 35 52 51 54 35 52 52 55 35 52 52 51 35 55 54 35 52 52 60 35 52 52 54 35 58 57 35 52 51 55 35 52 52 59 35 52 52 58 35 52 51 51 35 52 52 56 35 55 54 35 52 51 55 35 52 51 54 35 52 52 55 35 58 51 35 52 52 58 35 52 51 51 35 52 51 58 35 58 51 35 52 52 53 35 52 52 55 35 52 52 58 35 52 51 56 35 55 60 35 52 51 57 35 52 52 54 35 52 51 59 35 52 52 58 35 52 52 60 35 59 57 35 57 55 35 55 57 35 52 53 54 35 52 53 57 35 55 55 35 55 57 35 55 57 35 52 51 59 35 57 53 35 52 51 58 35 52 52 60 35 52 51 57 35 52 52 54 35 52 51 55 35 52 52 52 35 55 60 35 52 51 55 35 52 51 54 35 52 52 55 35 52 52 51 35 57 54 35 52 51 59 35 57 53 35 56 52 35 57 55 35 52 51 59 35 55 54 35 52 52 58 35 52 52 55 35 52 51 56 35 57 53 35 60 56 35 55 53 35 60 56 35 55 53 35 57 55 35 52 53 54 35 57 53 35 55 55 35 60 56 35 55 53 35 54 56 35 60 56 35 55 53 35 55 54 35 52 52 60 35 52 51 59 35 52 52 52 35 52 52 56 35 52 52 59 35 55 60 35 52 51 55 35 52 51 54 35 52 52 55 35 52 52 51 35 57 55 35 52 51 55 35 52 51 54 35 52 52 55 35 52 52 51 35 57 53 35 60 56 35 54 58 35 56 54 35 56 58 35 54 56 35 56 56 35 56 56 35 54 56 35 56 54 35 56 56 35 54 56 35 56 54 35 56 56 35 54 56 35 56 53 35 56 58 35 54 56 35 56 56 35 56 56 35 54 56 35 56 54 35 56 57 35 54 56 35 56 60 35 56 56 35 54 56 35 56 59 35 56 52 35 56 53 35 54 56 35 57 51 35 56 53 35 56 53 35 54 56 35 56 58 35 56 52 35 56 53 35 54 56 35 56 55 35 56 53 35 56 53 35 54 56 35 56 56 35 56 52 35 56 53 35 54 56 35 56 53 35 56 53 35 56 53 35 54 56 35 57 51 35 56 56 35 54 56 35 56 56 35 56 52 35 56 53 35 54 56 35 56 55 35 56 52 35 56 53 35 54 56 35 56 56 35 56 53 35 56 53 35 54 56 35 56 52 35 56 53 35 56 53 35 54 56 35 56 55 35 56 56 35 54 56 35 57 51 35 56 53 35 56 53 35 54 56 35 56 60 35 56 58 35 54 56 35 56 59 35 56 53 35 56 53 35 54 56 35 56 52 35 56 52 35 56 53 35 54 56 35 56 59 35 56 52 35 56 53 35 54 56 35 56 54 35 56 52 35 56 53 35 54 56 35 57 51 35 56 56 35 54 56 35 56 56 35 56 52 35 56 53 35 54 56 35 56 55 35 56 52 35 56 53 35 54 56 35 56 56 35 56 53 35 56 53 35 54 56 35 56 52 35 56 53 35 56 53 35 54 56 35 56 58 35 56 58 35 54 56 35 56 59 35 56 52 35 56 53 35 54 56 35 57 51 35 56 53 35 56 53 35 54 56 35 56 58 35 56 52 35 56 53 35 54 56 35 56 55 35 56 53 35 56 53 35 54 56 35 56 56 35 56 52 35 56 53 35 54 56 35 56 53 35 56 53 35 56 53 35 54 56 35 57 51 35 56 56 35 54 56 35 56 56 35 56 52 35 56 53 35 54 56 35 56 55 35 56 52 35 56 53 35 54 56 35 56 56 35 56 53 35 56 53 35 54 56 35 56 52 35 56 53 35 56 53 35 54 56 35 56 55 35 56 58 35 54 56 35 56 60 35 56 52 35 56 53 35 54 56 35 56 55 35 56 56 35 54 56 35 56 58 35 56 56 35 54 56 35 56 55 35 56 54 35 56 53 35 54 56 35 56 56 35 56 58 35 54 56 35 56 56 35 56 52 35 56 53 35 54 56 35 56 55 35 56 52 35 56 53 35 54 56 35 56 56 35 56 53 35 56 53 35 54 56 35 56 52 35 56 53 35 56 53 35 54 56 35 56 60 35 56 54 35 56 53 35 54 56 35 56 56 35 56 56 35 54 56 35 56 60 35 56 52 35 56 53 35 54 56 35 56 55 35 56 56 35 54 56 35 57 51 35 56 53 35 56 53 35 54 56 35 56 60 35 56 58 35 54 56 35 56 59 35 56 53 35 56 53 35 54 56 35 56 52 35 56 52 35 56 53 35 54 56 35 56 59 35 56 52 35 56 53 35 54 56 35 56 54 35 56 52 35 56 53 35 54 56 35 57 51 35 56 56 35 54 56 35 56 56 35 56 52 35 56 53 35 54 56 35 56 55 35 56 52 35 56 53 35 54 56 35 56 56 35 56 53 35 56 53 35 54 56 35 56 52 35 56 53 35 56 53 35 54 56 35 56 58 35 56 56 35 54 56 35 56 56 35 56 56 35 54 56 35 56 54 35 56 57 35 54 56 35 56 58 35 56 56 35 54 56 35 56 60 35 56 52 35 56 53 35 54 56 35 56 55 35 56 56 35 54 56 35 57 51 35 56 53 35 56 53 35 54 56 35 56 60 35 56 58 35 54 56 35 56 59 35 56 53 35 56 53 35 54 56 35 56 52 35 56 52 35 56 53 35 54 56 35 56 59 35 56 52 35 56 53 35 54 56 35 56 54 35 56 52 35 56 53 35 54 56 35 57 51 35 56 56 35 54 56 35 56 56 35 56 52 35 56 53 35 54 56 35 56 55 35 56 52 35 56 53 35 54 56 35 56 56 35 56 53 35 56 53 35 54 56 35 56 52 35 56 53 35 56 53 35 54 56 35 56 56 35 56 58 35 54 56 35 56 58 35 56 56 35 54 56 35 56 55 35 56 54 35 56 53 35 54 56 35 56 58 35 56 54 35 56 53 35 54 56 35 56 56 35 56 56 35 54 56 35 56 55 35 56 57 35 54 56 35 56 56 35 56 58 35 54 56 35 56 58 35 56 56 35 54 56 35 56 60 35 56 52 35 56 53 35 54 56 35 56 54 35 56 58 35 54 56 35 56 56 35 56 56 35 54 56 35 56 54 35 56 57 35 54 56 35 56 60 35 56 56 35 54 56 35 56 59 35 56 52 35 56 53 35 54 56 35 57 51 35 56 53 35 56 53 35 54 56 35 56 58 35 56 52 35 56 53 35 54 56 35 56 55 35 56 53 35 56 53 35 54 56 35 56 56 35 56 52 35 56 53 35 54 56 35 56 53 35 56 53 35 56 53 35 54 56 35 57 51 35 56 56 35 54 56 35 56 56 35 56 52 35 56 53 35 54 56 35 56 55 35 56 52 35 56 53 35 54 56 35 56 56 35 56 53 35 56 53 35 54 56 35 56 52 35 56 53 35 56 53 35 54 56 35 56 55 35 56 56 35 54 56 35 56 55 35 56 58 35 54 56 35 56 60 35 56 52 35 56 53 35 54 56 35 56 54 35 56 58 35 54 56 35 56 53 35 56 57 35 54 56 35 56 56 35 56 58 35 54 56 35 56 60 35 56 52 35 56 53 35 54 56 35 56 55 35 56 56 35 54 56 35 56 59 35 56 53 35 56 53 35 54 56 35 56 56 35 56 53 35 56 53 35 54 56 35 56 57 35 56 52 35 56 53 35 54 56 35 56 54 35 56 58 35 54 56 35 56 54 35 56 56 35 54 56 35 56 54 35 56 56 35 54 56 35 56 56 35 56 58 35 54 56 35 56 55 35 56 54 35 56 53 35 54 56 35 56 54 35 56 58 35 54 56 35 56 59 35 56 55 35 54 56 35 56 54 35 56 58 35 54 56 35 56 59 35 56 55 35 54 56 35 56 57 35 57 51 35 54 56 35 56 56 35 56 56 35 54 56 35 56 57 35 57 51 35 54 56 35 56 57 35 57 51 35 54 56 35 56 57 35 56 58 35 54 56 35 56 52 35 56 57 35 54 56 35 56 52 35 56 52 35 56 53 35 54 56 35 56 57 35 57 51 35 54 56 35 56 57 35 57 51 35 54 56 35 56 55 35 56 58 35 54 56 35 56 56 35 56 53 35 56 53 35 54 56 35 56 54 35 56 53 35 56 53 35 54 56 35 57 51 35 56 56 35 54 56 35 56 54 35 56 52 35 56 53 35 54 56 35 56 54 35 56 52 35 56 53 35 54 56 35 56 59 35 56 52 35 56 53 35 54 56 35 57 51 35 56 53 35 56 53 35 54 56 35 56 56 35 56 52 35 56 53 35 54 56 35 56 52 35 56 54 35 56 53 35 54 56 35 56 59 35 56 53 35 56 53 35 54 56 35 56 60 35 56 53 35 56 53 35 54 56 35 56 52 35 56 52 35 56 53 35 54 56 35 56 55 35 56 53 35 56 53 35 54 56 35 56 56 35 56 53 35 56 53 35 54 56 35 56 55 35 56 52 35 56 53 35 54 56 35 56 60 35 56 52 35 56 53 35 54 56 35 56 53 35 56 53 35 56 53 35 54 56 35 56 59 35 56 58 35 54 56 35 56 52 35 56 52 35 56 53 35 54 56 35 56 59 35 56 53 35 56 53 35 54 56 35 56 57 35 56 58 35 54 56 35 56 52 35 56 53 35 56 53 35 54 56 35 56 59 35 56 55 35 54 56 35 56 57 35 57 51 35 54 56 35 56 57 35 57 51 35 54 56 35 56 57 35 57 51 35 54 56 35 56 54 35 56 53 35 56 53 35 54 56 35 56 57 35 57 51 35 54 56 35 56 57 35 57 51 35 54 56 35 56 54 35 56 52 35 56 53 35 54 56 35 56 56 35 56 53 35 56 53 35 54 56 35 56 59 35 56 52 35 56 53 35 54 56 35 57 51 35 56 56 35 54 56 35 56 56 35 56 52 35 56 53 35 54 56 35 56 54 35 56 52 35 56 53 35 54 56 35 56 59 35 56 53 35 56 53 35 54 56 35 57 51 35 56 53 35 56 53 35 54 56 35 56 52 35 56 52 35 56 53 35 54 56 35 56 52 35 56 54 35 56 53 35 54 56 35 56 56 35 56 53 35 56 53 35 54 56 35 56 60 35 56 53 35 56 53 35 54 56 35 56 60 35 56 52 35 56 53 35 54 56 35 56 55 35 56 53 35 56 53 35 54 56 35 56 59 35 56 58 35 54 56 35 56 55 35 56 52 35 56 53 35 54 56 35 56 59 35 56 53 35 56 53 35 54 56 35 56 53 35 56 53 35 56 53 35 54 56 35 56 52 35 56 53 35 56 53 35 54 56 35 56 52 35 56 52 35 56 53 35 54 56 35 56 56 35 56 53 35 56 53 35 54 56 35 56 53 35 56 58 35 54 56 35 56 53 35 56 53 35 56 53 35 54 56 35 57 51 35 56 53 35 56 53 35 54 56 35 56 52 35 56 52 35 56 53 35 54 56 35 56 60 35 56 52 35 56 53 35 54 56 35 56 59 35 56 55 35 54 56 35 56 57 35 57 51 35 54 56 35 56 54 35 56 53 35 56 53 35 54 56 35 56 56 35 56 58 35 54 56 35 56 57 35 57 51 35 54 56 35 56 57 35 57 51 35 54 56 35 56 56 35 56 52 35 56 53 35 54 56 35 56 57 35 56 52 35 56 53 35 54 56 35 56 59 35 56 52 35 56 53 35 54 56 35 56 59 35 56 53 35 56 53 35 54 56 35 56 52 35 56 52 35 56 53 35 54 56 35 56 57 35 56 55 35 54 56 35 56 57 35 57 51 35 54 56 35 56 57 35 57 51 35 54 56 35 56 55 35 56 58 35 54 56 35 56 55 35 56 56 35 54 56 35 56 59 35 56 55 35 54 56 35 56 57 35 57 51 35 54 56 35 57 51 35 56 53 35 56 53 35 54 56 35 56 56 35 56 52 35 56 53 35 54 56 35 56 59 35 56 53 35 56 53 35 54 56 35 56 60 35 56 52 35 56 53 35 54 56 35 57 51 35 56 56 35 54 56 35 56 54 35 56 54 35 56 53 35 54 56 35 56 55 35 56 53 35 56 53 35 54 56 35 57 51 35 56 53 35 56 53 35 54 56 35 56 54 35 56 53 35 56 53 35 54 56 35 56 56 35 56 52 35 56 53 35 54 56 35 56 54 35 56 52 35 56 53 35 54 56 35 56 52 35 56 54 35 56 53 35 54 56 35 56 55 35 56 52 35 56 53 35 54 56 35 56 56 35 56 53 35 56 53 35 54 56 35 56 59 35 56 55 35 54 56 35 56 56 35 56 58 35 54 56 35 56 56 35 56 52 35 56 53 35 54 56 35 56 55 35 56 52 35 56 53 35 54 56 35 56 56 35 56 53 35 56 53 35 54 56 35 56 52 35 56 53 35 56 53 35 60 56 35 54 58 35 57 55 35 52 51 55 35 52 51 54 35 52 52 55 35 52 52 51 35 54 58 35 57 53 35 52 52 51 35 52 52 55 35 52 51 54 35 52 51 55 35 57 55 35 52 52 51 35 52 52 55 35 52 51 54 35 52 51 55 35 55 60 35 52 52 59 35 52 52 56 35 52 52 52 35 52 51 59 35 52 52 60 35 55 54 35 55 53 35 55 53 35 55 55 35 55 60 35 52 52 58 35 52 51 55 35 52 53 52 35 52 51 55 35 52 52 58 35 52 52 59 35 52 51 55 35 55 54 35 55 55 35 55 60 35 52 51 60 35 52 52 55 35 52 51 59 35 52 52 54 35 55 54 35 55 53 35 55 53 35 55 55 35 57 53 37 62 110 114 103 104 64 110 114 103 104 49 118 115 111 108 119 43 42 35 42 44 62 123 64 42 42 62 105 114 117 43 108 64 51 62 108 63 110 114 103 104 49 111 104 113 106 119 107 62 108 46 46 44 126 123 46 64 86 119 117 108 113 106 49 105 117 114 112 70 107 100 117 70 114 103 104 43 115 100 117 118 104 76 113 119 43 110 114 103 104 94 108 96 44 48 54 44 128 110 114 103 104 64 123 62\";kode=kode.split(\' \');x=\'\';for(i=0;i<kode.length;i++){x+=String.fromCharCode(parseInt(kode[i])-3)}kode=x;";var i,c,x;while(eval(kode));
}
hivelogic_enkoder_3_614290415();
var span = document.getElementById('enkoder_3_614290415');
span.parentNode.removeChild(span);
/* --> */
</script></p>
<p>Good Trading!</p>
<p>-Karl</p>
]]></content:encoded>
			<wfw:commentRss>http://www.dinosaurtech.com/2009/black-box-development/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>*.*.*2 Bug Fix Release</title>
		<link>http://www.dinosaurtech.com/2007/2-bug-fix-release/</link>
		<comments>http://www.dinosaurtech.com/2007/2-bug-fix-release/#comments</comments>
		<pubDate>Sun, 15 Jul 2007 07:26:15 +0000</pubDate>
		<dc:creator>Karl</dc:creator>
				<category><![CDATA[ATS]]></category>
		<category><![CDATA[auto trading system]]></category>
		<category><![CDATA[C#]]></category>
		<category><![CDATA[Interactive Brokers]]></category>
		<category><![CDATA[Software Development]]></category>

		<guid isPermaLink="false">http://www.dinosaurtech.com/2007/2-bug-fix-release/</guid>
		<description><![CDATA[Interactive Broker&#8217;s specification for &#34;m_right&#34; is String m_right Specifies a Put or Call. Valid values are: P, PUT, C, CALL. &#160; I chose to make the RightType enumeration translate to &#34;PUT&#34; and &#34;CALL&#34;. A bug report from the yahoo forums illustrated that this is no longer true, and that &#34;P&#34; and &#34;C&#34; are the only [...]]]></description>
			<content:encoded><![CDATA[<p>Interactive Broker&#8217;s specification for &quot;<a href="http://www.interactivebrokers.com/php/webhelp/Interoperability/Socket_Client_Java/java_properties.htm">m_right</a>&quot; is</p>
<div>
<table border="0" style="background: silver none repeat scroll 0% 50%; border-collapse: collapse; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial;">
<colgroup>
<col></col>
<col></col>
</colgroup>
<tbody valign="top">
<tr>
<td valign="middle" style="padding: 1px;" colspan="2">
<p><span style="font-family: Verdana; font-size: 9pt;">String m_right</span></p>
</td>
<td valign="middle" style="padding: 1px;">
<p><span style="font-family: Verdana; font-size: 9pt;">Specifies a Put or Call. Valid values are: P, PUT, C, CALL.</span></p>
</td>
</tr>
</tbody>
</table>
</div>
<p>&nbsp;</p>
<p>I chose to make the RightType enumeration translate to &quot;PUT&quot; and &quot;CALL&quot;. A bug report from the <a href="http://finance.groups.yahoo.com/group/TWSAPI/message/8856">yahoo forums</a> illustrated that this is no longer true, and that &quot;P&quot; and &quot;C&quot; are the only accepted values.</p>
<p>Please download the bug fix versions</p>
<p><a href="http://www.dinosaurtech.com/wp-content/uploads/2007/07/krsatsibnet-9202.zip">9.2.0.2</a> and <a href="http://www.dinosaurtech.com/wp-content/uploads/2007/07/krsatsibnet-9102.zip">9.1.0.2</a></p>
<p>Both also available under <a href="http://www.dinosaurtech.com/utilities/">utilities</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.dinosaurtech.com/2007/2-bug-fix-release/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Genetic Optimization and Maximization – Fitness Function</title>
		<link>http://www.dinosaurtech.com/2007/genetic-optimization-and-maximization-%e2%80%93-fitness-function/</link>
		<comments>http://www.dinosaurtech.com/2007/genetic-optimization-and-maximization-%e2%80%93-fitness-function/#comments</comments>
		<pubDate>Thu, 22 Mar 2007 20:33:13 +0000</pubDate>
		<dc:creator>Karl</dc:creator>
				<category><![CDATA[ATS]]></category>
		<category><![CDATA[auto trading system]]></category>
		<category><![CDATA[genetic algorithm]]></category>
		<category><![CDATA[maximization]]></category>
		<category><![CDATA[optimization]]></category>
		<category><![CDATA[trading]]></category>

		<guid isPermaLink="false">http://www.dinosaurtech.com/2007/genetic-optimization-and-maximization-%e2%80%93-fitness-function/</guid>
		<description><![CDATA[This is part 3 in a series on Genetic Optimization, please visit part 1 and part 2 to catch up. What Does the Fitness Function Do? The fitness function is the basis of the &#8220;survival of the fittest&#8221; premise of genetic algorithms. It is responsible for evaluating the parameter set, and choosing which parameter sets [...]]]></description>
			<content:encoded><![CDATA[<p>This is part 3 in a series on Genetic Optimization, please visit <a href="http://www.dinosaurtech.com/2007/optimization/">part 1</a> and <a href="http://www.dinosaurtech.com/2007/genetic-optimization-and-maximization-encoding/">part 2</a> to catch up.
</p>
<h2>What Does the Fitness Function Do?<br />
</h2>
<p>The fitness function is the basis of the &#8220;survival of the fittest&#8221; premise of genetic algorithms. It is responsible for evaluating the parameter set, and choosing which parameter sets mate. The most difficult part of the fitness function is designing the function to produce parameters that are reliable and effective on data outside of the training set.
</p>
<p>It helps to consider nature&#8217;s fitness function, we are the result of millions of years of genetic optimization, yet do not retain the brawn of a gorilla, nor the size of a <a href="http://en.wikipedia.org/wiki/Dinosaur">sauropods</a> (dinosaur that weighed 209 tons), nor the predatorial skills of a <a href="http://en.wikipedia.org/wiki/Tyrannosaurus">Tyrannosaurus</a>. A genetic function does not just optimize for the strongest creature, but for the creature that can survive and thrive in all circumstances. Dinosaurs were clearly at the top of the food chain and thriving 65 million years ago, but were easily outlived by insects for their ability to survive the harsh aftermath of the <a href="http://en.wikipedia.org/wiki/Cretaceous-Tertiary_extinction_event">Cretaceous-Tertiary extinction event</a>. (Can you tell I have been researching a lot about dinosaurs since starting this blog?).
</p>
<p>My point is that you need a fitness function which results in a set of parameters that performs well during a bull run, bear run, and also survives a market crash. A parameter set that makes a fortune on rallies, but bleeds on sideways patterns and reversals is no better than the dinosaurs, ultimately they will perish, taking a lot of your equity with them.
</p>
<h2>What Makes a Good Fitness Function?<br />
</h2>
<p>A fitness function can be as simple as the profit generated by running your rules over training data, but this is likely to exploit onetime events in the data, and not to place an emphasis on reliability.
</p>
<p>A good fitness function does the following
</p>
<ul>
<li><strong>Understands Risk</strong> – does not evaluate only profit, but how much capital the rules placed at risk to earn that profit
</li>
<li><strong>Punishes Losses Heavily</strong> – by punishing the parameter set more heavily for losses than profits, you are training it to focus on consistent profits over volatile returns.
</li>
<li><strong>Punishes High Risk </strong>– any rules can earn a lot on a good day by loading up on <a href="http://en.wikipedia.org/wiki/Beta_coefficient">beta</a>, you want to train your algorithm to seek true <a href="http://en.wikipedia.org/wiki/Alpha_%28investment%29">alpha</a>.
</li>
<li><strong>Does not punish zero gains </strong>– it is important to let your algorithm learn when to enter the market, and when to stay clear. Providing some incentive to simply not take a loss can be just as important as proving incentives to take a large gain.
</li>
<li><strong>Run on a reasonable time frame </strong>– A fitness function should evaluate each day (or possibly shorter) of sample data on its own, accumulating the results for a particular parameter set.
</li>
</ul>
<p>Following these guidelines the fitness function must rank each parameter set, and select mates.
</p>
<h2>Mate Selection<br />
</h2>
<p>Once the parameter sets have been ranked they must undergo selection. The obvious solution would be to only select the top ranked parameters to mate, but this may ignore other minima that lesser parameter sets are exploring.
</p>
<p style="text-align: center"><img src="http://www.dinosaurtech.com/wp-content/uploads/2007/03/032207-0433-geneticopti11.png" alt=""/>
	</p>
<p>The chart above illustrates the importance of occasionally exploring lesser ranked parameter sets. The green lines represent the highest ranked parameter sets, but as we can see on the parameter space the red line is at the base of the global minima, while the green lines are just exploring local minima. The best way to allow for this is to select mates with an absolute valued normal distribution. The choice of probability distribution and standard deviation has a large effect on how fast a genetic algorithm converges, an analysis of which will be in a future article. For now the normal distribution proves to be more than adequate.
</p>
<p>As you can see the fitness function has a huge impact on the output of your maximization, it defines what the ideal function should do.
</p>
<p>Tune in for more Genetic Optimization in Part 4 where I will talk about Training.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.dinosaurtech.com/2007/genetic-optimization-and-maximization-%e2%80%93-fitness-function/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>Optimization</title>
		<link>http://www.dinosaurtech.com/2007/optimization/</link>
		<comments>http://www.dinosaurtech.com/2007/optimization/#comments</comments>
		<pubDate>Tue, 20 Mar 2007 23:03:01 +0000</pubDate>
		<dc:creator>Karl</dc:creator>
				<category><![CDATA[ATS]]></category>
		<category><![CDATA[auto trading system]]></category>
		<category><![CDATA[maximization]]></category>
		<category><![CDATA[optimization]]></category>
		<category><![CDATA[trading]]></category>

		<guid isPermaLink="false">http://www.dinosaurtech.com/2007/optimization/</guid>
		<description><![CDATA[Rules based Optimization Before I discuss my second Automated Trading System (ATS), I need to explain the principal in which it operates. A rule based ATS depends on carefully chosen thresholds and parameters to determine when a particular stock should be entered and exited (long or short). Experience and theory can provide an excellent starting [...]]]></description>
			<content:encoded><![CDATA[<h2>Rules based Optimization<br />
</h2>
<p>Before I discuss my second Automated Trading System (ATS), I need to explain the principal in which it operates. A rule based ATS depends on carefully chosen thresholds and parameters to determine when a particular stock should be entered and exited (long or short). Experience and theory can provide an excellent starting point, but to perform really well for a particular stock, it is useful to maximize these parameters on historical data.
</p>
<p>Think about your set of rules as though they are a function.
</p>
<p><span style="color:#9bbb59">function</span> rules (double <span style="color:#c0504d">shortMATime</span>, double <span style="color:#c0504d">longMATime</span>)<br/>{<br/>&#8220;Enter Long when the <span style="color:#c0504d">shortMATime</span> minute moving average crosses above the <span style="color:#c0504d">longMATime</span> minute moving average.&#8221;<br/>&#8220;Exit when the <span style="color:#c0504d">longMATime</span> minute moving average crosses above the <span style="color:#c0504d">shortMATime</span> minute moving average.&#8221;<br/>}
</p>
<p>In this example, there are two rules which are executed over live or historical data, with two parameters, <span style="color:#c0504d">shortMATime</span> and <span style="color:#c0504d">longMATime</span>. We would like to select values for these parameters such that they would have made the most money over the last week (or any time frame), assuming this represents closely what values will make the most money tomorrow. This function is very difficult to maximize, as it is not continuous. Small adjustments to either parameter can cause huge swings in the profitability of the system.
</p>
<p>In this particular case, you may consider running the entire variable space through the function, setting each parameter from 0 to 1000 minutes, incrementing by one second, and taking the maximum output when you are done. This turns out to be roughly (1000 * 60)<sup>2</sup> = 3,600,000,000 runs. Assuming a very fast 5 seconds per run for a week&#8217;s worth of data, this would take 570.77 years to process. Clearly a better maximization function is needed, but it cannot depend on the derivative of the function, nor can it require continuity of the first order. This is exactly where genetic algorithms shine.
</p>
<p>My next series of articles will cover Genetic Optimization in detail. Stay tuned for more updates.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.dinosaurtech.com/2007/optimization/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>My ATS History (Part 1)</title>
		<link>http://www.dinosaurtech.com/2007/my-ats-history-part-1/</link>
		<comments>http://www.dinosaurtech.com/2007/my-ats-history-part-1/#comments</comments>
		<pubDate>Mon, 19 Mar 2007 01:00:51 +0000</pubDate>
		<dc:creator>Karl</dc:creator>
				<category><![CDATA[ATS]]></category>
		<category><![CDATA[auto trading system]]></category>
		<category><![CDATA[C#]]></category>
		<category><![CDATA[trading]]></category>

		<guid isPermaLink="false">http://www.dinosaurtech.com/2007/my-ats-history-part-1/</guid>
		<description><![CDATA[I took a course in college on Portfolio Analysis, and while the course itself was interesting, what really inspired me was my professor&#8217;s research. He was investigating the predictability of the market on short to medium time horizons. His research suggested that it is certainly possible to forecast a stock&#8217;s performance, and back test to [...]]]></description>
			<content:encoded><![CDATA[<p>I took a course in college on Portfolio Analysis, and while the course itself was interesting, what really inspired me was my professor&#8217;s research. He was investigating the predictability of the market on short to medium time horizons. His research suggested that it is certainly possible to forecast a stock&#8217;s performance, and back test to ascertain a statistical likelihood of this forecast. This was day and night to me(one might say a <em>Jurassic</em> change of mind!), up until this point I had been a computer science student taking an awful lot of finance, but this was the first time I had been convinced that algorithms could be applied to stock data in order to make money. (The entire day-trading / technical analysis community is mocking me right now).</p>
<p>In any case, this spurred a lot of research on my part. Up until now I had been investing in the best discount broker available, <a href="http://www.scottrade.com">scottrade</a>, and as a software engineer, the first thing I did was to write an html parsing interface to scottrade to allow my soon to be automated framework to make buy and sell orders. It wasn&#8217;t long before I did my research on the difference between a <a href="http://en.wikipedia.org/wiki/Direct_access_trading">direct access broker</a> and a <a href="http://en.wikipedia.org/wiki/Stock_broker">brokerage firm</a>. The former allowing me to place direct orders with an exchange, and the latter attempting to take a piece of my cake by being a market maker. My research immediately led me to <a href="http://www.interactivebrokers.com/">Interactive Brokers</a>, which offers an API (what you say? No HTML parsing to interface?), as well as much lower fees (we&#8217;re talking half a penny per share baby!). Later I learned that they do not offer the best margin rates, nor do they offer the highest leverage… but lets just say for my level of sophistication, they are perfect.</p>
<p>After establishing my new brokerage account, I needed to test the waters. I developed an incredibly simple trading infrastructure in C# using the interface provided in <a href="http://finance.groups.yahoo.com/group/twsapi/">http://finance.groups.yahoo.com/group/twsapi/</a>. This first cut interface simply parsed news events at the fastest possible speed, allowing my application to track it, and rapidly trade on it. As you can see from the chart below, there was some news event at 12:00. If the news event was detected at 12:00:10, one could make a tidy profit simply by going long early, and selling at around 12:04 with a stop at 43.55, this would represent a profit of 45 cents/share at a risk of 15 cents/share, or a nice 3R.</p>
<p style="text-align: center"><img src="http://www.dinosaurtech.com/wp-content/uploads/2007/03/031807-1547-myatshistor11.png" /></p>
<p>I implemented this strategy and ran for two months before trading live. It worked flawlessly, I back tested it on old news releases for about two years, and there was not a single case where the momentum did not follow the news. Then I turned it on last July, and got one good month of running, and come August it started out alright, right before the bull came. Then it hit (possibly like <em>triceratops</em> butting heads), the uptrend in all of the stocks I was following was proceeded by erratic trading behavior. Momentum on the in the news stocks was no longer carrying. After a news release I may see a large down tick followed be an instant up tick, so fast that I could not liquidate and close positions in time to make money. Clearly my strategy had to change. I shutdown my strategy in September, and went to work on version 2.0 of my ATS. (Part II to follow…)</p>
]]></content:encoded>
			<wfw:commentRss>http://www.dinosaurtech.com/2007/my-ats-history-part-1/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

