<?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; CSI</title>
	<atom:link href="http://www.automated-trading-system.com/tag/csi/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>Mon, 23 Jan 2012 11:58:45 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>Trade what you Test and Test what you Trade</title>
		<link>http://www.automated-trading-system.com/trade-what-you-test-and-test-what-you-trade/</link>
		<comments>http://www.automated-trading-system.com/trade-what-you-test-and-test-what-you-trade/#comments</comments>
		<pubDate>Thu, 20 Jan 2011 14:17:28 +0000</pubDate>
		<dc:creator>Jez Liberty</dc:creator>
				<category><![CDATA[Backtest]]></category>
		<category><![CDATA[Data]]></category>
		<category><![CDATA[CSI]]></category>
		<category><![CDATA[rollover]]></category>

		<guid isPermaLink="false">http://www.automated-trading-system.com/?p=3848</guid>
		<description><![CDATA[In order to avoid bad surprises in live trading, the maxim forming this post title should apply to as much of a trading system as possible. The goal is to ensure back-testing results are as realistic as they can. Input data is one component of a trading system and the area this post focuses on, [...]]]></description>
			<content:encoded><![CDATA[<p><img src="http://www.automated-trading-system.com/wp-content/uploads/2011/01/test-trade.jpg" alt="test-trade" title="test-trade" width="470" height="170" class="alignnone size-full wp-image-3849" /></p>
<p>In order to avoid bad surprises in live trading, the maxim forming this post title should apply to as much of a trading system as possible. The goal is to ensure <strong>back-testing results are as realistic</strong> as they can.</p>
<p><strong>Input data</strong> is one component of a trading system and the area this post focuses on, more specifically <strong>roll-over methodologies for futures contracts</strong>.</p>
<h3>Real Monthly Trading Also Means Monthly Roll-Over</h3>
<p>One of the triggers for this post was a comment on the <a href="http://www.automated-trading-system.com/trade-monthly-basis/">Monthly Trading post</a> with regards to the futures data used for the test. In order to have comparable results between the daily and monthly instances of the systems tested, I simply and mechanically reused the same portfolio of instruments&#8230;</p>
<p>However, futures contracts in the portfolio <strong>roll on Open Interest</strong>. What this practically means, is that a trader using this methodology would have to monitor OI every day to decide whether to roll to another contract. <em>Not much of a monthly process.</em></p>
<p>I still think that test had some value, but it is important to realise that the monthly instance in that test was not representative of a pure monthly process. Instead we were actually simulating a trading strategy with <strong>monthly signal taking</strong> but <strong>daily roll-over</strong> monitoring process.</p>
<p>It highlights the fact that it is important to understand what the data used for testing actually represents, and to roll futures contract data in the same way as they are rolled in real-life.</p>
<p>This post is a good opportunity to revisit the concepts of generating continuous futures data and some of the older posts I had written on the subject using CSI (<a href="http://www.automated-trading-system.com/what-everybody-ought-to-know-about-continous-futures-contracts/">here</a> and <a href="http://www.automated-trading-system.com/continuous-contract-options/">here</a>).<span id="more-3848"></span></p>
<h3>ETF: Outsource your Contract Rolling Process</h3>
<p>Another reason why I think that the monthly trading test has some value is because the individual monthly trader might decide to <strong>trade ETFs instead of futures</strong>.</p>
<p>ETFs can be seen as simple wrappers of futures contracts: they trade continuously and their managers take care of rolling their underlying positions with a predefined methodology and timing, charging you a fee in the process.</p>
<p>Of course, this is not futures Trend Following any more, and using ETFs lacks the inherent leverage embedded in futures instruments. But it is possible to obtain decent performance with Trend Following on ETFs (check <a href="http://www.automated-trading-system.com/practical-guide-to-etf-trading-systems-garner/">this ETF Trading book</a> by Anthony Garner for example). An assumption in that book (which I will attempt to verify in a next post) is that <strong>futures can act as proxies for ETFs/ETCs</strong>.</p>
<h3>Contract Rolling and Testing</h3>
<p>Rolling contracts is a process necessary to generate a continuous time-series for back-testing futures instruments. There are many different ways to perform this operation (some of which are covered just below). What is important is that <strong>the continuous contract should be a realistic representation of one&#8217;s trading</strong>.</p>
<h3>Proportional vs Point-Based Adjustments</h3>
<p>At the time of writing these posts on continuous contracts, I was leaning towards the idea that proportional adjustment was the way to go:</p>
<p>&#8220;<em>This ensures a constant relative (percentage-wise) relationship between any prices across the trading history</em>&#8220;, as opposed to the point-based adjustment, with which &#8220;<em>you lose relative price difference (shifting all prices by an absolute amount has that effect on percentage changes: 10 to 11 is +10% but add 100 to both for an extreme case and 110 to 111 becomes less than +1%)</em>&#8220;.</p>
<p>When back-testing with <strong>Trading Blox</strong>, the standard functionality expects the prices to be <strong>point-based adjusted</strong>, to calculate trade PnL:<br />
(ExitPrice &#8211; EntryPrice) * BigPointValue * NumberContracts<br />
With a point-based adjustment, the number of points between entry and exit will represent the actual points the market has moved during the life of the trade, as opposed to proportional adjustment (which would give wrong PnL calculations).</p>
<p>But point-based adjustments prevents us from using relative price difference, such as &#8220;check if close today is 5% higher than close yesterday&#8221; as an example. This might be an issue for some systems, but there are workarounds for this in Trading Blox though.</p>
<p>We do not <em>have to</em> limit ourselves to one or the other  methodology, but we have to understand what the rolling algorithm represents and which data best suit each test.</p>
<p>Of course, you can even go with a more fancy approach to rolling (if this represents what your trading is), like one we had covered here last year with a <a href="http://www.automated-trading-system.com/better-trend-following-improved-roll-yield/">rolling methodology attempting to optimize roll yield</a>.</p>
<h3>Back-Adjusted or Forward-Adjusted?</h3>
<p>Another switch on the rolling methodology dashboard (in CSI) is the possibility to perform <strong>back-adjustments or forward adjustments</strong>. This only determines which price is fixed and in which direction the &#8220;adjustment drift&#8221; will propagate through the time-series. Forward-adjustment picks the earliest price as the reference price and moves each following contract by the required adjustment amount/ratio to fill the &#8220;rolling gap&#8221;. Backward-adjustment is the opposite: reference price is last price and adjustment propagates backward.</p>
<p>In order to get recent prices in line with real price levels, most traders prefer back-adjustment. From a back-testing point of view, it should not have <em>much</em> impact. However, the chart time-series will look quite different.</p>
<p>To illustrate this, here is an example chart plotting the same underlying (Crude Oil) since 2007, with four different standard CSI rolling methodologies:</p>
<ul>
<li>Proportional, Forward Adjustment</li>
<li>Proportional, Backward Adjustment</li>
<li>Point-based, Forward Adjustment</li>
<li>Point-based, Backward Adjustment</li>
</ul>
<div id="attachment_3850" class="wp-caption alignnone" style="width: 480px"><img src="http://www.automated-trading-system.com/wp-content/uploads/2011/01/rolled-contracts.png" alt="Mix of Point and Proportional, Back and Forward Adjustments" title="rolled-contracts" width="470" height="380" class="size-full wp-image-3850" /><p class="wp-caption-text">Mix of Point and Proportional, Back and Forward Adjustments</p></div>
<p>Going back to the monthly trading test, I did take my data &#8220;for granted&#8221; as it works for most cases&#8230; but not really for this one. It does emphasise the point that &#8220;Trade what you Test and Test what you Trade&#8221; should also apply to data and rolling methodologies, which need to be checked/reviewed for each new system.<br />
&nbsp;<br />
&nbsp;</p>
<div style="font-size: 0.8em;">Credits: thanks to Pumpernickel for the comment pointing out the discrepancy in the previous post between daily roll-over and monthly signal taking (and for this post title contribution, as part of a comment on an earlier post).<br />
Picture Credits: Trading Blox screenshot and artemuestra@flickr(CC).</div>
]]></content:encoded>
			<wfw:commentRss>http://www.automated-trading-system.com/trade-what-you-test-and-test-what-you-trade/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>CSI &#8211; Au.Tra.Sy: A new Partnership for 2011</title>
		<link>http://www.automated-trading-system.com/csi-discount-coupon-code/</link>
		<comments>http://www.automated-trading-system.com/csi-discount-coupon-code/#comments</comments>
		<pubDate>Fri, 07 Jan 2011 08:27:45 +0000</pubDate>
		<dc:creator>Jez Liberty</dc:creator>
				<category><![CDATA[Data]]></category>
		<category><![CDATA[CSI]]></category>

		<guid isPermaLink="false">http://www.automated-trading-system.com/?p=3766</guid>
		<description><![CDATA[Just a quick note to let you know that CSI and Au.Tra.Sy have partnered to offer the readers of the blog a 10% discount on new subscriptions to CSI data and their software Unfair Advantage. Simply go to their order page and make sure to enter the coupon code LIBERTY. I use CSI as my [...]]]></description>
			<content:encoded><![CDATA[<p>Just a quick note to let you know that CSI and Au.Tra.Sy have partnered to offer the readers of the blog a <strong>10% discount</strong> on new subscriptions to CSI data and their software Unfair Advantage. Simply go to their <a href="http://www.automated-trading-system.com/csi" target="_blank" rel="nofollow">order page</a> and make sure to enter the <strong>coupon code LIBERTY</strong>.</p>
<p>I use CSI as my main source of data, including for all the research published on the blog and I have no problems recommending them.</p>
<p>So, when they approached me with a proposition for a &#8220;partnership&#8221;, which could also benefit the blog readers, I did not really hesitate.</p>
<p>I hope some of you can benefit from this offer &#8211; and unlike the January sale, it will be there all year.</p>
<p>Disclaimer (in the interest of transparency): any reader signing up to CSI using the coupon code would result in an affiliate commission &#8211; on top of your discount. A win-win proposition in a way. Note that I am a paying CSI customer and have been enjoying their data services for 2 years now (I use the Gold World Futures package and am about to get the Gold Stocks package).</p>
<p>For more info on CSI, please find below is a list of posts I ran a while ago on CSI data, their API, etc.:</p>
<ul>
<li><a href="http://www.automated-trading-system.com/unfair-advantage-csi/">I just got myself an Unfair Advantage&#8230;</a></li>
<li><a href="http://www.automated-trading-system.com/continuous-contract-options/">Continuous Contract options</a></li>
<li><a href="http://www.automated-trading-system.com/unfair-advantage-api-retrieve-back-adjusted-contracts-function/">Unfair Advantage API: Retrieve Back-Adjusted Contracts function</a></li>
<li><a href="http://www.automated-trading-system.com/unfair-advantage-api-code-c-extract-futures-continuous-data/">Unfair Advantage API Code (C#): Extract Futures Continuous data</a></li>
<li><a href="http://www.automated-trading-system.com/csi-raw-contract-data-extractor/">CSI Raw Contract Data Extractor</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://www.automated-trading-system.com/csi-discount-coupon-code/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>CSI Raw Contract Data Extractor</title>
		<link>http://www.automated-trading-system.com/csi-raw-contract-data-extractor/</link>
		<comments>http://www.automated-trading-system.com/csi-raw-contract-data-extractor/#comments</comments>
		<pubDate>Thu, 10 Jun 2010 09:34:38 +0000</pubDate>
		<dc:creator>Jez Liberty</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[Data]]></category>
		<category><![CDATA[API]]></category>
		<category><![CDATA[CSI]]></category>
		<category><![CDATA[Unfair Advantage]]></category>

		<guid isPermaLink="false">http://www.automated-trading-system.com/?p=2374</guid>
		<description><![CDATA[I have mentioned before that I use CSI as my main provider for Futures data. Overall, I judge CSI&#8217;s service as good quality &#8211; however one drawback is the closed aspect of the data access. And I decided to write a utility to make it more &#8220;open&#8221;. To access the historical data, you have to [...]]]></description>
			<content:encoded><![CDATA[<div id="attachment_2376" class="wp-caption alignnone" style="width: 428px"><img src="http://www.automated-trading-system.com/wp-content/uploads/2010/06/CSIExtractor.png" alt="CSI Data Extractor: Utility tool to extract CSI data in plain text files" title="CSIExtractor" width="418" height="241" class="size-full wp-image-2376" /><p class="wp-caption-text">CSI Data Extractor: Utility tool to extract CSI data in plain text files</p></div>
<p>I have mentioned <a href="http://www.automated-trading-system.com/unfair-advantage-csi/">before</a> that I use CSI as my main provider for Futures data. Overall, I judge CSI&#8217;s service as good quality &#8211; however one drawback is the <em>closed</em> aspect of the data access. And I decided to write a utility to make it more &#8220;open&#8221;.</p>
<p>To access the historical data, you have to go through their software (Unfair Advantage), which extracts and decrypts it from their proprietary binary format. You can always &#8220;build&#8221; historical files to disk, but these are usually pre-processed with a special algorithm (ie. back-adjusted, etc.).</p>
<p>What more, if you decide to stop your subscription to CSI&#8217;s data services, you will not be able to access any data any more, even historical data downloaded under the subscription contract.</p>
<p>For some of the reasons above, it might be interesting to be able to extract/store CSI&#8217;s <em>raw data</em> in plain text files. This would allow for:</p>
<ul>
<li>Browsing the data outside of the CSI&#8217;s Unfair Advantage software</li>
<li>Applying back-adjustment or other manipulation algorithms not supported by CSI&#8217;s UA (such as calculating the <a href="http://www.automated-trading-system.com/crude-oil-contango-and-roll-yield-for-commodity-trading/">yield curve</a>)</li>
<li>Keep the historical data independently of your CSI subscription</li>
</ul>
<p><span id="more-2374"></span></p>
<p>Note: what I consider CSI raw data is the actual daily information for each contract traded on any day. For example, in the Corn market, there are currently 15 different contracts trading (with different maturities), each with their own Open, High, Low, Close, Volume and Open Interest.</p>
<h3>CSI API to the rescue</h3>
<p>Now, you could easily go to Unfair Advantage and pick every single historical contract that you want to extract&#8230; but this would be a fairly tedious job</p>
<p>Luckily for us, the API allows for programmatic access to CSI&#8217;s data to automate the process of extracting all contracts that we want &#8211; so I decided to write a little utility to do just that.  And now my data is really mine!</p>
<p>Below is a zip file containing the files to copy to &#8220;install&#8221; the utility:</p>
<p><a href='http://www.automated-trading-system.com/wp-content/uploads/2010/06/CSI-DataExtractor.zip'>CSI-DataExtractor.zip</a></p>
<p>Note that you need to have Unfair Advantage installed on the machine running this exe (which does not come with any guarantee by the way&#8230; but I have been using it fine so far).</p>
<p>The operation is very simple: just enter CSI&#8217;s number for the market you want to extract and choose which path the files need to be extracted to.</p>
<p>Hope you&#8217;re finding this tool useful&#8230;</p>
<p><strong>Note</strong>: You can receive a <a href="http://www.automated-trading-system.com/csi" target="_blank" rel="nofollow">10% discount on CSI data subscriptions</a> (use coupon code LIBERTY)</p>
]]></content:encoded>
			<wfw:commentRss>http://www.automated-trading-system.com/csi-raw-contract-data-extractor/feed/</wfw:commentRss>
		<slash:comments>15</slash:comments>
		</item>
		<item>
		<title>Data Pitfalls: a true Minefield?</title>
		<link>http://www.automated-trading-system.com/data-pitfalls/</link>
		<comments>http://www.automated-trading-system.com/data-pitfalls/#comments</comments>
		<pubDate>Tue, 04 May 2010 09:55:36 +0000</pubDate>
		<dc:creator>Jez Liberty</dc:creator>
				<category><![CDATA[Data]]></category>
		<category><![CDATA[Back-Adjusted]]></category>
		<category><![CDATA[CSI]]></category>
		<category><![CDATA[rollover]]></category>
		<category><![CDATA[Trading Blox]]></category>

		<guid isPermaLink="false">http://www.automated-trading-system.com/?p=2210</guid>
		<description><![CDATA[In my other job, at a big investment bank, one of our main focus on a daily basis is DATA. Making sure that the hundreds of feeds and millions of records get uploaded correctly and contain the right information is key to a smooth, successful day. There is surely not as much data to interact [...]]]></description>
			<content:encoded><![CDATA[<div id="attachment_2212" class="wp-caption alignnone" style="width: 510px"><img src="http://www.automated-trading-system.com/wp-content/uploads/2010/05/matrix-Pixelsior1.jpg" alt="Data - image by Pixelsior@flickr" title="matrix-Pixelsior" width="500" height="233" class="size-full wp-image-2212" /><p class="wp-caption-text">Data - image by Pixelsior@flickr</p></div>
<p>In my other job, at a big investment bank, one of our main focus <em>on a daily basis</em> is DATA. Making sure that the hundreds of feeds and millions of records get uploaded correctly and contain the right information is key to a smooth, successful day.</p>
<p>There is surely not as much data to interact with in <strong>automatic/systematic trading</strong> but getting data right is equally vital to ensure quality trading or backtesting results.</p>
<p>Even with the best data package, there can be <strong>many pitfalls</strong> to look out for when trading or backtesting a systematic trading strategy. Below is a non-exhaustive list<span id="more-2210"></span> &#8211; please let me know in the comments if you think of anything to add.</p>
<h3>Data Errors</h3>
<p>Despite CSI being deemed one of the <a href="http://www.automated-trading-system.com/unfair-advantage-csi/">most reliable End-Of-Day Data providers</a>, they still send you bogus data (albeit rarely) and you might want to run additional checks to see if the data is valid. Some ideas of checks to perform:</p>
<ul>
<li>Open, Low or Close above the High</li>
<li>Prices = 0</li>
<li>Price/Volume/Open Interest changes above tolerance</li>
<li>Gap in the dates</li>
<li>etc.</li>
</ul>
<p>Of course, this will not catch all errors, but will give a pointer on large data anomalies.</p>
<h3>Static Data</h3>
<p>Back in the bank job, part of the system data which changes infrequently (hence <em>static</em>) is subject to <em>4-eyes approval</em> (basically enforcing that another <em>pair of eyes</em> double-checks the correctness of the data). The idea is that, as this data drives the calculations in the system, any error would give flawed calculation results, and needs double-checking.</p>
<p>The equivalent in the automatic trading system world is the <strong>futures contract specifications and formats</strong> information (price quote type, decimal places, native currency, point value), contained in the <em>FuturesInfo</em> file in TradingBlox. Imagine an error of a factor 10 on the contract point value &#8211; this could have you get in a trade at 10 times the intended position size!</p>
<p>CSI appears to contain several of these errors (they seem to have less focus in getting this type of data right) and even official exchange websites have been seen to quote incorrect information. Reconciling both would be a starting point to getting the right information.</p>
<p>A possible solution to mitigate this problem (when starting trading a new, exotic instrument) is a quick in-and-out trade to double-check the actual information on your broker statement.</p>
<h3>Data History and Overrides</h3>
<p>The CSI data downloading process firstly retrieves all new prices to be stored in the Unfair Advantage database. It then applies potential corrections to past prices, in case errors were present. Rollover logic is applied and the full data history file is generated (to be used in the trading/backtesting software).</p>
<p>The change in data resulting from <strong>error corrections</strong> might change the outcome of past trade results. For example, a data correction in the recent past history might trigger a breakout and therefore a trade, now open. How would you handle this?</p>
<p>Additonally, if the historical data contains errors not corrected by your data provider, you might want to apply <strong>overrides</strong> to correct them yourself. However, since the price history gets re-written everyday, you need to have some form of automated overrides upload.</p>
<p>You might also want to make <strong>daily backups of price files</strong> to be able to compare when price corrections have taken place (and run your system with the exact data that was available on that day).</p>
<h3>Other Data</h3>
<p>Data such as historical FX/interest rates or Margin data are necessary to calculate some of the system statistics (including overall performance).</p>
<p>The <strong>FX rates</strong> are mostly used to convert the P&#038;L from the native contract currency to the main account currency.</p>
<p><strong>Interest rates</strong> would be used to calculate the interest earned on the account, which impact on the overall performance is not negligible for a long-term Trend Following system.</p>
<p>The <strong>Margin data</strong> is useful to determine the total amount of margin your system requires at any one time, with statistics such as the Margin-to-Equity ratio. Unfortunately, it is fairly hard to get hold of this type of data, which changes fairly often, at the discretion of the exchanges. Most backtesting platforms I have come across use a static margin number, which is fairly inaccurate.</p>
<p>To get more accurate results, you could run your backtesting simulations using historical (real or simulated) margin requirements. A method suggested on various forums to estimate historical margin requirements is to run a <strong>regression analysis</strong> between margin requirements (known history) and underlying instrument volatility (using different potential measurements such ATR, High-Low, Bollinger Bands, etc.). Finding a good-fit model would allow you to extrapolate past margin requirements based on volatility.</p>
<p><strong>Holidays</strong> are also useful data to collect, to be able to know which exchanges are open when (note that exchanges can have different holidays even when they are in the same country).</p>
<h3>Backup Provider</h3>
<p>Your main data provider might be down or unavailable (hopefully on rare occasisons only). A backup, alternative source of market data might come in very handy for those special days.</p>
<h3>Back-Adjustments and Rollovers</h3>
<p>There is unfortunately no ideal or universal solution to roll and back-adjust contracts. As discussed earlier, a <a href="http://www.automated-trading-system.com/what-everybody-ought-to-know-about-continous-futures-contracts/">proportional back-adjustment</a> allows for better representations of prices, keeping historical ratio values between all prices. However, backtesting systems usually require point-based back-adjustements in order to calculate the P&#038;L of each trade correctly. You might need to maintain several sets of back-adjusted prices to be used in your simulations.</p>
<p>Furthermore, different instruments might require different rolling logic. Different delivery months in agricultural futures, for example, might relate to different crops. It might not make as much sense to roll from one ot the other in the same way that could be done with equity index futures.</p>
<p><strong>Do you get the rollover information on rollover day?</strong><br />
Let&#8217;s assume that, on Thursday, you receive the data indicating that a roll should have occurred on Tuesday (ie. roll based on Open Interest or Volume shifts). Let&#8217;s also assume that an entry signal was triggered on the Wednesday and that the high volatility of the front contract would have prevented the system from entering the trade (risk management threshold breached) &#8211; whereas the next contract&#8217;s volatility, being much lower, would have allowed the trade. In real life, Wednesday&#8217;s trade would not take place (as the system does not know yet that the contract should have rolled on Tuesday). In backtested life however, Wednesday&#8217;s trade would take place, as the system would assume the roll has taken place on Tuesday. These things do actually happen!</p>
<p>You might want to test using the data as you would have received it, instead of a constructed back-adjusted series, potentially containing hindsight information.</p>
<h3>LME Data</h3>
<p>Some instruments deal in &#8220;strange fashion&#8221; and the London Metal Exchange is a perfect example of this. Trading on the LME is done by purchasing a forward contract with a given maturity (or prompt date). For instance, you might purchase a 3-month forward contract, which will run for the next 3 months gradually maturing to converge to the Cash price (at expiration), including the effect of contango or backwardation. However, the data quoted from CSI (and probably any other data provider) is a new daily quote for a new 3-month forward, which does not reflect real trading.</p>
<p>You would probably need to construct a custom price series with a bespoke algorithm to be able to reflect and backtest real-life trading. This topic was further discussed on a <a href="http://www.tradingblox.com/forum/viewtopic.php?t=7440&#038;start=0&#038;postdays=0&#038;postorder=asc&#038;highlight=" target="_blank">tradingblox forum post</a></p>
<h3>Need for an ETL layer?</h3>
<p>Drawing the parallel to the bank job again, where we use specialised tools/platforms to deal with data (Extract-Transform-Load = ETL); I believe that a similar layer between your data provider(s) and your trading/backtesting system, used to perform data checks, archive, roll and back-adjustments, etc. (all poinst discussed above) is necessary. It could also be used to add extra functionality such as creating spread time series to be traded/backtested as new instruments.</p>
<p>The data issue might not be as much of a trading problem as an IT one, nonetheless it is an important one that needs to be addressed &#8211; or it could impact your trading and backtesting results.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.automated-trading-system.com/data-pitfalls/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>The State of Trend Following report &#8211; Draft V0.1</title>
		<link>http://www.automated-trading-system.com/state-of-trend-following-draft-201003/</link>
		<comments>http://www.automated-trading-system.com/state-of-trend-following-draft-201003/#comments</comments>
		<pubDate>Tue, 02 Mar 2010 10:33:05 +0000</pubDate>
		<dc:creator>Jez Liberty</dc:creator>
				<category><![CDATA[the State of Trend Following]]></category>
		<category><![CDATA[Trend Following]]></category>
		<category><![CDATA[CSI]]></category>
		<category><![CDATA[report]]></category>
		<category><![CDATA[Trading Blox]]></category>

		<guid isPermaLink="false">http://www.automated-trading-system.com/?p=1841</guid>
		<description><![CDATA[I just have to get something out on this 1st beginning of March. I could keep polishing this report until Christmas&#8230; But instead here is a first draft. The State of Trend Following report will be published at the beginning of each month (expect it to be evolving for the first few months). The Concept [...]]]></description>
			<content:encoded><![CDATA[<p><img src="http://www.automated-trading-system.com/wp-content/uploads/2010/03/State-of-TF.png" alt="State of TF" title="State of TF" width="450" height="113" class="aligncenter size-full wp-image-1842" /></p>
<p>I just have to get something out on this <del>1st</del> beginning of March. I could keep polishing this report until Christmas&#8230; But instead here is a first draft. The <strong>State of Trend Following</strong> report will be published at the beginning of each month (expect it to be evolving for the first few months).</p>
<h3>The Concept</h3>
<p>The principle was inspired to me by Michael Stokes from <a href="http://marketsci.wordpress.com/" target="_blank">MarketSci</a> with his very smart <a href="http://marketsci.wordpress.com/state-of-the-market/" target="_blank">State of the Market report</a> describing how the markets are behaving.</p>
<p>The idea is to track several <em>classic</em> <strong>Trend Following</strong> systems over a wide range of instruments and <strong>different timeframes</strong>. This should, in theory be a good complement to tracking the <a href="http://www.automated-trading-system.com/trend-following-wizards/">Trend Following Wizards</a> to get an idea of how well Trend Following is doing as a strategy.</p>
<p>For this first report, I picked (arbitrarily) 3 standard Trend Following systems that ship with Trading Blox:</p>
<ul>
<li>Moving Average Crossover system with ATR-based stops</li>
<li>Bollinger Band Breakout</li>
<li>Triple Exponential Moving Average</li>
</ul>
<p>Each system is tested over<span id="more-1841"></span> a short, medium and longer timeframe. Details of the system rules,  parameters used and instruments traded can be found at the end of the post.</p>
<h3>The Background Picture</h3>
<p>As an initial run &#8211; to give a long-term idea of how each of the 9 systems performed (3 systems x 3 timeframes) &#8211; the whole futures data available in Trading Blox (provided free by CSI) was used for the backtest simulation.</p>
<p>One of the main interest of the study is how trends evolve over time and different systems. Therefore, the simulation parameters include no trade friction (ie no commissions and slippage at all). The equity curves below are therefore over-optimistic but they should really be used for <em>relative</em> comparisons.</p>
<div id="attachment_1847" class="wp-caption aligncenter" style="width: 310px"><a href="http://www.automated-trading-system.com/wp-content/uploads/2010/03/State-TF-1996-2010.png" target="_blank"><img src="http://www.automated-trading-system.com/wp-content/uploads/2010/03/State-TF-1996-2010-300x204.png" alt="Systems Equity curves and Drawdowns. Each column represents a system (MA=MA Crossover; TMA=Triple Moving Average; BBBO=Bollinger Band Breakout) , with each row representing a timeframe (short, medium, long from top to bottom)" title="State-TF-1996-2010" width="300" height="204" class="size-medium wp-image-1847" /></a><p class="wp-caption-text">Chart showing Systems Equity curves and Drawdowns. Each column represents a system (MA=MA Crossover; TMA=Triple Moving Average; BBBO=Bollinger Band Breakout) , with each row representing a timeframe (short, medium, long from top to bottom) - Click to zoom in</p></div>
<p>If there is one trend that seems to be shared across all 9 systems, it is the increased volatility &#8211; expressed by the larger drawdowns having appeared in the last 4-5 years in all systems.</p>
<p>Imagine starting trading the Golden Crossover system (50-200 MA Crossover) on January 1st 2003 &#8211; after good backtesting results (CAGR>20% and worst drawdown around 10% &#8211; a MAR of 2), only to see drawdown figures quadruple in the next 5 years!</p>
<p>This could be down to the fact that most instruments have become more correlated in the last few years, in effect negating some benefits provided by diversification.</p>
<h3>Zoom in to 2009 and 2010</h3>
<p>We are also interested in the most recent picture. Below are 2 charts comparing our 9 systems on the 2009-2010 and 2010-only time horizons (each system adjusted back to 100 at the start of the period). Each type of system is represented in one colour and each timeframe in one line style:</p>
<p><img src="http://www.automated-trading-system.com/wp-content/uploads/2010/03/State-TF-2009-2010.png" alt="State-TF-2009-2010" title="State-TF-2009-2010" width="498" height="382" class="alignnone size-full wp-image-1852" /></p>
<p>Nothing very exciting in 2009, and with addition of trade friction, it seems to correlate with the (negative) results witnessed on the Trend Following Wizards. Also note that most systems follow the same path (apart from the short-term Bollinger system, all over the place with extreme volatility &#8211; the chart does not show it, but it closed February 2010 at around 60).</p>
<p><img src="http://www.automated-trading-system.com/wp-content/uploads/2010/03/State-TF-2010.png" alt="State-TF-2010" title="State-TF-2010" width="499" height="353" class="alignnone size-full wp-image-1853" /></p>
<p>2010 seems to be a continuation of 2009 so far: with a slight downward trend emerging across all systems.</p>
<h3>Improvements to the report</h3>
<p>There are quite a few things that could be added to this report, starting with integrating more systems and parameters (probably aggregated as an average per timeframe to avoid the <em>data deluge syndrome</em>). It might also be interesting to be able to break down the performance by type of markets/sectors.</p>
<p>But I am also open to your suggestions and requests. So <strong>please let me know</strong> in the comments below and I will integrate the best ideas.</p>
<p>Until next month&#8230;</p>
<h3>Appendix: System Details</h3>
<h4>System Rules and Parameters</h4>
<p>All the systems were tested with the same simplistic position sizing rules of 1% per new trade. No other Money/Risk Management rules were used.</p>
<p>The system rules are detailed on the Trading Blox online documentation.<br />
The <a href="http://www.tradingblox.com/Manuals/UsersGuideHTML/index.html?macd.htm" target="_blank" rel="nofollow">MA Crossover system</a> was used with moving average pairs of 10-20, 20-50 and 50-200 days. The stops are set at 5 x ATR(39).<br />
The <a href="http://www.tradingblox.com/Manuals/UsersGuideHTML/index.html?bollingerbreakout.htm" target="_blank" rel="nofollow">Bollinger Band system</a> is the classic use of the Bollinger Bands with entries taking place at Breakouts. The parameters used were 20, 50 and 200 days with 2 standard deviations.<br />
The <a href="http://www.tradingblox.com/Manuals/UsersGuideHTML/index.html?triplemovingaverage.htm" target="_blank" rel="nofollow">Triple moving Average system</a> was used with moving average triplets of 10-20-50, 20-50-200 and 50-200-800 days. The stops are set at 5 x ATR(39).</p>
<h4>Portfolio Instruments</h4>
<p>The instruments included in the simulation are a semi-diversified list of futures, contained in the <em>All Futures</em> Trading Blox set:</p>
<table style="border:1px solid #c3c3c3; border-collapse:collapse;">
<tr>
<th style="background-color:#e5eecc; border:1px solid #c3c3c3; padding-left:2px; font-size: 0.7em;" >
      CSI Num.
    </th>
<th style="background-color:#e5eecc; border:1px solid #c3c3c3; padding-left:2px; font-size: 0.7em;" >
      Futures Contract
    </th>
</tr>
<tr>
<td style="background-color:#ffffff; border:1px solid #c3c3c3; padding-left:2px; font-size: 0.7em;" >
AD
    </td>
<td style="background-color:#ffffff; border:1px solid #c3c3c3; padding-left:2px; font-size: 0.7em;" >
Australian Dollar-CME(Floor+Electronic Combined)
    </td>
</tr>
<tr>
<td style="background-color:#f3f3f3; border:1px solid #c3c3c3; padding-left:2px; font-size: 0.7em;" >
BP
    </td>
<td style="background-color:#f3f3f3; border:1px solid #c3c3c3; padding-left:2px; font-size: 0.7em;" >
British Pound-CME(Floor+Electronic Combined)
    </td>
</tr>
<tr>
<td style="background-color:#ffffff; border:1px solid #c3c3c3; padding-left:2px; font-size: 0.7em;" >
C
    </td>
<td style="background-color:#ffffff; border:1px solid #c3c3c3; padding-left:2px; font-size: 0.7em;" >
Corn-CBT (Floor+Electronic Combined)
    </td>
</tr>
<tr>
<td style="background-color:#f3f3f3; border:1px solid #c3c3c3; padding-left:2px; font-size: 0.7em;" >
CC
    </td>
<td style="background-color:#f3f3f3; border:1px solid #c3c3c3; padding-left:2px; font-size: 0.7em;" >
Cocoa-CSCE
    </td>
</tr>
<tr>
<td style="background-color:#ffffff; border:1px solid #c3c3c3; padding-left:2px; font-size: 0.7em;" >
CD
    </td>
<td style="background-color:#ffffff; border:1px solid #c3c3c3; padding-left:2px; font-size: 0.7em;" >
Canadian Dollar-CME(Floor+Electronic Combined)
    </td>
</tr>
<tr>
<td style="background-color:#f3f3f3; border:1px solid #c3c3c3; padding-left:2px; font-size: 0.7em;" >
CL
    </td>
<td style="background-color:#f3f3f3; border:1px solid #c3c3c3; padding-left:2px; font-size: 0.7em;" >
Crude Oil-Light-NYMEX(Floor+Electronic Combined)
    </td>
</tr>
<tr>
<td style="background-color:#ffffff; border:1px solid #c3c3c3; padding-left:2px; font-size: 0.7em;" >
CT
    </td>
<td style="background-color:#ffffff; border:1px solid #c3c3c3; padding-left:2px; font-size: 0.7em;" >
Cotton #2-NYCE
    </td>
</tr>
<tr>
<td style="background-color:#f3f3f3; border:1px solid #c3c3c3; padding-left:2px; font-size: 0.7em;" >
EC
    </td>
<td style="background-color:#f3f3f3; border:1px solid #c3c3c3; padding-left:2px; font-size: 0.7em;" >
Euro(Floor+Electronic Combined)-CME
    </td>
</tr>
<tr>
<td style="background-color:#ffffff; border:1px solid #c3c3c3; padding-left:2px; font-size: 0.7em;" >
ED
    </td>
<td style="background-color:#ffffff; border:1px solid #c3c3c3; padding-left:2px; font-size: 0.7em;" >
Eurodollar-3 Mth-CME-Globex(Floor+Electronic Combined)
    </td>
</tr>
<tr>
<td style="background-color:#f3f3f3; border:1px solid #c3c3c3; padding-left:2px; font-size: 0.7em;" >
EM
    </td>
<td style="background-color:#f3f3f3; border:1px solid #c3c3c3; padding-left:2px; font-size: 0.7em;" >
LIBOR(1Mth)-CME(Floor+Electronic Combined)
    </td>
</tr>
<tr>
<td style="background-color:#ffffff; border:1px solid #c3c3c3; padding-left:2px; font-size: 0.7em;" >
FC
    </td>
<td style="background-color:#ffffff; border:1px solid #c3c3c3; padding-left:2px; font-size: 0.7em;" >
Cattle-Feeder-CME(Floor+Electronic Combined)
    </td>
</tr>
<tr>
<td style="background-color:#f3f3f3; border:1px solid #c3c3c3; padding-left:2px; font-size: 0.7em;" >
GC
    </td>
<td style="background-color:#f3f3f3; border:1px solid #c3c3c3; padding-left:2px; font-size: 0.7em;" >
Gold-COMEX(Floor+Electronic Combined)
    </td>
</tr>
<tr>
<td style="background-color:#ffffff; border:1px solid #c3c3c3; padding-left:2px; font-size: 0.7em;" >
HG
    </td>
<td style="background-color:#ffffff; border:1px solid #c3c3c3; padding-left:2px; font-size: 0.7em;" >
CopperHG-COMEX(Floor+Electronic Combined)
    </td>
</tr>
<tr>
<td style="background-color:#f3f3f3; border:1px solid #c3c3c3; padding-left:2px; font-size: 0.7em;" >
HO
    </td>
<td style="background-color:#f3f3f3; border:1px solid #c3c3c3; padding-left:2px; font-size: 0.7em;" >
Heating Oil #2-NYMEX(Floor+Electronic Combined)
    </td>
</tr>
<tr>
<td style="background-color:#ffffff; border:1px solid #c3c3c3; padding-left:2px; font-size: 0.7em;" >
HU
    </td>
<td style="background-color:#ffffff; border:1px solid #c3c3c3; padding-left:2px; font-size: 0.7em;" >
Gasoline-Reformulated Blendstock(Combined)-NYMEX
    </td>
</tr>
<tr>
<td style="background-color:#f3f3f3; border:1px solid #c3c3c3; padding-left:2px; font-size: 0.7em;" >
JY
    </td>
<td style="background-color:#f3f3f3; border:1px solid #c3c3c3; padding-left:2px; font-size: 0.7em;" >
Japanese Yen-CME(Floor+Electronic Combined)
    </td>
</tr>
<tr>
<td style="background-color:#ffffff; border:1px solid #c3c3c3; padding-left:2px; font-size: 0.7em;" >
KC
    </td>
<td style="background-color:#ffffff; border:1px solid #c3c3c3; padding-left:2px; font-size: 0.7em;" >
Coffee-CSCE
    </td>
</tr>
<tr>
<td style="background-color:#f3f3f3; border:1px solid #c3c3c3; padding-left:2px; font-size: 0.7em;" >
LC
    </td>
<td style="background-color:#f3f3f3; border:1px solid #c3c3c3; padding-left:2px; font-size: 0.7em;" >
Cattle-Live(Floor+Electronic Combined)-CME
    </td>
</tr>
<tr>
<td style="background-color:#ffffff; border:1px solid #c3c3c3; padding-left:2px; font-size: 0.7em;" >
LH
    </td>
<td style="background-color:#ffffff; border:1px solid #c3c3c3; padding-left:2px; font-size: 0.7em;" >
Hogs-Lean(Floor+Electronic Combined)-CME
    </td>
</tr>
<tr>
<td style="background-color:#f3f3f3; border:1px solid #c3c3c3; padding-left:2px; font-size: 0.7em;" >
MP
    </td>
<td style="background-color:#f3f3f3; border:1px solid #c3c3c3; padding-left:2px; font-size: 0.7em;" >
Mexican Peso(Floor+Electronic Combined)-CME
    </td>
</tr>
<tr>
<td style="background-color:#ffffff; border:1px solid #c3c3c3; padding-left:2px; font-size: 0.7em;" >
NG
    </td>
<td style="background-color:#ffffff; border:1px solid #c3c3c3; padding-left:2px; font-size: 0.7em;" >
Natural Gas-Henry Hub-NYMEX(Floor+Electronic Combined)
    </td>
</tr>
<tr>
<td style="background-color:#f3f3f3; border:1px solid #c3c3c3; padding-left:2px; font-size: 0.7em;" >
S
    </td>
<td style="background-color:#f3f3f3; border:1px solid #c3c3c3; padding-left:2px; font-size: 0.7em;" >
Soybeans (Floor+Electronic Combined)-CBT
    </td>
</tr>
<tr>
<td style="background-color:#ffffff; border:1px solid #c3c3c3; padding-left:2px; font-size: 0.7em;" >
SB
    </td>
<td style="background-color:#ffffff; border:1px solid #c3c3c3; padding-left:2px; font-size: 0.7em;" >
Sugar #11-NYCE(Floor+Electronic Combined)
    </td>
</tr>
<tr>
<td style="background-color:#f3f3f3; border:1px solid #c3c3c3; padding-left:2px; font-size: 0.7em;" >
SF
    </td>
<td style="background-color:#f3f3f3; border:1px solid #c3c3c3; padding-left:2px; font-size: 0.7em;" >
Swiss Franc-CME-(Floor+Electronic Combined)
    </td>
</tr>
<tr>
<td style="background-color:#ffffff; border:1px solid #c3c3c3; padding-left:2px; font-size: 0.7em;" >
SI
    </td>
<td style="background-color:#ffffff; border:1px solid #c3c3c3; padding-left:2px; font-size: 0.7em;" >
Silver-COMEX(Floor+Electronic Combined)
    </td>
</tr>
<tr>
<td style="background-color:#f3f3f3; border:1px solid #c3c3c3; padding-left:2px; font-size: 0.7em;" >
TY
    </td>
<td style="background-color:#f3f3f3; border:1px solid #c3c3c3; padding-left:2px; font-size: 0.7em;" >
T-Note-U.S. 10 Yr w/Prj A-CBT(Floor+Electronic Combined)X
    </td>
</tr>
<tr>
<td style="background-color:#ffffff; border:1px solid #c3c3c3; padding-left:2px; font-size: 0.7em;" >
US
    </td>
<td style="background-color:#ffffff; border:1px solid #c3c3c3; padding-left:2px; font-size: 0.7em;" >
T-Bond-U.S.-CBT (Floor+Electronic Combined)
    </td>
</tr>
<tr>
<td style="background-color:#f3f3f3; border:1px solid #c3c3c3; padding-left:2px; font-size: 0.7em;" >
W
    </td>
<td style="background-color:#f3f3f3; border:1px solid #c3c3c3; padding-left:2px; font-size: 0.7em;" >
Wheat-CBT (Floor+Electronic Combined)
    </td>
</tr>
</table>
<p>&nbsp;</p>
]]></content:encoded>
			<wfw:commentRss>http://www.automated-trading-system.com/state-of-trend-following-draft-201003/feed/</wfw:commentRss>
		<slash:comments>13</slash:comments>
		</item>
		<item>
		<title>How-To: CSI Data into TradersStudio</title>
		<link>http://www.automated-trading-system.com/csi-data-into-tradersstudio/</link>
		<comments>http://www.automated-trading-system.com/csi-data-into-tradersstudio/#comments</comments>
		<pubDate>Tue, 12 Jan 2010 13:34:09 +0000</pubDate>
		<dc:creator>Jez Liberty</dc:creator>
				<category><![CDATA[Data]]></category>
		<category><![CDATA[API]]></category>
		<category><![CDATA[CSI]]></category>
		<category><![CDATA[screenshots]]></category>
		<category><![CDATA[tradersstudio]]></category>
		<category><![CDATA[Unfair Advantage]]></category>

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

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

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

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

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

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

		<guid isPermaLink="false">http://www.automated-trading-system.com/?p=642</guid>
		<description><![CDATA[I should say &#8220;Yes&#8221; as I decided to purchase, and now own TradersStudio. For the price ($499), it offers a very decent package for developing and testing automated trading systems. Why I chose TradersStudio I did consider a few options before buying TradersStudio (Amibroker, TradeStation, Trading Blox, WealthLab, NinjaTrader) and based on feature analysis, recommendations [...]]]></description>
			<content:encoded><![CDATA[<p>I should say &#8220;Yes&#8221; as I decided to purchase, and now own TradersStudio. For the price ($499), it offers a very decent package for developing and testing automated trading systems.</p>
<h3>Why I chose TradersStudio</h3>
<p>I did consider a few options before buying <a href="http://www.tradersstudio.com/" target="_blank" rel="nofollow">TradersStudio</a> (Amibroker, TradeStation, Trading Blox, WealthLab, NinjaTrader) and based on feature analysis, recommendations and actual testing, I settled on TradersStudio.<br />
My requirements were for a standalone platform that would allow me to test any system, with money management and multiple system interaction.<br />
I did hesitate with Trading Blox, which I enjoyed testing (demo version), but in the end the price sorted the argument (Trading Blox is $3,000 for similar functionality).<br />
For more info on what each product offers, I would definitely recommend heading to <a href="http://www.elitetrader.com/" target="_blank" rel="nofollow">EliteTrader</a> where many platform comparison posts can be found. Please also feel free to ask me questions in the Comments section below.</p>
<h3>First impressions</h3>
<p>Not so good&#8230; There is no<span id="more-642"></span> demo available on the website, you can not download the app from the website once purchased and the manuals you receive after waiting a few days seem quite unprofessional (despite being over 300 pages).<br />
However, the install is quite easy and you can be up and running following examples from the manual in a few minutes.</p>
<h3>Main Features</h3>
<p>The app offers some interesting features which help me take the decision:</p>
<h3>Integrated Systems testing</h3>
<p>TradersStudio uses different hierarchical levels: Instrument, System, Session, Trade Plan. This allows you to test a <em>complete</em> system (i.e. more than simple entry and exit testing). A Trade Plan can contain several sessions, which in turn can contain several systems and instruments with possible interaction between them. Additionally, Money Management options can be tested as part of the Trading Plan. This makes it much more realistic than a collection of independent strategy tests.<br />
There is also to the concept of <em>virtual systems</em> that allow you to run a system in &#8220;monitor&#8221; mode and only use it for decision making on other &#8220;live&#8221; systems (i.e. enter a trade in real system only after virtual system posts 3 losing trades).</p>
<h3>Customisation</h3>
<p>TradersStudio implements its own Macro language, which appears to be a cross between TradeStation EasyLanguage and Visual Basic. Theoritically you can implement whatever extra functionality you require (indicator, software add-in, etc.). Moreover there is an import tool that automatically converts TradeStation EasyLanguage code, which should allow to reuse available code.</p>
<h3>Data-independent</h3>
<p>You can basically load data from whatever source you wish in any supported format (any standard text file format will do). I personally use Unfair Advantage from CSI and getting it loaded to TradersStudio was a breeze (see <a href="http://www.automated-trading-system.com/tag/unfair-advantage/">Unfair Advantage posts</a> for more information on CSI UA -> TradersStudio)</p>
<h3>Walk Forward</h3>
<p>Walk forward is a useful concept to use in back-testing to avoid over-optimization and curve-fitting. TradersStudio implements this functionality and runs it automatically which means less manual workaround for you to deal with.</p>
<h3>Documentation issues</h3>
<p>My main grudge is about the manuals. Despite being over 300 pages it is still missing an essential reference guide for programming using their language (there are a few examples but they do not cover the whole range of functionality and much is left to be guessed by the user). It is a &#8220;Learning by Example&#8221; type of manual which can sound a bit patronising at times.<br />
For that reason I have found it hard to seriously get into TradersStudio&#8230; but I have just signed up for the yahoo group dedicated to it and will be spending many hours in front of it very soon!</p>
<p>I will explore TradersStudio in more details as I start using it and share in a later post if you are interested.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.automated-trading-system.com/tradersstudio-systems-testing-software/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Unfair Advantage API Code (C#): Extract Futures Continuous data</title>
		<link>http://www.automated-trading-system.com/unfair-advantage-api-code-c-extract-futures-continuous-data/</link>
		<comments>http://www.automated-trading-system.com/unfair-advantage-api-code-c-extract-futures-continuous-data/#comments</comments>
		<pubDate>Sun, 04 Oct 2009 15:37:09 +0000</pubDate>
		<dc:creator>Jez Liberty</dc:creator>
				<category><![CDATA[Backtest]]></category>
		<category><![CDATA[Code]]></category>
		<category><![CDATA[Data]]></category>
		<category><![CDATA[Futures]]></category>
		<category><![CDATA[Software]]></category>
		<category><![CDATA[API]]></category>
		<category><![CDATA[C#]]></category>
		<category><![CDATA[CSI]]></category>
		<category><![CDATA[rollover]]></category>
		<category><![CDATA[screenshots]]></category>
		<category><![CDATA[Unfair Advantage]]></category>

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

