<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/rss2full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><rss xmlns:atom="http://www.w3.org/2005/Atom" xmlns:openSearch="http://a9.com/-/spec/opensearchrss/1.0/" xmlns:blogger="http://schemas.google.com/blogger/2008" xmlns:georss="http://www.georss.org/georss" xmlns:gd="http://schemas.google.com/g/2005" xmlns:thr="http://purl.org/syndication/thread/1.0" xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" version="2.0"><channel><atom:id>tag:blogger.com,1999:blog-35364652</atom:id><lastBuildDate>Sun, 19 May 2013 12:33:20 +0000</lastBuildDate><category>Automated trading platforms</category><category>Strategies</category><category>Book reviews</category><title>Quantitative Trading</title><description>Quantitative investment and trading ideas, research, and analysis.</description><link>http://epchan.blogspot.com/</link><managingEditor>noreply@blogger.com (Ernie Chan)</managingEditor><generator>Blogger</generator><openSearch:totalResults>184</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" type="application/rss+xml" href="http://feeds.feedburner.com/QuantitativeTrading" /><feedburner:info uri="quantitativetrading" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com/" /><item><guid isPermaLink="false">tag:blogger.com,1999:blog-35364652.post-8590048457355940240</guid><pubDate>Fri, 03 May 2013 12:31:00 +0000</pubDate><atom:updated>2013-05-03T14:45:42.398-04:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">Strategies</category><category domain="http://www.blogger.com/atom/ns#">Book reviews</category><title>Nonlinear Trading Strategies</title><description>I have long been partial to &lt;a href="http://epchan.blogspot.ca/2011/04/many-facets-of-linear-regression.html" target="_blank"&gt;linear strategies&lt;/a&gt; due to their simplicity and relative immunity to overfitting. They can be used quite easily to profit from mean-reversion. However, there is a serious problem: they are quite &lt;a href="http://epchan.blogspot.ca/2013/03/what-can-quant-traders-learn-from.html" target="_blank"&gt;fragile&lt;/a&gt;, &lt;em&gt;i.e.&lt;/em&gt; vulnerable to tail risks.&amp;nbsp;As we move from mean-reverting strategies to momentum strategies, we immediately introduce a nonlinearity (stop losses), but simultaneously remove&amp;nbsp;certain tail risks (except during times when markets are closed). But if we want to enjoy anti-fragility and are going to introduce nonlinearities anyway, we might as well go full-monty, and consider options strategies. (It is no surprise that Taleb was an options trader.)&lt;br /&gt;&lt;br /&gt;It is easy to see that options strategies are nonlinear, since options payoff curves (value of an option&amp;nbsp;as function of underlying stock price)&amp;nbsp;are plainly nonlinear. I personally have resisted trading them because they all seem so complicated, and I abhor complexities. But recently a reader recommended a little book to me: Jeff Augen's "&lt;a href="http://www.amazon.com/dp/0137029039/ref=as_li_qf_sp_asin_til?tag=quantitativet-20&amp;amp;camp=14573&amp;amp;creative=327641&amp;amp;linkCode=as1&amp;amp;creativeASIN=0137029039&amp;amp;adid=13WZN3EAQWT423HNK9FD&amp;amp;&amp;amp;ref-refURL=http%3A%2F%2Fepchan.blogspot.ca%2F" target="_blank"&gt;Day Trading Options&lt;/a&gt;" where the Black-Scholes equation (and indeed any equation) is mercifully absent from the entire treatise. At the same time, it is&amp;nbsp;suffused with qualitative ideas. Among the juicy bits:&lt;br /&gt;&lt;br /&gt;1) We can find distortions in the 2D implied volatility surface (implied volatility as z-axis, expiration months as x, and strike prices as y) which may mean revert to "smoothness", hence presenting arbitrage opportunities. These distortions are present for both stock and stock index options.&lt;br /&gt;&lt;br /&gt;2) Options are underpriced intraday and overpriced overnight: hence it is often a good idea to buy them at the market open and sell them at market close (except on some special days! See 4 below.). In fact, there are certain days of the week where this distortion is the most drastic and thus favorable to this strategy.&lt;br /&gt;&lt;br /&gt;3) Certain cash&amp;nbsp;instruments have unusually high kurtosis, but their corresponding option prices consistently underprice such tail risks. Thus structures such as strangles or backspreads can often be profitable without incurring any left tail risks.&lt;br /&gt;&lt;br /&gt;4) If there is a long weekend before expiration day (e.g. Easter weekend),&amp;nbsp; the time decay of the options value over 3 days is compressed into an intraday decline&amp;nbsp;on the last trading day before the weekend.&lt;br /&gt;&lt;br /&gt;Now, as quantitative traders, we have no need to take his word on any of these assertions. So, onward to backtesting!&lt;br /&gt;&lt;br /&gt;(For those who may be stymied by the lack of affordable historical intraday options data, I recommend Nanex.net.)&lt;br /&gt;&lt;br /&gt;===&lt;br /&gt;&lt;br /&gt;There are still 2 slots available in my online &lt;a href="http://www.epchan.com/my-workshops/" target="_blank"&gt;Mean Reversion Strategies&lt;/a&gt; workshop in May. The workshop will be conducted &lt;em&gt;live&lt;/em&gt; via Adobe Connect,&amp;nbsp;and is limited to a total of 4 participants. Part of the workshop will focus on how to avoid getting hurt when a pair or a portfolio of instruments stop cointegrating.</description><link>http://feedproxy.google.com/~r/QuantitativeTrading/~3/F-2TVlNbbh4/nonlinear-trading-strategies.html</link><author>noreply@blogger.com (Ernie Chan)</author><thr:total>18</thr:total><feedburner:origLink>http://epchan.blogspot.com/2013/05/nonlinear-trading-strategies.html</feedburner:origLink></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-35364652.post-5669688286675515947</guid><pubDate>Thu, 04 Apr 2013 15:16:00 +0000</pubDate><atom:updated>2013-04-04T18:40:56.340-04:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">Automated trading platforms</category><title>An Integrated Development Environment for High Frequency Strategies</title><description>I have come across many software platforms that allow traders to first specify and backtest a strategy and then, with the push of a button, turn the backtest strategy into a live trading program that can automatically submit orders to their favorite&amp;nbsp;broker. (See all my articles on this topic &lt;a href="http://epchan.blogspot.com/search/label/Automated%20trading%20platforms" target="_blank"&gt;here&lt;/a&gt;.)&amp;nbsp; I called these platforms "Integrated Development Environment" (IDE) in my &lt;a href="http://www.amazon.com/gp/product/1118460146/ref=as_li_qf_sp_asin_il_tl?ie=UTF8&amp;amp;camp=1789&amp;amp;creative=9325&amp;amp;creativeASIN=1118460146&amp;amp;linkCode=as2&amp;amp;tag=quantitativet-20" target="_blank"&gt;new book&lt;/a&gt;, and they range from the familiar and retail-oriented (e.g. MetaTrader, NinjaTrader, TradeStation), to the professional but skills-demanding (e.g. ActiveQuant, Marketcetera,&amp;nbsp;TradeLink),&amp;nbsp;&amp;nbsp;and finally to the&amp;nbsp;comprehensive and industrial-strength&amp;nbsp;(e.g. Deltix, Progress Apama, QuantHouse, RTD Tango). Some of these require no programming skills at all, allowing you to construct strategies by dragging-and-dropping, others use some simple scripting languages like Python, and yet others demand full-blown programming abilities in Java, C#, or C++. But which of these allow us to backtest and execute high frequency strategies?&lt;br /&gt;&lt;br /&gt;To state the obvious: backtesting HFstrategies is quite hard. The volume of data is one issue. But in addition, the execution details are very important to such strategies: details such as&amp;nbsp;the exact&amp;nbsp;exchange/venue to which we are routing our orders, the precise state of the order book that triggers our orders, the order types we are using, and finally the probability of getting filled if we use non-marketable orders. Messing up one of these details and the backtest will be far from realistic. I often tell people that it is easier to paper trade a HF strategy than to backtest one. While many of the platforms I reported above do allow backtesting using tick data, I don't know that they enable backtesting using the full order book and choice of execution venue. With this background, I am happy to report I have recently come across just such a platform called &lt;a href="http://www.limebrokerage.com/services/marketdata/simulation" target="_blank"&gt;Lime Strategy Studio&lt;/a&gt;. &lt;br /&gt;&lt;br /&gt;&lt;strike&gt;First, the bad news. LimeTrader is useful only to traders who trade with Lime Brokerage, as it is configured to send live orders to Lime only.&lt;/strike&gt; [&lt;strong&gt;UPDATE:&lt;/strong&gt; I have since learned that there are adapters available for 3rd party brokers.] However, if you are going to trade HF stocks and futures strategies, why not go with Lime, since they provide you with a comprehensive API, direct ultra-low latency feeds from the exchanges, and allow (nay, insist on) colocation either at the exchanges or at their data center&amp;nbsp;at a&amp;nbsp;reasonable fee? (Full Disclosure: I have no current business relationship with Lime, though I was a customer.) Another piece of bad news: the specification of the strategy must be in C++. &lt;br /&gt;&lt;br /&gt;But once you get over these two&amp;nbsp;hurdles, the benefits are manifold. Every detail that you can specify for a live trading strategy can be specified for&amp;nbsp;the backtest and paper trading. As&amp;nbsp;I said, these details&amp;nbsp;may include order type, trading venue, state of order book, and even statistics of the order book, not to mention fundamental data such as earnings, corporate actions, and other user-provided data such as news. A fill simulator is included for your non-marketable orders. As with other IDEs, once you backtested a strategy in its every detail and are satisfied with the performance metrics, you can go live (either for paper or production trading) with the push of a button. &lt;br /&gt;&lt;br /&gt;If any reader know of other IDEs that have similar features and useful for backtesting HF strategies, please let us know!&lt;br /&gt;&lt;br /&gt;===&lt;br /&gt;&lt;br /&gt;Speaking of HF strategies, traders often lament the ultra-high secrecy around them and the difficulty of&amp;nbsp;gathering knowledge in this field. A friend (hat tip: Dave) referred me to this &lt;a href="http://www.math.stevens.edu/~ifloresc/Research/Publications/ProjectpricevolFinalwithDragos.pdf" target="_blank"&gt;paper&lt;/a&gt; by Prof. Dragos Bozdog &lt;em&gt;et. al.&lt;/em&gt; that gives a flavor of what sort of modeling may be involved. I find it very readable and thought-provoking.&lt;br /&gt;&lt;br /&gt;===&lt;br /&gt;&lt;br /&gt;There are still 2 slots available in my online&amp;nbsp;&lt;a href="http://www.epchan.com/my-workshops/" target="_blank"&gt;Mean Reversion Strategies workshop&lt;/a&gt; scheduled for May. &lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;</description><link>http://feedproxy.google.com/~r/QuantitativeTrading/~3/nc3bidY0fgI/an-integrated-development-environment.html</link><author>noreply@blogger.com (Ernie Chan)</author><thr:total>60</thr:total><feedburner:origLink>http://epchan.blogspot.com/2013/04/an-integrated-development-environment.html</feedburner:origLink></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-35364652.post-7257486152642926538</guid><pubDate>Thu, 14 Mar 2013 09:36:00 +0000</pubDate><atom:updated>2013-04-29T09:06:30.231-04:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">Book reviews</category><title>What Can Quant Traders Learn from Taleb's "Antifragile"?</title><description>It can seem a bit ironic that we should be discussing Nassim Taleb's best-seller "&lt;a href="http://www.amazon.com/gp/product/1400067820/ref=as_li_tf_tl?ie=UTF8&amp;amp;camp=1789&amp;amp;creative=9325&amp;amp;creativeASIN=1400067820&amp;amp;linkCode=as2&amp;amp;tag=quantitativet-20" target="_blank"&gt;Antifragile&lt;/a&gt;" here, since most algorithmic trading strategies involve predictions and won't be met with approval from Taleb. Predictions, as Taleb would say, are "fragile" -- they are prone to various biases (e.g. data snooping bias) and the occasional Black Swan event will wipe out the small cumulative profits from many correct bets. Nevertheless, underneath the heap of diatribes against various luminaries ranging from Robert Merton to Paul Krugman, we can find a few gems. Let me start from the obvious to the subtle:&lt;br /&gt;&lt;br /&gt;1) Momentum strategies are more antifragile than mean-reversion strategies.&lt;br /&gt;&lt;br /&gt;Taleb didn't say that, but that's the first thought that came to my mind. As I argued in many places, mean reverting strategies have natural profit caps (exit when price has reverted to mean) but no natural stop losses (we should buy more of something if it gets cheaper), so it is very much subject to &lt;i&gt;left&amp;nbsp;&lt;/i&gt;tail risk, but cannot take advantage of the unexpected good fortune of the &lt;i&gt;right &lt;/i&gt;tail. Very fragile indeed! On the contrary, momentum strategies have natural stop losses (exit when momentum reverses) and no natural profit caps (keep same position as long as momentum persists). Generally, very antifragile! Except: what if during a trading halt (due to the daily overnight gap, or circuit breakers), we can't exit a momentum position in time? Well, you can always buy an option to simulate a stop loss. Taleb would certainly approve of that.&lt;br /&gt;&lt;br /&gt;2) High frequency strategies are more antifragile than low frequency strategies.&lt;br /&gt;&lt;br /&gt;Taleb also didn't say that, and it has nothing to do with whether it is easier to predict short-term vs. long-term returns. Since HF strategies allow us to accumulate profits much faster than low frequency ones, we need not apply any leverage. So even when we are unlucky enough to be holding a position of the wrong sign when a Black Swan hits, the damage will be small compared to the cumulative profits. So while HF strategies do not exactly benefit from right tail risk, they are at least robust with respect to left tail risk.&lt;br /&gt;&lt;br /&gt;3) Parameter estimation errors and vulnerability to them should be explicitly incorporated in a backtest performance measurement.&lt;br /&gt;&lt;br /&gt;Suppose your trading model has a few parameters which you estimated/optimized using some historical data set. Based on these optimized parameters, you compute the Sharpe ratio of your model on this same data. No doubt this Sharpe ratio will be very good, due to the in-sample optimization. If you apply this model with those optimized the parameters on out-of-sample data, you would probably get a worse Sharpe ratio which is more predictive. But why stop at just two data sets? We can find N different data sets of the same size, calculate the optimized parameters on each of them, but compute the Sharpe ratios over the N-1 out-of-sample data sets. Finally, you can average over all these Sharpe ratios. If your trading model is fragile, you will find that this Sharpe ratio is quite low. But more important than Sharpe ratios, you should compute the maximum drawdown based on each set of parameters, and also the maximum of all these max drawdowns. If your trading model is fragile, this maximum of maximum drawdowns is likely to be quite scary.&lt;br /&gt;&lt;br /&gt;The scheme I described above is called cross-validation and is well-known before Taleb, though his book reminds me of its importance.&lt;br /&gt;&lt;br /&gt;4) Notwithstanding 3) above, a true estimate of the max drawdown is impossible because it depends on the estimate of the probability of rare events. As Taleb mentioned, even in case of a normal distribution, if the "true" standard deviation is higher than your estimate by a mere 5%, the probability of a 6-sigma event will be increased by 5 times over your estimate! So really the only way to ensure that our maximum drawdown will not exceed a certain &amp;nbsp;limit is through &lt;a href="http://epchan.blogspot.ca/2010/04/how-do-you-limit-drawdown-using-kelly.html" target="_blank"&gt;Constant Proportion Portfolio Insurance&lt;/a&gt;: trading risky assets with Kelly-leverage in a limited liability company, putting money that you never want to lose in a FDIC-insured bank, with regular withdrawals from the LLC to the bank (but not the other way around).&lt;br /&gt;&lt;br /&gt;5) Correlations are impossible to estimate/predict. The only thing we can do is to short at +1 and buy at -1.&lt;br /&gt;&lt;br /&gt;Taleb hates Markowitz portfolio optimization, and one of the reasons is that it relies on estimates of covariances of asset returns. As he said, a pair of assets that may have -0.2 correlation over a long period can have +0.8 correlation over another long period. This is especially true in times of financial stress. I quite agree on this point: I believe that manually assigning correlations with values of &amp;nbsp;+/-0.75, +/-0.5, +/-0.25, 0 to entries of the correlation matrix based on "intuition" (fundamental knowledge) can generate as good &lt;i&gt;out-of-sample&lt;/i&gt; performance as any meticulously estimated numbers.The more fascinating question is whether there is indeed mean-reversion of correlations. And if so, what instruments can we use to profit from it? Perhaps this &lt;a href="http://web-docs.stern.nyu.edu/salomon/docs/derivatives/GSAM%20-%20NYU%20conference%20042106%20-%20Correlation%20trading.pdf" target="_blank"&gt;article&lt;/a&gt; will help.&lt;br /&gt;&lt;br /&gt;6) Backtest can only be used to reject a strategy, not to predict its success.&lt;br /&gt;&lt;br /&gt;This echoes the point made by commenter Michael Harris in a previous&amp;nbsp;&lt;a href="http://epchan.blogspot.ca/2013/01/the-pseudo-science-of-hypothesis-testing.html" target="_blank"&gt;article&lt;/a&gt;. Since historical data will never be long enough to capture all the possible Black Swan events that can occur in the future, we can never know if a strategy will fail miserably. However, if a strategy already failed in a backtest, we can be pretty sure that it will fail again in the future.&lt;br /&gt;&lt;br /&gt;===&lt;br /&gt;&lt;br /&gt;The online "Quantitative Momentum Strategies”&amp;nbsp;workshop that I mentioned in the previous &lt;a href="http://epchan.blogspot.ca/2013/02/a-workshop-webinar-and-question.html" target="_blank"&gt;article&lt;/a&gt; is now fully booked. Based on popular demand, I will offer a "Mean Reversion Strategies" workshop in May. Once again, it will be conducted in real-time through Skype, and the number of attendees will be similarly limited to 4. See &lt;a href="http://www.epchan.com/my-workshops/" target="_blank"&gt;here&lt;/a&gt; for more information.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;</description><link>http://feedproxy.google.com/~r/QuantitativeTrading/~3/66KyuKVJ6xc/what-can-quant-traders-learn-from.html</link><author>noreply@blogger.com (Ernie Chan)</author><thr:total>34</thr:total><feedburner:origLink>http://epchan.blogspot.com/2013/03/what-can-quant-traders-learn-from.html</feedburner:origLink></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-35364652.post-6471196189794970005</guid><pubDate>Mon, 18 Feb 2013 20:41:00 +0000</pubDate><atom:updated>2013-02-18T15:42:29.397-05:00</atom:updated><title>A workshop, a webinar, and a question</title><description>There is a workshop on the 25th of February titled "&lt;a href="http://ieor.columbia.edu/financial-engineering-practitioners-seminar-market-turbulence-monetization-and-universality" target="_blank"&gt;Market turbulence; monetization; and universality&lt;/a&gt;" by Mike Lipkin at Columbia University that promises to be interesting to those traders who have a physics background. Mike is a former colleague of mine at Cornell's Laboratory of Atomic and Solid State Physics, and I fondly remember the good old days when we all hunched over the theory group's computers while day-dreaming of our future. Mike has since gone on to become an options market-maker at the American Stock Exchange and an Adjunct Associate Professor at Columbia. He &lt;a href="http://www.math.nyu.edu/faculty/avellane/PowerLaw.pdf" target="_blank"&gt;published&lt;/a&gt; some very interesting research on the "stock pinning" phenomenon near options expirations, i.e. stock prices often converge to the nearest strike prices of their options just before expirations.&lt;br /&gt;&lt;br /&gt;---&lt;br /&gt;&lt;br /&gt;If we want to trade directly on various FX ECNs such as HotspotFX or EBS, perhaps because we want to run some &lt;a href="http://epchan.blogspot.ca/2012/03/high-frequency-trading-in-foreign.html" target="_blank"&gt;HFT strategies&lt;/a&gt;, we will need to be sponsored by a prime broker. However, since the Dodd-Frank act has been in full force, no prime brokers that I know of are willing to take on customers with less than $10M assets. (I often feel that the CFTC's primary goal is to prevent small players like myself from ever competing with bigger institutions. Of course, their stated goal is to "protect" us from financial harm ....) The only exception may be CitiFX TradeStream ECN. Has any reader ever traded on this market? Any reviews or comments will be most welcome.&lt;br /&gt;&lt;br /&gt;---&lt;br /&gt;&lt;br /&gt;I am now offering an online workshop "Quantitative Momentum Strategies” to a select number of traders and portfolio managers. It will be&amp;nbsp;conducted in real-time through Skype, and the number of attendees will be limited to 4. See &lt;a href="http://www.epchan.com/my-workshops/" target="_blank"&gt;here&lt;/a&gt; for more information.</description><link>http://feedproxy.google.com/~r/QuantitativeTrading/~3/RbNNBM0gWGg/a-workshop-webinar-and-question.html</link><author>noreply@blogger.com (Ernie Chan)</author><thr:total>46</thr:total><feedburner:origLink>http://epchan.blogspot.com/2013/02/a-workshop-webinar-and-question.html</feedburner:origLink></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-35364652.post-3180335172467105051</guid><pubDate>Sun, 03 Feb 2013 16:38:00 +0000</pubDate><atom:updated>2013-04-29T09:07:05.393-04:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">Strategies</category><title>A stock factor based on option volatility smirk</title><description>A &lt;a href="http://epchan.blogspot.ca/2013/01/the-pseudo-science-of-hypothesis-testing.html?showComment=1359481217691#c3157683415976459113" target="_blank"&gt;reader&lt;/a&gt; pointed out an interesting &lt;a href="http://www.ruf.rice.edu/~yxing/option-skew-FINAL.pdf" target="_blank"&gt;paper &lt;/a&gt;that suggests using option volatility smirk as a factor to rank stocks. Volatility smirk is the difference between the implied volatilities of the OTM put option and the ATM call option. (Of course, there are numerous OTM and ATM put and call options. You can refer to the original paper for a precise definition.) The idea is that informed traders (&lt;i&gt;i.e.&lt;/i&gt; those traders who have a superior ability in predicting the next earnings numbers for the stock) will predominately buy OTM puts when they think the future earnings reports will be bad, thus driving up the price of those puts and their corresponding implied volatilities relative to the more liquid ATM calls. If we use this volatility smirk as a factor to rank stocks, we can form a long portfolio consisting of stocks in the bottom quintile, and a short portfolio with stocks in the top quintile. If we update this long-short portfolio weekly with the latest volatility smirk numbers, it is reported that we will enjoy an annualized excess return of 9.2%.&lt;br /&gt;&lt;br /&gt;As a standalone factor, this 9.2% return may not seem terribly exciting, especially since transaction costs have not been accounted for. However, the beauty of factor models is that you can combine an arbitrary number of factors, and though each factor may be weak, the combined model could be highly predictive. A search of the keyword "factor" on my blog will reveal that I have talked about many different factors applicable to different asset classes in the past. For stocks in particular, there is a &lt;a href="http://epchan.blogspot.ca/2012/01/what-worked-in-2011.html" target="_blank"&gt;short term factor&lt;/a&gt; as simple as the previous 1-day return that worked wonders. Joel Greenblatt's famous "&lt;a href="http://www.amazon.com/gp/product/0470624159/ref=as_li_qf_sp_asin_il_tl?ie=UTF8&amp;amp;camp=1789&amp;amp;creative=9325&amp;amp;creativeASIN=0470624159&amp;amp;linkCode=as2&amp;amp;tag=quantitativet-20" target="_blank"&gt;Little Book that Beats the Market&lt;/a&gt;" used 2 factors to rank stocks (return-on-capital and earnings yield) and generated an APR of 30.8%.&lt;br /&gt;&lt;br /&gt;The question, however, is how we should combine all these different factors. Some factor model&amp;nbsp;aficionados will no doubt propose&amp;nbsp;a linear regression fit, with future return as the dependent variable and all these factors as independent variables. However, my experience with this method has been unrelentingly poor: I have witnessed millions of dollars lost by various banks and funds using this method. In fact, I think the only sensible way to combine them is to simply add them together with equal weights. That is, if you have 10 factors, simply form 10 long-short portfolios each based on one factor, and combine these portfolios with equal capital. As &lt;a href="http://www.amazon.com/dp/0374275637/ref=as_li_qf_sp_asin_til?tag=quantitativet-20&amp;amp;camp=14573&amp;amp;creative=327641&amp;amp;linkCode=as1&amp;amp;creativeASIN=0374275637&amp;amp;adid=1QE6Q9J63V9WFKMZWCFH&amp;amp;&amp;amp;ref-refURL=http%3A%2F%2Fepchan.blogspot.ca%2F" target="_blank"&gt;Daniel Kahneman&lt;/a&gt; said, "Formulas that assign equal weights to all the predictors are often superior, because they are not affected by accidents of sampling".&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;</description><link>http://feedproxy.google.com/~r/QuantitativeTrading/~3/5IXV2jQZEbE/a-stock-factor-based-on-option.html</link><author>noreply@blogger.com (Ernie Chan)</author><thr:total>33</thr:total><feedburner:origLink>http://epchan.blogspot.com/2013/02/a-stock-factor-based-on-option.html</feedburner:origLink></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-35364652.post-9161010336089772883</guid><pubDate>Wed, 02 Jan 2013 14:15:00 +0000</pubDate><atom:updated>2013-01-02T11:05:02.639-05:00</atom:updated><title>The Pseudo-science of Hypothesis Testing</title><description>Backtesting trading strategies necessarily involves a very limited amount of historical data. For example, I seldom test strategies with data older than 2007. Gathering longer history may not improve predictive accuracy since the market structure may have changed substantially. Given such scant data, it is reasonable to question whether the good backtest results (e.g. a high annualized return R) we may have obtained is just due to luck. Many academic researchers try to address this issue by running their published strategies through &amp;nbsp;standard statistical hypothesis testing.&lt;br /&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;You know the drill: the researchers first come up with a supposedly excellent strategy. In a display of false modesty, they then suggest that perhaps a null hypothesis can produce the same good return R. The null hypothesis may be constructed by running the original strategy through some random simulated historical data, or by randomizing the trade entry dates. The researchers then proceed to show that such random constructions are highly unlikely to generate a return equal to or better than R. Thus the null hypothesis is rejected, and thereby impressing you that the strategy is somehow sound.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;As statistical practitioners in fields outside of finance will tell you, this whole procedure is quite meaningless and often&amp;nbsp;misleading.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;The probabilistic syllogism of hypothesis testing has the same structure as the following simple example (devised by Jeff Gill in his paper "The Insignificance of Null Hypothesis Significance Testing"):&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;1) If a person is an American then it is highly unlikely she is a member of Congress.&lt;/div&gt;&lt;div&gt;2) The person is a member of Congress.&lt;/div&gt;&lt;div&gt;3) Therefore it is highly unlikely she is an American.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;The absurdity of hypothesis testing should be clear.&amp;nbsp;In mathematical terms, the probability we are really interested in is the conditional probability that the null hypothesis is true given an observed high return R: P(H&lt;span style="font-size: xx-small;"&gt;0&lt;/span&gt;|R). But instead, the hypothesis test merely gives us the conditional probability of a return R given that the null hypothesis is true: P(R|H&lt;span style="font-size: xx-small;"&gt;0&lt;/span&gt;). These two conditional probabilities are seldom equal.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;But even if we can somehow compute&amp;nbsp;P(H&lt;span style="font-size: xx-small;"&gt;0&lt;/span&gt;|R), it is still of very little use, since there are an infinite number of potential&amp;nbsp;H&lt;span style="font-size: xx-small;"&gt;0&lt;/span&gt;. Just because you have knocked down one particular straw man&amp;nbsp;doesn't say much about your original strategy.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;If hypothesis testing is both meaningless and&amp;nbsp;misleading, why do financial researchers continue to peddle it? Mainly because this is &lt;i&gt;de rigueur&lt;/i&gt; to get published. But it does serve one useful purpose for our own private trading research. Even though a rejection of the null hypothesis in no way shows that the strategy is sound, a failure to reject the null hypothesis will be far more interesting.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;(For other references on criticism of hypothesis testing, read Nate Silver's bestseller "&lt;a href="http://www.amazon.com/dp/159420411X/ref=as_li_qf_sp_asin_til?tag=quantitativet-20&amp;amp;camp=14573&amp;amp;creative=327641&amp;amp;linkCode=as1&amp;amp;creativeASIN=159420411X&amp;amp;adid=1T2D70JWEBA1DVTW0MQD&amp;amp;&amp;amp;ref-refURL=http%3A%2F%2Fepchan.blogspot.ca%2F" target="_blank"&gt;The Signal and The Noise&lt;/a&gt;". Silver is of course the statistician who correctly predicted the winner of all 50 states + D.C. in the 2012 US presidential election. The book is highly relevant to anyone who makes a living predicting the future. In particular, it tells the story of one Bob Voulgaris who makes $1-4M per annum betting on NBA outcomes. It makes me wonder whether I should quit making bets on financial markets and move on to sports.)&lt;/div&gt;</description><link>http://feedproxy.google.com/~r/QuantitativeTrading/~3/MHi1cr4LEeI/the-pseudo-science-of-hypothesis-testing.html</link><author>noreply@blogger.com (Ernie Chan)</author><thr:total>84</thr:total><feedburner:origLink>http://epchan.blogspot.com/2013/01/the-pseudo-science-of-hypothesis-testing.html</feedburner:origLink></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-35364652.post-563761588722470222</guid><pubDate>Thu, 29 Nov 2012 16:48:00 +0000</pubDate><atom:updated>2012-11-29T13:23:45.665-05:00</atom:updated><title>The Importance of 2 (as Sharpe Ratio)</title><description>A reader&amp;nbsp;&lt;a href="http://epchan.blogspot.com/2010/04/how-do-you-limit-drawdown-using-kelly.html?showComment=1352433899601#c2233375091631222369" target="_blank"&gt;ezbentley&lt;/a&gt; recently pointed out a little-noticed fact in the &lt;a href="http://www.edwardothorp.com/sitebuildercontent/sitebuilderfiles/KellyCriterion2007.pdf" target="_blank"&gt;derivation&lt;/a&gt; of Kelly's formula: if we apply the optimal Kelly leverage, then the standard deviation of the annualized &lt;i&gt;compounded &lt;/i&gt;growth rate of your equity is none other than the Sharpe ratio (Sdev=S). This fact is of mild interest in itself, but its implication has relevance to another interesting fact of behavioral finance, so I will reproduce our discussions here.&lt;br /&gt;&lt;br /&gt;Suppose our strategy has an annualized Sharpe ratio of 2. According to the above result, Sdev=2 as well. This may startle some of us: a standard deviation of 200% of our compounded growth rate g - wouldn't ruin be very likely? But check out g itself: g=S^2/2, so g=2 when S=2, which means that g itself is exactly 200%. A Sdev of 200% here means that if the growth rate drops one standard deviation below its mean, we will still manage not to lose money for the year. Another way to put this is that there is a 84.1% chance that our annual return will be greater than 0, based on the Gaussian distribution.&lt;br /&gt;&lt;br /&gt;It gets better if S goes above 2. For example, at S=3, g=4.5, but Sdev is just 3. So you can see that as S goes above 2, a 1 standard deviation fluctuation of g below the mean will still get you a positive number: profitable for the year.&lt;br /&gt;&lt;br /&gt;This is a very interesting result: this means that S=2 is really an important threshold in more ways that I realized. From behavioral finance experiments, we already know that humans demands $2 profits for $1 risk. Given the universal desire of portfolio managers not to lose money on the year, it turns out that the demand of a Sharpe ratio of at least 2 is quite rational!&lt;br /&gt;&lt;br /&gt;===&lt;br /&gt;&lt;br /&gt;Now, time for a couple of public service announcements:&lt;br /&gt;&lt;br /&gt;1) Those who are looking for a way to connect Matlab to Interactive Brokers should check out &lt;a href="http://undocumentedmatlab.com/ib-matlab/"&gt;undocumentedmatlab.com&lt;/a&gt;. The creator of this product has an accompanying book, and the documentation for the product is excellent.&lt;br /&gt;&lt;br /&gt;2) &lt;a href="http://www.nag.com/numeric/MB/manual64_23_1/pdf/GENINT/product.html" target="_blank"&gt;NAG&lt;/a&gt; sells high performance Matlab toolboxes for those who prefer alternatives to the native ones.&lt;br /&gt;&lt;br /&gt;3) &lt;a href="https://twitter.com/FIXGlobalOnline" target="_blank"&gt;Here&lt;/a&gt; is the Twitter feed for FIXGlobal Online, the magazine from the creator of the FIX Protocol, an order submission standard. Interesting breaking news from the global finance scene.</description><link>http://feedproxy.google.com/~r/QuantitativeTrading/~3/VnoJh_698W0/the-importance-of-2-as-sharpe-ratio.html</link><author>noreply@blogger.com (Ernie Chan)</author><thr:total>61</thr:total><feedburner:origLink>http://epchan.blogspot.com/2012/11/the-importance-of-2-as-sharpe-ratio.html</feedburner:origLink></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-35364652.post-7972226156398551363</guid><pubDate>Thu, 25 Oct 2012 20:31:00 +0000</pubDate><atom:updated>2013-04-29T09:07:27.440-04:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">Strategies</category><title>A leveraged ETFs strategy</title><description>In a &lt;a href="http://epchan.blogspot.ca/2009/07/are-triple-leveraged-etfs-suitable-for.html" target="_blank"&gt;post&lt;/a&gt; some years ago, I argued that leveraged ETF (especially the triple leveraged ones) are unsuitable for long-term holdings. Today, I want to present research that suggests leveraged ETF can be very &lt;i&gt;suitable &lt;/i&gt;for &lt;i&gt;short&lt;/i&gt;-term trading.&lt;br /&gt;&lt;br /&gt;The research in question was just &lt;a href="http://ssrn.com/abstract=2161057" target="_blank"&gt;published&lt;/a&gt;&amp;nbsp;by Prof. Pauline Shum and her collaborators at York University. Here is the simplest version of the strategy: if a stock market index has experienced a return &amp;gt;= 2% since the previous day's close up to the current time at 2:15pm ET, then buy this index (via its futures, ETFs, or stock components) right away, and exit at the close with a market-on-close order. Vice versa if the return is &amp;lt;= -2%. The annualized average return from June 2006 to July 2011 was found to be higher than 100%.&lt;br /&gt;&lt;br /&gt;Now this strategy is actually quite well-known among institutional traders, although this is the first time I see the backtest results published. The reason why it works is also quite well-known: it has to do with the fact that every leveraged ETF need to rebalance at the market close in order to keep its leverage constant (at x2 or x3, depending on the fund). If the market index goes up, the fund needs to buy the component stocks; otherwise, it needs to sell stocks. If there is major market movement (with absolute return &amp;gt;= 2%) since the previous close, then the amount of stocks that need to be bought or sold will be correspondingly larger, resulting in momentum in all those stocks near the close. This strategy aims to front-run this rebalancing to take advantage of the anticipated momentum.&lt;br /&gt;&lt;br /&gt;It has been estimated that if the market moves by 1%, the rebalancing could account for up to 16.8% of the market-on-close volume, so the induced momentum can be substantial. Now who is paying for this profits for those momentum traders? Why, the buy-and-hold investors, of course. This loss for the ETFs shows up as their tracking errors, resulting in a cost of as much as 5% per annum for the buy-and-hold investors. Yet another reason we should not be one of those investors!&lt;br /&gt;&lt;br /&gt;As Prof. Shum pointed out, if you trade this strategy live today, you will likely get a lower return, because of all those momentum traders who drove up the price way before the close. However, there may be an&amp;nbsp;ameliorating&amp;nbsp;factor at work here: this momentum is proportional to the NAVof the ETFs. As their NAV goes up with time (either due to additional subscriptions or positive market returns), the returns of this strategy should also increase.&lt;br /&gt;&lt;br /&gt;===&lt;br /&gt;Now for some public service announcements:&lt;br /&gt;&lt;br /&gt;1) A company called Level 3 Data Corp sells proprietary data indicating buying and selling pressure on stocks. Their internal backtests show that adding these data to some common stock trading strategies essentially double their returns. An explanatory &lt;a href="http://www.youtube.com/watch?v=me1g3PU7nzI" target="_blank"&gt;video&lt;/a&gt; is available, and I heard they are offering 3-month free trials.&lt;br /&gt;&lt;br /&gt;2)&amp;nbsp;The London Systematic Traders (LST) Club has asked me to say a few words about their new initiative to build a London centric collaborative community of traders, developers and researchers.&lt;br /&gt;&lt;br /&gt;LST aims to be at the intersection of traders, developers and quants with a strong emphasis community building and on knowledge exchange, providing a trading networks with a very specific focus on systematic, algorithmic (i.e. automated) or quantitative trading.&lt;br /&gt;&lt;br /&gt;Membership is free and open to everybody with an interest in the above topics.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://www.meetup.com/London-Systematic-Traders/"&gt;http://www.meetup.com/London-Systematic-Traders/&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;On Friday, Nov 23, I expect to be hosting a Q&amp;amp;A session with members of the LST (see 2 above) at the Apex Hotel in London. All are welcome. Please visit their website for details.&lt;br /&gt;&lt;br /&gt;3) I will be conducting my &lt;a href="http://www.technicalanalyst.co.uk/training/backtestingEC.htm" target="_blank"&gt;Backtesting&lt;/a&gt; and &lt;a href="http://www.technicalanalyst.co.uk/training/statarb.htm" target="_blank"&gt;Statistical Arbitrage&lt;/a&gt; workshops in London, Nov 19-22, and look forward to seeing some of our readers there!</description><link>http://feedproxy.google.com/~r/QuantitativeTrading/~3/lDC2-ck_84k/a-leveraged-etfs-strategy.html</link><author>noreply@blogger.com (Ernie Chan)</author><thr:total>34</thr:total><feedburner:origLink>http://epchan.blogspot.com/2012/10/a-leveraged-etfs-strategy.html</feedburner:origLink></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-35364652.post-4949175638420541423</guid><pubDate>Mon, 08 Oct 2012 15:04:00 +0000</pubDate><atom:updated>2013-04-29T09:07:56.510-04:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">Strategies</category><category domain="http://www.blogger.com/atom/ns#">Automated trading platforms</category><title>Order flow as a predictor of return</title><description>Order flow is signed transaction volume: if an order is executed at the ask price, the incremental order flow is +(order size); if executed at the bid price, it is -(order size). In certain markets where traders can only buy and sell from market makers but not from each other, a positive order flow means that traders are net buyers of a security. But even in markets where everyone can place and fill orders on a common order book, a positive order flow indicates that informed traders (those willing to aggressively get into a position) are eagerly acquiring a security.&lt;br /&gt;&lt;br /&gt;The neat thing about order flow is that it has proven to be a good momentum indicator. That is to say, a positive flow predicts a positive future return. This might seem trivially obvious, but you have remember that generally speaking, a positive past return by no means predicts a positive future return. That FX order flow possesses this predictive power was shown by Evans and Lyons in a series of &lt;a href="http://www.bis.org/publ/bppdf/bispap02j.pdf" target="_blank"&gt;papers&lt;/a&gt;, but this indicator is useful in many other markets, and at many different time scales. For example, in a &lt;a href="http://www.people.hbs.edu/estafford/Papers/AFS.pdf" target="_blank"&gt;paper&lt;/a&gt; by Coval and Stafford, it was shown that if you can tease out the order flow of a stock due to mutual funds' trading alone, you can also predict its future return up to, say, a quarter. This paper not only shows that order flow is predictive, but that sometimes a specific kind of order flow (in this case, that of mutual funds only) is sometimes more predictive than general order flow. In many cases, traders find that by counting only order flow due to institutional traders, or order flow due to large orders, they can better predict future returns. (No wonder institutional traders are trying their darnedest to break up their orders into small chunks, or to trade in dark pools!) I recently also heard that order flow into sector ETFs can be predictive of that sector's return. If any reader has read papers or has experience with this type of sector rotation model, please leave a comment!&lt;br /&gt;&lt;br /&gt;Despite the proven usefulness of order flow, not too many retail traders utilize it. The reason is simple: it can be hard to measure. In FX in particular, many markets do not report trade information, or they report with a sufficient delay such that the information has no predictive utility. Even for markets that report instantaneous trade information, you would need a good piece of software to capture every bid, ask, trade, and trade size, and store them in an array, in order to compute order flow, an operation that most retail trading software cannot accomplish. However, this barrier to entry may just mean that there are still decent alpha to be extracted from this indicator.&lt;br /&gt;&lt;br /&gt;Now, a bunch of public service announcements ...&lt;br /&gt;&lt;br /&gt;===&lt;br /&gt;&lt;br /&gt;A new algorithmic trading platform called Rizm designed for retail traders is now available. You can sign up for their beta trial &lt;a href="http://equametrics.com/" target="_blank"&gt;here&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;===&lt;br /&gt;&lt;br /&gt;&lt;a href="https://app.quantopian.com/posts/ernie-chans-gold-vs-gold-miners-stat-arb" target="_blank"&gt;Quantopian&lt;/a&gt; has created an event-driven version of my &lt;a href="http://epchan.blogspot.ca/2011/06/when-cointegration-of-pair-breaks-down.html" target="_blank"&gt;gold/gold-miners arb strategy&lt;/a&gt;&amp;nbsp;with source codes and analysis available. I find that the performance metrics clear and useful: better than the output from my own backtest programs! (Quantopian is a platform where you can share backtest results and codes with other traders.)&lt;br /&gt;&lt;br /&gt;===&lt;br /&gt;&lt;br /&gt;&lt;a href="http://arb-maker.com/" target="_blank"&gt;Arbmaker&lt;/a&gt;&amp;nbsp;is a platform for pair traders, and it incorporates software for cointegration tests, has integrated data feed from many vendors, and allows automated order submission to Interactive Brokers. Neural networks and Kalman filter are also included.&lt;br /&gt;&lt;br /&gt;===&lt;br /&gt;&lt;br /&gt;Finally, I will be giving a talk titled "Backtesting and Its Pitfalls" at the World MoneyShow at the Metro Toronto Convention Centre on Saturday, October 20. Interested readers can register &lt;a href="https://secure.moneyshow.com/msc/toms/registration.asp?sid=TOMS12&amp;amp;scode=029492" target="_blank"&gt;here&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;</description><link>http://feedproxy.google.com/~r/QuantitativeTrading/~3/cyzdQ7NqZbw/order-flow-as-predictor-of-return.html</link><author>noreply@blogger.com (Ernie Chan)</author><thr:total>20</thr:total><feedburner:origLink>http://epchan.blogspot.com/2012/10/order-flow-as-predictor-of-return.html</feedburner:origLink></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-35364652.post-6370834161133230242</guid><pubDate>Sat, 04 Aug 2012 20:56:00 +0000</pubDate><atom:updated>2012-08-04T17:05:31.235-04:00</atom:updated><title>An options workshop and other miscellany</title><description>I confess I have always found it hard to trade options. This is despite having read some of the "bibles" of options trading, including Lawrence McMillan's &lt;a href="http://www.amazon.com/dp/0735201978?tag=quantitativet-20&amp;amp;camp=14573&amp;amp;creative=327641&amp;amp;linkCode=as1&amp;amp;creativeASIN=0735201978&amp;amp;adid=1J02QNSXDTHFC1DVSZ6C&amp;amp;&amp;amp;ref-refURL=http%3A%2F%2Fepchan.blogspot.ca%2F" rel="nofollow" target="_blank"&gt;Options as a Strategic Investment&lt;/a&gt;&amp;nbsp;and Euan Sinclair's &lt;a href="http://www.amazon.com/dp/0735201978?tag=quantitativet-20&amp;amp;camp=14573&amp;amp;creative=327641&amp;amp;linkCode=as1&amp;amp;creativeASIN=0735201978&amp;amp;adid=1J02QNSXDTHFC1DVSZ6C&amp;amp;&amp;amp;ref-refURL=http%3A%2F%2Fepchan.blogspot.ca%2F" rel="nofollow" target="_blank"&gt;Option Trading: Pricing and Volatility Strategies and Techniques&lt;/a&gt;.&amp;nbsp;Partly that is because I prefer simple strategies, and options strategies are rarely simple. Partly that is because I was brought up on stocks, but stock options are depressingly illiquid. Most successful options traders that I know of prefer to trade index options instead, an area that I unfortunately have no intuition at all. Papers and books written by options professionals on this topic tend to be dense with equations, and worse, they seldom focus on the practical side of trading.&lt;br /&gt;&lt;br /&gt;That's why I am pleased to learn that Larry Connors, whose books I enjoy due to their simplicity of exposition, is presenting his first ever quantitative index options trading seminars. Interested traders can register for his free preview webinars on August 9 and 15 &lt;a href="http://presentations.tradingmarkets.com/1580745/connors-research-quantified-options-trading-strategy-course?utm_source=Chan" rel="nofollow" target="_blank"&gt;here&lt;/a&gt;, or a pre-recorded preview &lt;a href="http://presentations.tradingmarkets.com/1580804/1st-quantified-options-trading-strategies-summit-preview-video?utm_source=Chan" target="_blank"&gt;here&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;===&lt;br /&gt;&lt;br /&gt;Speaking of seminars, readers in Asia may be interested to know that my own workshops on&lt;a href="http://www.technicalanalyst.co.uk/training/backtestingEC.htm" target="_blank"&gt; Backtesting&lt;/a&gt; and &lt;a href="http://www.technicalanalyst.co.uk/training/statarb.htm" target="_blank"&gt;Statistical Arbitrage&lt;/a&gt; will be held in Hong Kong on October 2-5. The same workshops will be held in London on November 19-22.&lt;br /&gt;&lt;br /&gt;(I enjoy giving those workshops very much, because many of the participants are institutional traders whose knowledge and points of view are very much at the cutting edge. Past participants include quants and traders from, in no particular order, Goldman Sachs, Morgan Stanley, Royal Bank of Scotland, Bank of America, UBS, Societe Generale, Deutsche Bank, BNP Paribas, JP Morgan, Barclays, Citigroup, Blackrock, and various other Asian and European hedge funds, energy companies, banks, and asset managers.&amp;nbsp;&amp;nbsp;I humbly submit that the in-class discussions are sometimes more interesting than my prepared materials.)&lt;br /&gt;&lt;br /&gt;===&lt;br /&gt;&lt;br /&gt;I &lt;a href="http://epchan.blogspot.ca/2012/03/high-frequency-trading-in-foreign.html" target="_blank"&gt;wrote&lt;/a&gt; some time ago about those FX brokers or ECNs where algo-traders can colocate their trading programs to lower latency for a reasonable price. There are also similar options for futures algo-traders. For e.g. &lt;a href="http://ticktotrade.com/" target="_blank"&gt;Optimus Trading Group&lt;/a&gt; provides a market data service called Rithmic which is colocated at the major futures exchanges, and traders can colocate with Rithmic to reduce latency. Of course, traders can also directly colocate at the new &lt;a href="http://www.cmegroup.com/globex/files/CME-Co-Location-Services-Overview.pdf" target="_blank"&gt;CME data center in Aurora, IL&lt;/a&gt;. I suspect, though, that the cost of the latter option will be considerable.&lt;br /&gt;&lt;br /&gt;====&lt;br /&gt;&lt;br /&gt;Finally, as a quant trader, I nevertheless read macroeconomic analyses occasionally, if only to figure out why some of my strategies suddenly start to fail. One website that provides interesting analysis of the energy markets is oilprice.com. In particularly, this &lt;a href="http://oilprice.com/Interviews/Global-Trade-Likely-to-Collapse-if-Romney-Wins-Interview-with-Mike-Shedlock.html" rel="nofollow" target="_blank"&gt;interview&lt;/a&gt; with economic commentator Mike Shedlock is&amp;nbsp;unusually&amp;nbsp;detailed and thoughtful.</description><link>http://feedproxy.google.com/~r/QuantitativeTrading/~3/uQ80vNajkQk/an-options-workshop-and-other-miscellany.html</link><author>noreply@blogger.com (Ernie Chan)</author><thr:total>39</thr:total><feedburner:origLink>http://epchan.blogspot.com/2012/08/an-options-workshop-and-other-miscellany.html</feedburner:origLink></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-35364652.post-7328811305218889285</guid><pubDate>Tue, 10 Jul 2012 18:53:00 +0000</pubDate><atom:updated>2013-04-29T09:08:09.695-04:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">Strategies</category><title>Extracting roll returns from futures</title><description>Futures returns consist of two components: the returns of the spot price and the "roll returns". This is kind of obvious if you think about it: suppose the spot price remains constant in time (and therefore has zero return). Futures with different maturities will still have different prices at any point in time, and yet they must all converge to the same spot price at expirations, which means they must have non-zero returns during their lifetimes.&amp;nbsp;&lt;span style="background-color: white;"&gt;This roll return is in action every day, not just during the rollover to the next nearest contract. For some futures, the magnitude of this roll return can be very large: it averages about -50% annualized for VX, the volatility futures. Wouldn't it be nice if we can somehow extract this return?&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;In theory, extracting this return should be easy: if a future is in backwardation (positive roll return), just buy the future and short the underlying asset, and vice versa if it is in contango. Unfortunately, shorting, or even buying, an underlying asset is not easy. Except for precious metals, most commodity ETFs that hold "commodities" actually hold only their futures (e.g. USO, UNG, ...), so they are of no help at all in this arbitrage strategy. Meanwhile, it is also a bit inconvenient for us to go out and buy a few oil tankers ourselves.&lt;br /&gt;&lt;br /&gt;But in arbitrage trading, we often do not need an exact arbitrage relationship: a statistical likely relationship is good enough. So instead of using a commodity ETF as a hedge against the future, we can use a commodity-producer ETF. For example, instead of using USO as a hedge, we can use XLE, the energy sector ETF that holds energy producing companies. These ETFs should have a higher degree of correlation with the spot price than do the futures, and therefore very suitable as hedges. In cases where the futures do not track commodities (as in the case of VX), however, we have to look harder to find the proper hedge.&lt;br /&gt;&lt;br /&gt;Which brings me to this fresh-off-the-press &lt;a href="http://papers.ssrn.com/sol3/papers.cfm?abstract_id=2094510" target="_blank"&gt;paper by David Simon and Jim Campasano&lt;/a&gt;.&amp;nbsp;(Hat tip: Simon T.) This paper suggests a trading strategy that tries to extract the very juicy roll returns of VX. The hedge they suggest is -- you guessed it! -- the ES future. In a nutshell:&lt;span style="background-color: white;"&gt;&amp;nbsp;if VX is in contango (which is most of the time), just short both VX and ES, and vice versa if VX is in backwardation.&amp;nbsp;&lt;/span&gt;&lt;br /&gt;&lt;span style="background-color: white;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="background-color: white;"&gt;Why does ES work as a good hedge? Of course, its very negative correlation with VX is the major factor. But one should not overlook the fact that ES also has a very small roll return (about +1.5% annualized). In other words, if you want to find a future to act as a hedge, look for ones that have an insignificant roll return. (Of course, if we can find a future that has high correlation with your original future but which has a high roll return of the opposite sign, that would be ideal. But we are seldom that lucky.)&lt;/span&gt;&lt;br /&gt;&lt;span style="background-color: white;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="background-color: white;"&gt;P.S. The reader Simon who referred me to this paper also drew my attention to an apparent contradiction between its conclusion and my earlier blog post: &lt;a href="http://epchan.blogspot.ca/2011/01/shorting-vix-calendar-spread.html" target="_blank"&gt;Shorting the VIX Calendar Spread&lt;/a&gt;. This paper says that it is profitable to short VX&amp;nbsp;&lt;/span&gt;&lt;span style="background-color: white;"&gt;when it is in contango&amp;nbsp;&lt;/span&gt;&lt;span style="background-color: white;"&gt;and hedge with short ES, while I said it may not be profitable to short the front contract of VX when it is in contango and hedge with long back contract of VX. Both statements are true: hedging with the back contract of VX brings very little benefit because both the front and back contracts are suffering from very similar roll returns, so there is little return left when you take opposite positions in them!&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;</description><link>http://feedproxy.google.com/~r/QuantitativeTrading/~3/-l740q28aGc/extracting-roll-returns-from-futures.html</link><author>noreply@blogger.com (Ernie Chan)</author><thr:total>25</thr:total><feedburner:origLink>http://epchan.blogspot.com/2012/07/extracting-roll-returns-from-futures.html</feedburner:origLink></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-35364652.post-617835404029376426</guid><pubDate>Tue, 19 Jun 2012 16:04:00 +0000</pubDate><atom:updated>2013-04-29T09:08:32.509-04:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">Strategies</category><category domain="http://www.blogger.com/atom/ns#">Book reviews</category><title>Momentum strategies: a book review</title><description>As a devout mean-reversion trader, I find Mike Dever's new book "&lt;a href="http://www.amazon.com/gp/product/0983504016/ref=as_li_tf_tl?ie=UTF8&amp;amp;tag=quantitativet-20&amp;amp;linkCode=as2&amp;amp;camp=1789&amp;amp;creative=9325&amp;amp;creativeASIN=0983504016" target="_blank"&gt;Jackass Investing&lt;/a&gt;" unexpectedly well-argued and readable.&lt;br /&gt;&lt;br /&gt;You see,&lt;span style="background-color: white;"&gt;&amp;nbsp;momentum and mean-reversion traders live in two separate universes, and they are often mutually incomprehensible to each other. Dever, as a CTA, inhabits the momentum universe. Example: my favorite performance measure, the Sharpe ratio, has been&amp;nbsp;brusquely&amp;nbsp;dispatched as a bad measurement of risk, and drawdown becomes king. But all for good reasons: Dever argues that Sharpe ratio measures only the daily volatility of returns, but disregarded the "black swan" events, which are much better captured by the maximum drawdown. I agree with the author on this point, but there are other uses of Sharpe ratio: a high Sharpe ratio strategy does indicate high statistical significance of the trading strategy, a claim that momentum strategies can seldom make. I often think of momentum strategies as being long options: you have to keep paying premium until one day, you make them all back with a home run. But when you are backtesting a strategy, how would you know that the rare, statistically insignificant, home run was not due to data snooping bias? Unless of course, like the author, you have fundamental insights into the traded instruments.&lt;/span&gt;&lt;br /&gt;&lt;span style="background-color: white;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="background-color: white;"&gt;Fundamental insights are in fact one of the delicious highlights of this book. Dever describes his orange juice futures strategy using the "marginal cost of production" as a fundamental valuation tool. He argues that orange juice cannot be sold below this cost, since farmers would have no incentive for production otherwise. And he was right: orange juice futures started to rebound from the 27-year low of 55 cents/pound in May 2004, to almost 90 cents/pound in September (thanks partly to hurricanes hitting Florida). Dever went long at 70 cents. Oh, how we quantitative traders would love to have the confidence that such insights inspire!&lt;/span&gt;&lt;br /&gt;&lt;span style="background-color: white;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="background-color: white;"&gt;Of course, I don't agree with everything written in the book. For example, though the author rightly pointed out that the distribution of returns often have a positive kurtosis, he uses that as evidence of trending behavior. While I agree that price trends can indeed produce positive kurtosis, we can certainly construct mean-reverting price series with occasional catastrophes that have the same kurtosis. To us mean-reversion traders, positive kurtosis is not an invitation to "follow-the-trend", but as a warning sign to find risk management measures that protect us from catastrophes.&amp;nbsp;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Even though momentum strategies in general are in a state of trauma right now (more on that later), Dever nevertheless makes a good case why we should include them as part of our portfolio of strategies. Comparing the S&amp;amp;P500 index (SPX) with the S&amp;amp;P Diversifed Trends Indicator (DTI, a simple trend-following strategies on 24 futures), he finds that the Sharpe ratio (though of course he refuses to use that hated term) of the DTI is more than double that of the SPX, with only about 1/3 of the maximum drawdown. But before you, the reader, decides to join the momentum bandwagon, I invite you to take a look at a plot of DTI's values since inception:&lt;br /&gt;&lt;table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td style="text-align: center;"&gt;&lt;a href="http://1.bp.blogspot.com/--sI96dvfXv8/T-Cf-3ZKJ1I/AAAAAAAAA9M/yuSFfBmYZoE/s1600/SP_DTI.gif" imageanchor="1" style="margin-left: auto; margin-right: auto;"&gt;&lt;img alt="" border="0" height="192" src="http://1.bp.blogspot.com/--sI96dvfXv8/T-Cf-3ZKJ1I/AAAAAAAAA9M/yuSFfBmYZoE/s320/SP_DTI.gif" title="S&amp;amp;P DTI " width="320" /&gt;&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td class="tr-caption" style="text-align: center;"&gt;S&amp;amp;P DTI index&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;Since its high watermark in 2008/12/5, this representative momentum strategy has been in a relentless drawdown. Why? This is due to another &lt;a href="http://www.columbia.edu/~kd2371/papers/unpublished/mom4.pdf" target="_blank"&gt;well-studied and troubling property&lt;/a&gt;&amp;nbsp;of momentum strategies: they always performed poorly for several years after a financial crisis.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;</description><link>http://feedproxy.google.com/~r/QuantitativeTrading/~3/-PCP0wfAtso/momentum-strategies-book-review.html</link><author>noreply@blogger.com (Ernie Chan)</author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://1.bp.blogspot.com/--sI96dvfXv8/T-Cf-3ZKJ1I/AAAAAAAAA9M/yuSFfBmYZoE/s72-c/SP_DTI.gif" height="72" width="72" /><thr:total>54</thr:total><feedburner:origLink>http://epchan.blogspot.com/2012/06/momentum-strategies-book-review.html</feedburner:origLink></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-35364652.post-1996572864561896812</guid><pubDate>Thu, 26 Apr 2012 19:48:00 +0000</pubDate><atom:updated>2012-04-26T15:48:24.596-04:00</atom:updated><title>A few announcements</title><description>First, an iPad version of this blog has been launched, so if you are reading this on an iPad, the look will be different.&amp;nbsp;If you want to go back to the old look, just hit Page Turn in the bottom left corner and choose the option there. Any comments or suggestions on this new look are most welcome!&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Second, and this is probably irrelevant to most of you reading this blog, a Chinese translation of my book Quantitative Trading is now &lt;a href="http://www.books.com.tw/exep/prod/booksfile.php?item=0010528455" target="_blank"&gt;available&lt;/a&gt;.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Third, and most interesting, Larry Connors will be hosting a &lt;a href="http://presentations.tradingmarkets.com/1580186/special-presentation-to-ernie-chans-trading-group-connors-research-trading-strategy-series-w?utm_source=CREmailPartner&amp;amp;utm_campaign=None&amp;amp;utm_medium=Chan&amp;amp;utm_content=120501-CRTSSWP" target="_blank"&gt;webinar&lt;/a&gt; on "How to Trade High Probability Stock Gaps" on&amp;nbsp;&lt;strong style="text-align: left;"&gt;Tuesday, May 1, 2:00pm ET&lt;/strong&gt;&lt;span style="text-align: left;"&gt;.&lt;/span&gt;&amp;nbsp;(Click on link to register.) It is sheer coincidence that I was just writing about stock gaps in my &lt;a href="http://epchan.blogspot.ca/2012/04/life-and-death-of-strategy.html" target="_blank"&gt;previous post&lt;/a&gt;! I have always found Larry's strategies to be clear, concise, and simple - exactly the ingredients for out-of-sample as opposed to in-sample returns!&lt;/div&gt;</description><link>http://feedproxy.google.com/~r/QuantitativeTrading/~3/I9iwyHGOLbU/few-announcements.html</link><author>noreply@blogger.com (Ernie Chan)</author><thr:total>59</thr:total><feedburner:origLink>http://epchan.blogspot.com/2012/04/few-announcements.html</feedburner:origLink></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-35364652.post-6705992173073923207</guid><pubDate>Fri, 20 Apr 2012 16:05:00 +0000</pubDate><atom:updated>2013-04-29T09:08:49.835-04:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">Strategies</category><title>The life and death of a strategy</title><description>Sometimes it is instructive to look back at some strategies that used to thrive, and then quite suddenly contracted a chronic illness that ultimately led to its demise. It gives us a sense of the unreliability of backtests and curb our over-confidence, which is always useful when dealing with the financial markets.&lt;br /&gt;&lt;br /&gt;One good example is a well-known strategy that we called "buy-on-gap". In its simplest version, just buy at the open 100 stocks within the S&amp;amp;P500 which have the lowest returns from their previous day's lows to the current day's open, provided that these returns are lower than one standard deviation. (The standard deviation is computed as the 90-day moving standard deviation of close-to-close returns of a stock.) Exit such &amp;nbsp;long positions at the day's close.&lt;br /&gt;&lt;br /&gt;Many traders know of variants of this strategy, and I started trading it around the beginning of 2007, and in fact, it formed part of my first fund's portfolio of strategies. You can see the cumulative return chart below (click to enlarge) from 2007/01/03-2008/10/29. The APR is 19%, &lt;i&gt;unlevered&lt;/i&gt;. The Sharpe ratio is 1.4 and the maximum drawdown is just 4%. Note that Lehman Brothers went bankrupt on 2008/09/15, and this is a long-only strategy, yet the performance was spectacular in September-October 2008. We were patting ourselves furiously on the back.&lt;br /&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://4.bp.blogspot.com/-EOJE2qyS8Ek/T5GC_AJVYeI/AAAAAAAAA6o/T6uYgkoqzX0/s1600/cumret_bog2.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="224" src="http://4.bp.blogspot.com/-EOJE2qyS8Ek/T5GC_AJVYeI/AAAAAAAAA6o/T6uYgkoqzX0/s320/cumret_bog2.png" width="320" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;Now look what happened after this happy period.&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://3.bp.blogspot.com/-Q5Abo4IpY0M/T5GEXNv_lJI/AAAAAAAAA6w/8lQynToRHVw/s1600/cumret_bog2_2.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="231" src="http://3.bp.blogspot.com/-Q5Abo4IpY0M/T5GEXNv_lJI/AAAAAAAAA6w/8lQynToRHVw/s320/cumret_bog2_2.png" width="320" /&gt;&lt;/a&gt;&lt;/div&gt;&amp;nbsp;The APR was -6%. 2008/10/29 turned out to be the high watermark.&lt;br /&gt;&lt;br /&gt;I have seen some strategies that have the opposite behavior: poor performance prior to 2009, and stellar performance since then. Was there a structural break in the market due to the financial crisis? Was this due to the advent of high frequency trading? The declining volume in the equities market? I will leave these deep questions to financial economists. The only lesson I have learned from this and other examples is that, once a strategy is in decline for some time, it seldom comes back to health, and the best course of action is to bury it swiftly.</description><link>http://feedproxy.google.com/~r/QuantitativeTrading/~3/KxaaPbmqbHg/life-and-death-of-strategy.html</link><author>noreply@blogger.com (Ernie Chan)</author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://4.bp.blogspot.com/-EOJE2qyS8Ek/T5GC_AJVYeI/AAAAAAAAA6o/T6uYgkoqzX0/s72-c/cumret_bog2.png" height="72" width="72" /><thr:total>63</thr:total><feedburner:origLink>http://epchan.blogspot.com/2012/04/life-and-death-of-strategy.html</feedburner:origLink></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-35364652.post-2237953507761473634</guid><pubDate>Fri, 23 Mar 2012 17:56:00 +0000</pubDate><atom:updated>2012-03-23T13:56:56.960-04:00</atom:updated><title>High-frequency trading in the foreign exchange market</title><description>This is the title of a &lt;a href="http://www.bis.org/publ/mktc05.pdf" target="_blank"&gt;report&lt;/a&gt; published by the Bank of International Settlements (which serves central banks around the world) in September 2011. As a Forex trader myself, I of course&amp;nbsp;peruse it with great interest hoping to glimpse whatever is the state-of-the-art. Here are a few interesting nuggets, together with my commentary:&lt;br /&gt;&lt;br /&gt;1) FX HFT operate with a latency of less than 1 ms, while most of us mere algorithmic traders typically suffer a latency of at least 10ms. &amp;nbsp;For example, Interactive Brokers does not yet provide collocation facilities for its customers, so the best we can do is to place our trading servers on the internet backbone close to its Stamford, CT, location. The best round-trip ping time is 10ms. Those who trade with FXCM may have a better chance for lower latency, as they provide &lt;i&gt;free &lt;/i&gt;collocation to their clients. Those who trade on the ECN FXall can &lt;a href="http://www.equinix.com/company/news-and-events/press-releases/americas/2009/fxall_offers_foreign_exchange_platform_en/" target="_blank"&gt;collocate at their Equinix data center&lt;/a&gt;, while &lt;a href="http://www.fcm360.com/financial-industry-solutions/foreign-exchange-hosting-colocation-connectivity/icap-ebs-servers/" target="_blank"&gt;FCM360&lt;/a&gt; provides collocation service to EBS traders.&amp;nbsp;I cannot find any collocation service for Hotspot FX or Currenex. If you know of such services, or FX brokers who provide collocation, do leave a comment!&lt;br /&gt;&lt;br /&gt;2) HFT typically operate in markets with high liquidity and low volatility. The former is not surprising, since markets with low liquidity has few counter-parties to take advantage of. The latter requires a bit of nuance. I think most HFT would benefit from high volatility in a mean-reverting market, but unfortunately high volatility is usually correlated with market in a free fall. So don't be surprised if you find that HFT-provided liquidity suddenly disappears when the market is in stress, though the BIS report stated that they are also quick to re-enter the market once the turmoil is over.&lt;br /&gt;&lt;br /&gt;3) As a&amp;nbsp;corollary&amp;nbsp;of 2), HFT mostly trade in the major currency pairs. But increasingly, NZD and MXN have drawn many automated and HF traders.&lt;br /&gt;&lt;br /&gt;4) Almost by definition, the bid/ask quotes placed by HFT tend to remain on the book for a very short time, measured in ms, unless forced by the exchange to stay longer. EBS and Reuters both has minimum quote life or minimum fill ratio. One exchange that does &lt;i&gt;not&lt;/i&gt;&amp;nbsp;have such minimums is Currenex, which is therefore particularly attractive to HF trading. Hence if you are not a HF player, and do not wish to be taken advantage of &amp;nbsp;by a HF player, be wary of Currenex!&lt;br /&gt;&lt;br /&gt;5) Two of the&amp;nbsp;favourite&amp;nbsp;categories of HFT strategies: triangle arbitrage and liquidity-redistribution (taking advantage of pricing discrepancies across different trading platforms.) Despite the bad reputation HFTers have been acquiring in the last few years, I think they do provide a useful service to other algo traders like myself via these 2 strategies. It is a hassle to keep looking for a better broker/prices for your strategy!</description><link>http://feedproxy.google.com/~r/QuantitativeTrading/~3/XiagQqGzypU/high-frequency-trading-in-foreign.html</link><author>noreply@blogger.com (Ernie Chan)</author><thr:total>55</thr:total><feedburner:origLink>http://epchan.blogspot.com/2012/03/high-frequency-trading-in-foreign.html</feedburner:origLink></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-35364652.post-7058330961437969371</guid><pubDate>Sat, 03 Mar 2012 16:01:00 +0000</pubDate><atom:updated>2013-05-03T08:31:51.783-04:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">Strategies</category><title>Hidden Markov model applied to FX prediction</title><description>I read with interest an older paper "&lt;a href="http://research.stlouisfed.org/wp/2001/2001-021.pdf" target="_blank"&gt;Can Markov Switching Models Predict Excess Foreign Exchange Returns?&lt;/a&gt;" by Dueker and Neely of the Federal Reserve Bank of St. Louis. I have a fondness for hidden Markov models because of its great success in speech recognition applications, but I confess that I have never been able to create a HMM model that outperforms simple technical indicators. I blame that both on my own lack of creativity as well as the fact that HMM tend to have too many parameters that need to be fitted to historical data, which makes it vulnerable to data snooping bias. Hence I approached this paper with the great hope that experts can teach me how to apply HMM properly to finance.&lt;br /&gt;&lt;br /&gt;The objective of the model is simple: to predict the excess return of an exchange rate over an 8-day period. (Excess return in this context is measured by the % change in the exchange rate minus the interest rate differential &amp;nbsp;between the base and quote currencies of the currency pair.) If the expected excess return is higher than a threshold (called "filter" in the paper), then go long. If it is lower than another threshold, go short. Even though the prediction is on a 8-day return, the trading decision is made daily.&lt;br /&gt;&lt;br /&gt;The excess return is assumed to have a 3-parameter student-t distribution. The 3 parameters are the mean, the degree of freedom, and the scale. The scale parameter (which controls the variance) can switch between a high and low value based on a Markov model. The degree of freedom (which controls the kurtosis, a.k.a. "thickness of the tails") can also switch between 2 values based on another Markov model. The mean is linearly dependent on the values assumed by the degree of freedom and the scale as well as another Markov variable that switches between 2 values. Hence the mean can assume 8 distinct values. The 3 Markov models are independent. The student-t distribution is more appropriate for the modelling financial returns than normal distribution because of the allowance for heavy tails. The authors also believe that this model captures the switch between periods of high and low volatility, with the consequent change of preference (=different mean returns) for "safe" versus "risky" currencies, a phenomenon well-demonstrated in the period between August 2011 to January 2012.&lt;br /&gt;&lt;br /&gt;The parameters of the Markov models and the student-t distributions are estimated in the in-sample period (1974-1981) for each currency pair in order to minimize the cumulative deviation of the excess returns from zero. There are a total of 14 parameters to be so estimated. After these estimations, we have to also estimate the 2 trading thresholds by maximizing the in-sample return of the trading strategy, assuming a transaction costs of 10 basis point per trade.&lt;br /&gt;&lt;br /&gt;With this large number (16 in total) of parameters, I dread to see the out-of-sample (1982-2005) results. Amazing, these are far better than I expected: the annualized returns range from 1.1% to 7.5% for 4 major currency pairs. The Sharpe ratios are not as impressive: they range from 0.11 to 0.71.&amp;nbsp;Of course, when &amp;nbsp;researchers report out-of-sample results, one should take that with a grain of salt. If the out-of-sample results weren't good, they wouldn't be reporting them, and they would have kept changing the underlying model until good "out-of-sample" results are obtained! So it is really up to us to implement this model, apply it to data after 2005 and to more currency pairs, to find out if there is really something here. In fact, this is the reason why I prefer to read older papers - to allow for the possibility of true out-of-sample tests immediately.&lt;br /&gt;&lt;br /&gt;What do you think can be done to improve this model? I suspect that as a first step, one can see whether the estimated Markov states correspond reasonably to what traders think of as risk-on vs risk-off regimes. If they do, then regardless of the usage of this model as a signal generator, it can at least generate good&amp;nbsp;&lt;a href="http://epchan.blogspot.com/2011/12/risk-indicators.html" target="_blank"&gt;risk indicators&lt;/a&gt;. If not, then maybe the hidden Markov model need to be replaced with a Markov model that is conditioned on observable indicators.</description><link>http://feedproxy.google.com/~r/QuantitativeTrading/~3/5I-UbhpzL48/hidden-markov-model-applied-to-fx.html</link><author>noreply@blogger.com (Ernie Chan)</author><thr:total>23</thr:total><feedburner:origLink>http://epchan.blogspot.com/2012/03/hidden-markov-model-applied-to-fx.html</feedburner:origLink></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-35364652.post-9105077643393403741</guid><pubDate>Mon, 13 Feb 2012 15:47:00 +0000</pubDate><atom:updated>2012-02-13T10:48:07.009-05:00</atom:updated><title>Ideas from a psychologist</title><description>I have just finished reading Daniel Kahneman's bestseller "&lt;a href="http://www.amazon.com/gp/product/0374275637/ref=as_li_qf_sp_asin_tl?ie=UTF8&amp;amp;tag=quantitativet-20&amp;amp;linkCode=as2&amp;amp;camp=1789&amp;amp;creative=9325&amp;amp;creativeASIN=0374275637%22%3EThinking,%20Fast%20and%20Slow%3C/a%3E%3Cimg%20src=%22http://www.assoc-amazon.com/e/ir?t=quantitativet-20&amp;amp;l=as2&amp;amp;o=1&amp;amp;a=0374275637%22%20width=%221%22%20height=%221%22%20border=%220%22%20alt=%22%22%20style=%22border:none%20!important;%20margin:0px%20!important;%22" target="_blank"&gt;Thinking, Fast and Slow&lt;/a&gt;", and found it full of inspirations important for traders. This is no surprise, of course, since Kahneman won the 2002 Nobel prize in economics for his work on decision theory. Here are some of the notables:&lt;br /&gt;&lt;br /&gt;1) &lt;b&gt;Simple sum is often better than a linear regression fit.&lt;/b&gt; Remember my constant mantra that "simpler is better" when building trading models? I have always advocated linear regression over nonlinear models, but Kahneman went a step further. He said that in social science modeling (which of course includes financial markets modeling), assigning equal weights to the predictive factors is often superior to weighting them using multivariate linear regressors&amp;nbsp;&lt;i&gt;when applied to out-of-sample data&lt;/i&gt;.&lt;br /&gt;&lt;br /&gt;2) &lt;b&gt;Overconfidence in corporate acquisitions. &lt;/b&gt;Managers of acquiring companies often believe that they are better than the managers of acquirees. This overconfidence has several causes: there is an illusion of control which overemphasizes the role of skill and neglects the role of luck, and there is a focus on what one knows and a neglect of what one does not, etc. The market already knows this: the stock of the acquirer usually suffers a sell-off upon announcement of the acquisition, because the result of any acquisition is more often bad than good, but the question is whether it has sufficiently discounted this phenomenon. Would shorting the stock of an acquirer at the completion of an acquisition and holding the short position for, say, 5 years, hedging this position with SPY, be profitable?&lt;br /&gt;&lt;br /&gt;3) &lt;b&gt;Premortem. &lt;/b&gt;After designing a trading strategy, it is always useful to write a brief imaginary history of how it has become an unmitigated financial disaster for you a few years from now. This will likely reveal scenarios that you have not previously thought of, and triggering additional risk management measures.&lt;br /&gt;&lt;br /&gt;4) &lt;b&gt;Risk seeking in the face of losses. &lt;/b&gt;Suppose you are running a strategy that has a fixed holding period. Have you ever extended this holding period when the position is losing, in the hope that the position will recoup some of its losses? I have, and the result was double the loss I would have suffered had I exited on time. Apparently this is a very common suboptimal behavioral bias: this is why many defendants with a weak legal case often risk continued litigations instead of accepting an unfavorable settlement.&lt;br /&gt;&lt;br /&gt;5) &lt;b&gt;Why do we often demand Sharpe ratio &amp;nbsp;&amp;gt;=2? &lt;/b&gt;Psychological experiments have shown that people find the pain of losing $1 can only be compensated by the pleasure of winning&amp;nbsp;$2. So if we equate standard deviation as the average drawdown of a strategy, then we need to have twice the average return!&lt;br /&gt;&lt;br /&gt;Many businesses have profited from arbitraging the difference between rational decisions and biased decisions that people commonly made. (For e.g. lottery franchises benefit from people overweighting the probability of winning, sellers of extended warranties benefit from buyers' risk-aversion.) I wonder if there are still&amp;nbsp;opportunities left for rational traders to take advantage of the biased decisions of irrational traders?</description><link>http://feedproxy.google.com/~r/QuantitativeTrading/~3/unV5qgZMefk/ideas-from-psychologist.html</link><author>noreply@blogger.com (Ernie Chan)</author><thr:total>48</thr:total><feedburner:origLink>http://epchan.blogspot.com/2012/02/ideas-from-psychologist.html</feedburner:origLink></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-35364652.post-785550411785053767</guid><pubDate>Mon, 30 Jan 2012 17:34:00 +0000</pubDate><atom:updated>2012-01-30T12:34:59.587-05:00</atom:updated><title>What worked in 2011?</title><description>We all know that 2011 was a bad year for many hedge funds, with the average fund &lt;a href="http://online.wsj.com/article/SB10001424052970203806504577180941947811200.html" target="_blank"&gt;down 5%&lt;/a&gt;. But what type of strategies did well, and what did particularly poorly? The numbers are out: Forex funds lose more than average, down 6%. In fact, 71 out of 77 Forex funds tracked by a Citigroup currency analyst were down in 2011. And the winners are? Statarb funds, with a &lt;a href="http://www.bloomberg.com/news/2012-01-10/chase-coleman-channels-ancestor-stuyvesant-with-45-robertson-like-return.html" target="_blank"&gt;5% averge return&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;This superior performance of statarb funds is quite a contrast from the last financial crisis 2007-9. Then, most of the big factor-driven statarb models &lt;a href="http://epchan.blogspot.com/2007/08/readers-comment-on-quant-funds-losses.html" target="_blank"&gt;failed miserably&lt;/a&gt;. What caused this difference? Is it because the risk management techniques of big funds have improved? Or maybe that's because in 2011, the deviation from factor returns mean-revert within a few days, so those statarb models that re-balance on a daily basis can benefit from the buying/selling opportunity at steep discount/premium?&lt;br /&gt;&lt;br /&gt;To settle this question, let me report the 2011 backtest results (without transaction costs) of running &lt;a href="http://epchan.blogspot.com/2007/10/how-mean-reversion-strategy-performed.html" target="_blank"&gt;Andrew Lo&lt;/a&gt;'s prototype mean-reversion model : ranking stocks based on their previous day's returns, shorting the top decile and buying the bottom one, rebalancing only at the close. (Click on chart to make it larger.)&lt;br /&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://2.bp.blogspot.com/-tmaUlu6Ogws/TybQYIKmbgI/AAAAAAAAA3s/0PstYNXICoA/s1600/andrewLo2011.bmp" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="280" src="http://2.bp.blogspot.com/-tmaUlu6Ogws/TybQYIKmbgI/AAAAAAAAA3s/0PstYNXICoA/s400/andrewLo2011.bmp" width="400" /&gt;&lt;/a&gt;&lt;/div&gt;The APR in 2011 was 18.6%. Note in particular its performance since the crisis began officially on 20110808: despite a steep drawdown, the overall performance was spectacular! Clearly, high volatility benefited a prototypical statarb strategy, and the out-performance has not much to do with improved risk management.&lt;br /&gt;&lt;br /&gt;You might wonder what would happen if we had used the intraday version of this strategy instead: enter all positions at the open, and exit them all at the close? I tried it: the performance is surprisingly similar to the interday strategy. So intraday vs. interday volatility or mean-reversion does not seem to play a part in last year's equities market. Contrasting this with the performance of Forex models, it is clear that high volatilities benefited statarb models while they hurt FX models.&lt;br /&gt;&lt;br /&gt;In the next article or two, I will explore the 2011 performance of some other equities mean-reverting models that I used to trade. But what about your models? If you have some thoughts on what worked and what didn't in 2011, please share them with us in the comments section.</description><link>http://feedproxy.google.com/~r/QuantitativeTrading/~3/haje0tJ-_QE/what-worked-in-2011.html</link><author>noreply@blogger.com (Ernie Chan)</author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://2.bp.blogspot.com/-tmaUlu6Ogws/TybQYIKmbgI/AAAAAAAAA3s/0PstYNXICoA/s72-c/andrewLo2011.bmp" height="72" width="72" /><thr:total>47</thr:total><feedburner:origLink>http://epchan.blogspot.com/2012/01/what-worked-in-2011.html</feedburner:origLink></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-35364652.post-8917675394690276478</guid><pubDate>Tue, 27 Dec 2011 14:32:00 +0000</pubDate><atom:updated>2011-12-27T09:32:29.153-05:00</atom:updated><title>Risk indicators</title><description>During the financial crisis of 2008, I &lt;a href="http://epchan.blogspot.com/2008/10/how-does-financial-crisis-affect.html" target="_blank"&gt;wrote about&lt;/a&gt; how I watched some risk indicators such as the &lt;a href="http://finance.yahoo.com/q?s=^VIX" target="_blank"&gt;VIX&lt;/a&gt; or the &lt;a href="http://www.bloomberg.com/apps/quote?ticker=.TEDSP:IND" target="_blank"&gt;TED spread&lt;/a&gt;&lt;span style="font-family: inherit;"&gt; &lt;/span&gt;&lt;span style="background-color: white; line-height: 19px;"&gt;&lt;span style="font-family: inherit;"&gt;&amp;nbsp;to decide what leverage I should &lt;/span&gt;&lt;span style="font-family: inherit;"&gt;use for my trading strategies. It turns out that this procedure is just as critical for the current crisis that &lt;span style="font-family: inherit;"&gt;began&lt;/span&gt; in August 2011. In fact, more than leverage-determinants, they can be used as the all-important variable that determines whether a certain strategy should be run at all. (What's the point of running a model that you think will lose money with low leverage?)&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="line-height: 19px;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="background-color: white; font-family: inherit; line-height: 19px;"&gt;T&lt;/span&gt;&lt;span style="background-color: white; font-family: inherit; line-height: 19px;"&gt;here are now more than a few of these risk indicators to pick from. Besides the VIX and the TED, there are the&amp;nbsp;&lt;/span&gt;&lt;span style="background-color: white; color: #25241e; font-family: inherit; font-size: 15px;"&gt;&lt;a href="http://www.stoxx.com/indices/index_information.html?symbol=V2TX" target="_blank"&gt;VSTOXX&lt;/a&gt; (EURO STOXX 50 Volatility&lt;/span&gt;&lt;span style="background-color: white; color: #25241e; font-family: inherit;"&gt;&lt;span style="font-size: small;"&gt;),&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;span style="background-color: white; color: #25241e; font-family: inherit; font-size: 15px;"&gt;the &lt;a href="http://www.bloomberg.com/apps/quote?ticker=JPMVXYG7:IND" target="_blank"&gt;VXY&lt;/a&gt; &lt;/span&gt;&lt;span style="background-color: white; color: #25241e; font-family: inherit; font-size: 15px;"&gt;(&lt;/span&gt;&lt;span style="background-color: white; color: #222222; font-family: inherit; line-height: 16px;"&gt;&lt;span style="font-family: inherit; font-size: small;"&gt;JPMorgan G7 Volatility Index), the &lt;a href="http://www.bloomberg.com/apps/quote?ticker=JPMVXYEM:IND" target="_blank"&gt;EM-VXY&lt;/a&gt; (JPMorgan Emerging Market Volatility Index), the ETF's&amp;nbsp;&lt;a href="http://finance.yahoo.com/q?s=ONN" target="_blank"&gt;ONN&lt;/a&gt;&amp;nbsp;and &lt;a href="http://finance.yahoo.com/q?s=OFF&amp;amp;ql=1" target="_blank"&gt;OFF&lt;/a&gt;, and probably many more that I haven't heard of yet.&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: inherit;"&gt;&lt;span style="background-color: white; line-height: 19px;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="line-height: 19px;"&gt;A lot of academic research has been done on whether we can devise "&lt;/span&gt;&lt;a href="http://epchan.blogspot.com/2008/05/machine-learning-regime-switching.html" style="line-height: 19px;" target="_blank"&gt;regime switching&lt;/a&gt;&lt;span style="line-height: 19px;"&gt;" models based on some complicated pattern-recognition algorithms to decide whether a market is in a certain "regime" which favors this or that particular model or parameter set. And often, these regime switching models rely on the recognition of some complicated set of patterns in the historical price series. Sorry to say, I have not found any of these complex regime switching model to have any real out-of-sample predictive power. On the other hand, my research shows that some of the aforementioned simple risk indicators will indeed prevent some trading models from falling off the cliff.&lt;/span&gt;&lt;br /&gt;&lt;span style="line-height: 19px;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="line-height: 19px;"&gt;But which of these indicators are applicable to which model? This is not so obvious. For example, you might think that the EM-VXY would be an ideal leading indicator for Forex trading models that involve emerging market currencies, but I have found that it is only a contemporaneous (and thus useless) indicator to mine. Another example, I said during the 2008 financial crisis that VIX seems to be a useless contemporaneous indicator for equities trading models, but strangely, it is a good leading indicator for FX models. In contrast, the TED spread that everyone were obsessed about in 2008 shot up to over 300 bps then, but never went beyond 100 bps this time around. So really only rigorous backtesting can guide us here.&lt;/span&gt;&lt;br /&gt;&lt;span style="line-height: 19px;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="line-height: 19px;"&gt;What risk indicators do you use? And have you really backtested their efficacies? Your comments would be very welcome here.&lt;/span&gt;</description><link>http://feedproxy.google.com/~r/QuantitativeTrading/~3/hQ388yxqeA8/risk-indicators.html</link><author>noreply@blogger.com (Ernie Chan)</author><thr:total>19</thr:total><feedburner:origLink>http://epchan.blogspot.com/2011/12/risk-indicators.html</feedburner:origLink></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-35364652.post-860618627764654049</guid><pubDate>Fri, 11 Nov 2011 13:31:00 +0000</pubDate><atom:updated>2013-04-04T09:34:12.097-04:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">Automated trading platforms</category><title>Trading platform and EC2 revisited</title><description>Recently I opened a&amp;nbsp;&lt;a href="http://epchan.blogspot.com/2011/09/more-on-automated-trading-platforms.html"&gt;discussion&lt;/a&gt; on the various software platforms which allow the programmers among us to build trading strategies easily. Here is one other addition: &lt;a href="http://www.quantopian.com/"&gt;Quantopian&lt;/a&gt;. It is only in alpha stage, but I did get a preview of its features:&lt;br /&gt;&lt;br /&gt;1) You can code in Python, which is an easier language to learn than Java, but no less powerful. In fact, I know of a superb programmer who uses Python to backtest HF strategies.&lt;br /&gt;&lt;br /&gt;2) It is web-based, which means you can take advantage of collocation on a server much more stable than your own desktops. (For those who worry about the confidentiality of your strategies, the founder indicated to me that they can run an image of the software on an Amazon EC2 account that you owned so they won't have access to your codes. As for the confidentiality of codes residing on EC2 itself, please see below*.)&lt;br /&gt;&lt;br /&gt;3) It is event-driven (or for those who like the latest jargon: CEP-enabled), like all the Java API's that I discussed in the previous article.&lt;br /&gt;&lt;br /&gt;4) They have 1-min US equities data for backtesting. Tick-level data will be available soon.&lt;br /&gt;&lt;br /&gt;5) Toolboxes for common technical indicators, mathematical algorithms, etc. will be available soon.&lt;br /&gt;&lt;br /&gt;6) They will run a competition for trading models which makes it easier for independent traders to become trading&amp;nbsp;advisers&amp;nbsp;to others, or to raise money for their own funds.&lt;br /&gt;&lt;br /&gt;Unfortunately, live walk-forward testing is not yet available.&lt;br /&gt;&lt;br /&gt;* Some readers have wondered whether it is safe to run their trading models on Amazon's EC2. Won't Amazon's employees have access to their wildly profitable strategies? The answer is no: Amazon's &lt;a href="http://media.amazonwebservices.com/pdf/AWS_Security_Whitepaper.pdf"&gt;security policy&lt;/a&gt;:&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;div style="background-color: white; font-family: verdana, helvetica, sans-serif;"&gt;&lt;b&gt;Guest Operating System: Virtual instances are completely controlled by the customer. Customers have full root access&amp;nbsp;&lt;/b&gt;&lt;/div&gt;&lt;div style="background-color: white; font-family: verdana, helvetica, sans-serif;"&gt;&lt;b&gt;or administrative control over accounts, services, and applications. AWS does not have any access rights to customer&amp;nbsp;&lt;/b&gt;&lt;/div&gt;&lt;div style="background-color: white; font-family: verdana, helvetica, sans-serif;"&gt;&lt;b&gt;instances and cannot log into the guest OS....&lt;/b&gt;&lt;/div&gt;&lt;div style="background-color: white; font-family: verdana, helvetica, sans-serif; font-size: 13px;"&gt;&lt;span style="font-size: xx-small;"&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="background-color: white;"&gt;&lt;span class="Apple-style-span" style="font-family: inherit;"&gt;Thanks to a reader OL from France who provided me with this info. He also told me that:&amp;nbsp;&lt;/span&gt;&lt;/div&gt;&lt;div style="background-color: white; font-family: verdana, helvetica, sans-serif; font-size: 13px;"&gt;&lt;span class="Apple-style-span" style="font-family: 'Times New Roman'; font-size: small;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="background-color: white; font-family: verdana, helvetica, sans-serif;"&gt;&lt;span class="Apple-style-span" style="font-family: 'Times New Roman';"&gt;"&lt;/span&gt;So, I finally deployed my momentum strategy on a Linux instance of EC2 (which is free btw).&lt;/div&gt;&lt;div style="background-color: white; font-family: verdana, helvetica, sans-serif;"&gt;I wrote it based on the java demo application provided by Interactive Brokers and some parts of Algoquant.&lt;/div&gt;&lt;div style="background-color: white; font-family: verdana, helvetica, sans-serif;"&gt;So far, I use a European instance of EC2 which alas doesn't have the best latency to IB US servers (90 ms) but still better than my bedroom connection.&amp;nbsp;&lt;/div&gt;&lt;div style="background-color: white; font-family: verdana, helvetica, sans-serif;"&gt;A test ping from a US instance to IB US servers results in only 15 ms ..."&lt;/div&gt;&lt;div style="background-color: white; font-family: verdana, helvetica, sans-serif;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="background-color: white; font-family: verdana, helvetica, sans-serif;"&gt;So there you go: Java+Algoquant+IB+EC2=profit.&lt;/div&gt;&lt;div&gt;&lt;span style="font-size: xx-small;"&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;</description><link>http://feedproxy.google.com/~r/QuantitativeTrading/~3/_5749XjZEr4/trading-platform-and-ec2-revisited.html</link><author>noreply@blogger.com (Ernie Chan)</author><thr:total>64</thr:total><feedburner:origLink>http://epchan.blogspot.com/2011/11/trading-platform-and-ec2-revisited.html</feedburner:origLink></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-35364652.post-6061194021576415109</guid><pubDate>Fri, 30 Sep 2011 16:22:00 +0000</pubDate><atom:updated>2011-09-30T12:22:30.864-04:00</atom:updated><title>Stop loss, profit cap, survivorship bias, and black swans</title><description>I have long espoused the view that we should not impose stop-losses on mean-reverting strategies, nor profit caps on momentum strategies. My view on the latter has not changed, but it has evolved on the former.&lt;br /&gt;&lt;br /&gt;My original reason for opposing stop-losses on mean-reverting strategy is this. Say you believe your specific price series is mean-reverting, and say you have entered into a long position when the price is low. Now, however, the price gets much lower, and you are suffering a large unrealized loss. Well, based on your mean-reverting belief, you should buy more instead of liquidating! Indeed, if you backtest the effect of stop-losses on mean-reverting strategies, you will almost inevitably find that they decrease the overall returns and even Sharpe ratios.&lt;br /&gt;&lt;br /&gt;But what this simplistic view ignored is 1) survivorship bias, and 2) black swan events. (Hat tip: Ben, who prompted me to consider these two issues.)&lt;br /&gt;&lt;br /&gt;1) We normally would only trade those price series with a mean-reverting strategy only if we see that the prices did eventually revert. No one would bother to trade those price series that used to mean-revert, but suddenly stopped doing so. But saying that stop-losses are harmful to mean-reverting strategies is ignoring the fact that some mean-reverting will stop working altogether and would not survive our strategies selection process.&lt;br /&gt;&lt;br /&gt;2) Let's define black swan events as those that did not occur in your backtest period. For example, let's say you never had a loss of 20% in a single day. So if you backtest a stop-loss of 20%, it will have no effect whatsoever on your backtest performance. However, no one can say for sure that it won't occur in the future. So if you or your investors simply cannot tolerate a 20% loss, you should impose this as a stop-loss. (After all, your brokerage has already imposed a stop-loss of 100% on you whether you like it or not.)&lt;br /&gt;&lt;br /&gt;We can in fact turn point 2) around when deciding what stop-loss to use: a stop-loss should be loose enough so that it should have no effect on the backtest performance, and of course tight enough so that it will not result in the demise of your trading career.&lt;br /&gt;&lt;br /&gt;There is also the issue of whether to use stop-loss on the intraday drawdown, or to use it on the multiple-day drawdown. I would argue that only intraday stop-loss is important to prevent a black-swan loss. In practice, when a strategy has a string of non-catastrophic losses occurring over multiple days, resulting in a large, unprecedented, drawdown, the trader will typically re-examine the strategy, taking into account this most recent performance and tweak the strategy so that it could theoretically be avoided. This is almost like a multi-day stop-loss strategy, as we stop an old strategy and start a new, modified, one. (Though the modified strategy might still recommend that you keep holding the current position!)&lt;br /&gt;&lt;br /&gt;Now why am I still holding dear to the principle that one should not impose profit-caps on momentum strategies? Why, the possibility of black swan events again! But this time, any black swan can only result in&amp;nbsp;unprecedented&amp;nbsp;one-day &lt;i&gt;gain &lt;/i&gt;instead of loss, since we should&amp;nbsp;&lt;a href="http://epchan.blogspot.com/2009/06/my-interview-stop-loss-and-principle-of.html"&gt;always&lt;/a&gt;&amp;nbsp;have stop-losses on momentum strategies. We certainly don't want to impose a profit-cap to rule out this possibility!</description><link>http://feedproxy.google.com/~r/QuantitativeTrading/~3/BsJH97HyJRY/stop-loss-profit-cap-survivorship-bias.html</link><author>noreply@blogger.com (Ernie Chan)</author><thr:total>57</thr:total><feedburner:origLink>http://epchan.blogspot.com/2011/09/stop-loss-profit-cap-survivorship-bias.html</feedburner:origLink></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-35364652.post-7031446748717729259</guid><pubDate>Sun, 18 Sep 2011 11:37:00 +0000</pubDate><atom:updated>2013-04-04T09:34:37.312-04:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">Automated trading platforms</category><title>More on automated trading platforms</title><description>The ideal software platform for automating backtesting and executing your algorithmic trading strategies depends mainly on your level of programming expertise and your budget. If you are a competent programmer in, say, Java or C#, there is nothing to prevent you from utilizing the API offered (usually for free) by many brokerages to automate execution. And of course, it is also easy for you to write a separate backtesting program utilizing historical data. However, even for programmer-traders, there are a couple of inconveniences in developing these programs from scratch:&lt;br /&gt;&lt;br /&gt;A) Every time we change brokerages, we have to re-write parts of the low-level functions that utilize the brokerage's API;&lt;br /&gt;&lt;br /&gt;B) The automated trading program cannot be used to backtest unless a simulator is built to feed the historical data into the program as if they were live. To reduce bugs, it is better to have the same code that both backtests and trades live.&lt;br /&gt;&lt;br /&gt;This is where a number of open-source algorithmic trading development platforms come in. These platforms all assume that the user is a Java programmer. But they eliminate the hassles A) and B) above as they serve as the layer that shield you from the details of the brokerage's API, and let you go from backtesting to live trading mode with a figurative turn of a key. I have taken a tour of one such platforms &lt;a href="http://www.marketcetera.com/"&gt;Marketcetera&lt;/a&gt;, and will highlight some features here:&lt;br /&gt;&lt;br /&gt;1) It has a trading GUI with features similar to that of IB's TWS. This will be useful if your own brokerage's GUI is&amp;nbsp;dysfunctional.&lt;br /&gt;&lt;br /&gt;2) Complex Event Processing (CEP) is available as a module. CEP is essentially a way for you to easily specify what kind of market/pricing events should trigger a trading action. For e.g., "BUY if ask price is below 20-min moving average." Of course, you could have written this trading rule in a callback function, but to retrieve the 20-min MA on-demand could be quite messy. CEP solves that data retrieval problem for you by storing only those data that is needed by your registered trading rules.&lt;br /&gt;&lt;br /&gt;3) It can use either FIX or a brokerage's API for connection. Available brokerage connectors include Interactive Brokers and Lime Brokerage.&lt;br /&gt;&lt;br /&gt;4) It offers a news feed, which can be used by your trading algorithms to trigger trading actions if you use Java's string processing utilities to parse the stories properly.&lt;br /&gt;&lt;br /&gt;5)&amp;nbsp;The monthly cost ranges from $3,500 - $4,500.&lt;br /&gt;&lt;br /&gt;If Marketcera is beyond your budget, you can check out &lt;a href="http://code.google.com/p/algo-trader/"&gt;AlgoTrader&lt;/a&gt;. It has advantages 1)-3) but not 4) listed above, and is completely free. I invite readers who have tried these or other similar automated trading platforms to comment their user experience here.&lt;br /&gt;&lt;br /&gt;P.S. For those of us who use Matlab to automate our executions, a reader pointed out there is a new product &lt;a href="http://www.agoratron.com/our_products.html"&gt;MATTICK&lt;/a&gt;&amp;nbsp;that allows you to send order via the FIX protocol which should let us trade with a great variety of brokerages.</description><link>http://feedproxy.google.com/~r/QuantitativeTrading/~3/obnB6i7w9fU/more-on-automated-trading-platforms.html</link><author>noreply@blogger.com (Ernie Chan)</author><thr:total>33</thr:total><feedburner:origLink>http://epchan.blogspot.com/2011/09/more-on-automated-trading-platforms.html</feedburner:origLink></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-35364652.post-7595117820521039966</guid><pubDate>Sat, 23 Jul 2011 16:52:00 +0000</pubDate><atom:updated>2011-07-23T12:52:30.347-04:00</atom:updated><title>Sorry, your return is too high for us</title><description>I enjoyed reading Richard Wilson's &lt;a href="http://www.amazon.com/gp/product/0470520639/ref=as_li_qf_sp_asin_tl?ie=UTF8&amp;amp;tag=quantitativet-20&amp;amp;linkCode=as2&amp;amp;camp=217145&amp;amp;creative=399377&amp;amp;creativeASIN=0470520639"&gt;The Hedge Fund Book&lt;/a&gt;&amp;nbsp;(Richard also runs the &lt;a href="http://hedgefundblogger.com/"&gt;Hedge Fund Blogger&lt;/a&gt;&amp;nbsp;site). To be clear: it is purely marketing-oriented. It doesn't tell you how to find a successful trading strategy, but its focus is to tell you how to market your fund to investors once you have a successful strategy. To that end, it does a pretty good job in conveying what might be conventional wisdom to seasoned fund managers. (For e.g., don't bother to market to institutional investors if your AUM is less than $100M.) The book is filled with quite engaging interviews with fund managers, fund marketers, and other fund service providers (including our very own administrator Fund Associates). If Scott Patterson's &lt;a href="http://www.amazon.com/gp/product/0307453383/ref=as_li_tf_tl?ie=UTF8&amp;amp;tag=quantitativet-20&amp;amp;linkCode=as2&amp;amp;camp=217145&amp;amp;creative=399377&amp;amp;creativeASIN=0307453383"&gt;The Quants&lt;/a&gt;&amp;nbsp;is about the gods of hedge funds, this book is for and about the mortals.&lt;br /&gt;&lt;br /&gt;One paragraph in the book stood out: "I've worked closely on the third-party marketing and capital introduction/prime brokerage side of the business, and I often see both types of firms deny clients service [to funds with high returns and high risk] ... Nobody wants to be associated with a manager aiming at 30 percent a month returns."&lt;br /&gt;&lt;br /&gt;Maybe not &lt;i&gt;aiming at&lt;/i&gt;, but what's wrong with &lt;i&gt;achieving &lt;/i&gt;a 30 percent a month returns? I have actually met institutional investors who don't want to look at a fund that actually achieved double-digit monthly returns. Presumably that's because they believe that a high return automatically implies high risk, and also presumably a high leverage as well. &amp;nbsp;I would argue that there are 2 reasons not to completely dismiss such funds out-of-hand:&lt;br /&gt;&lt;br /&gt;1) Leverage should not be determined arbitrarily, but should be based on the minimum of what's dictated by half-Kelly (see my extensive discussions of Kelly formula on this blog and in my book) and what's dictated by the maximum single-day drawdown seen historically or in VaR simulations. And if this minimum still turns out to be higher than what most institutional investors are comfortable with, one should be bold enough to adopt it in your fund.&lt;br /&gt;&lt;br /&gt;2) As an investor, there is an easy way to control leverage and risk: just apply Constant Proportion Portfolio Insurance (a concept also discussed elsewhere on this blog). For example, if the fund manager tells you the fund employs a constant 10x leverage (as dictated by the risk analysis outlined in 1) and you are only comfortable with 5x leverage, just invest half your capital into the fund, and keep the other half as cash in your bank account! Going forward, if the fund loses money, your effective leverage would have decreased to below 5x. Say you invested $1M into the fund, and kept $1M in the bank. And say the fund lost $0.5M. Your total equity is now $1.5M, and the fund manager is supposed to trade a $0.5M*10=$5M portfolio. Your effective leverage is now only 3.33x, well within your tolerance. Now if instead, the fund made money, you can immediately withdraw some of the profits to keep your effective leverage at 5x. So, say the fund made $0.5M. Your equity is now $2.5M, and the fund manager is supposed to trade a $1.5M*10=$15M portfolio. If you don't withdraw, this would increase your effective leverage to 6x. But if you immediately withdraw $0.25M, then the fund manager will trade a $1.25M*10=$12.5M portfolio, giving you an effective leverage of the desired 5x.&lt;br /&gt;&lt;br /&gt;If you are an investor in hedge funds, please let us know what you think of this scheme in the comments section!</description><link>http://feedproxy.google.com/~r/QuantitativeTrading/~3/akThLetsqmY/sorry-your-return-is-too-high-for-us.html</link><author>noreply@blogger.com (Ernie Chan)</author><thr:total>30</thr:total><feedburner:origLink>http://epchan.blogspot.com/2011/07/sorry-your-return-is-too-high-for-us.html</feedburner:origLink></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-35364652.post-7054341098400875757</guid><pubDate>Mon, 18 Jul 2011 16:35:00 +0000</pubDate><atom:updated>2011-07-18T12:35:23.524-04:00</atom:updated><title>The social utility of hedge funds</title><description>There is an &lt;a href="http://www.newyorker.com/reporting/2011/07/25/110725fa_fact_cassidy#ixzz1STONOVrZ"&gt;article&lt;/a&gt; in the New Yorker magazine profiling Bridgewater Associates, the world's biggest global macro hedge fund. Inevitably, we come to the awkward question: "&lt;span class="Apple-style-span" style="font-family: 'Times New Roman', serif; font-size: 15px;"&gt;If hedge-fund managers are playing a zero-sum game, what is their social utility?"&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Times New Roman', serif; font-size: 15px;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Times New Roman', serif; font-size: 15px;"&gt;I thought about this question a lot in the past, and&lt;/span&gt;&lt;span class="Apple-style-span" style="font-family: 'Times New Roman', serif; font-size: 15px;"&gt;&amp;nbsp;&lt;/span&gt;&lt;span class="Apple-style-span" style="font-family: 'Times New Roman', serif; font-size: 15px;"&gt;I used to agree with many others that the social utility of hedge funds, or trading in general, is to provide liquidity to the markets. And a good economic case can be made that the more liquid a market is, the higher the utility it is to all participants. However, based on recent experience of flash crash and other unfortunate mishaps, we find out that traders typically do &lt;/span&gt;&lt;span class="Apple-style-span" style="font-family: 'Times New Roman', serif; font-size: 15px;"&gt;&lt;u&gt;not&lt;/u&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="font-family: 'Times New Roman', serif; font-size: 15px;"&gt; provide liquidity when it is needed most! So this answer becomes quite unsatisfactory.&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Times New Roman', serif; font-size: 15px;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Times New Roman', serif; font-size: 15px;"&gt;In trying to come up with a better reply, I though it is curious that few people asked "What is the purpose of having a Department of Defence?" since wars between nations are typically also zero-sum games, yet we greatly honour those who serve in the armed forces (in contrast to our feelings for hedge fund managers).&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Times New Roman', serif; font-size: 15px;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Times New Roman', serif; font-size: 15px;"&gt;To me, clearly the answer with the best moral justification is that, in both cases, there is great social utility in defending either your clients' comfortable retirement from financial meltdown (e.g. due to governmental or corporate mismanagement), or in defending your country from foreign aggression. More specifically, the purpose of hedge funds is to reduce &lt;b&gt;long-term&amp;nbsp;volatility &lt;/b&gt;in your clients' net worth. (I would like to say "reduce &lt;i&gt;risks &lt;/i&gt;to your clients' net worth", but that would be a bit too optimistic!)&amp;nbsp;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Times New Roman', serif; font-size: 15px;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Times New Roman', serif; font-size: 15px;"&gt;I emphasize long-term volatility, because of course trading generates a lot of daily or hourly volatility in your clients' equity. But I do not believe that such short-term volatility affects ones' life goals. On the other hand, a 3-or-more-year drawdown in a typical buy-and-hold portfolio can wreck havoc with many lives.&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Times New Roman', serif;"&gt;&lt;span class="Apple-style-span" style="font-size: 15px;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: 'Times New Roman', serif; font-size: 15px;"&gt;If one day, the markets become so quiescent that few hedge funds can generate higher Sharpe ratio than a buy-and-hold portfolio (as indeed seems to be the case with the US equities markets these days), then yes, most hedge fund managers should just quit, instead of hogging intellectual resources from our best universities.&lt;/span&gt;&lt;/div&gt;</description><link>http://feedproxy.google.com/~r/QuantitativeTrading/~3/zrieWmpl-EA/social-utility-of-hedge-funds.html</link><author>noreply@blogger.com (Ernie Chan)</author><thr:total>13</thr:total><feedburner:origLink>http://epchan.blogspot.com/2011/07/social-utility-of-hedge-funds.html</feedburner:origLink></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-35364652.post-6555880069015523039</guid><pubDate>Sun, 03 Jul 2011 13:21:00 +0000</pubDate><atom:updated>2011-07-03T09:21:55.306-04:00</atom:updated><title>Hedge fund transparency and "barometers"</title><description>Jim Liew of Alpha Quant Club recently posted an interesting &lt;a href="http://allaboutalpha.com/blog/2011/06/30/hedge-fund-indexes-learn-to-walk-upright-introducing-the-hedge-fund-barometer/"&gt;article&lt;/a&gt; about the increasing demand for transparency of hedge fund strategies by institutional investors, so much so that they are essentially willing to invest only in managed accounts with real-time trades and positions updates. This is, of course, bad for fund managers, since not only can the investor reverse-engineer the simpler strategies from such knowledge, they can also piggy-back on the trades, thus paying a much smaller portion of their profits as performance fee. One might be tempted to think that since the investors are going to reverse-engineer the product anyway, why not just make it as simple and as generic as possible, and charge a much lower fee than the usual 2-20 (which hopefully will attract a much larger investor base), so that the main value to the investor is just convenience and not the originality of the strategy?&lt;br /&gt;&lt;br /&gt;In fact,&amp;nbsp;Jim wants to do just that. He proposes to construct hedge fund "barometers", essentially prototypical hedge fund strategies running in managed accounts. This would work well if these barometers have large enough capacities such that the performance can hold up even when a large number of investors sign up. From the investors' point of view, this is a trade-off between investing in a truly outstanding, high-performance strategy while paying a large fee and losing "transparency", versus just investing in a generic strategy that may still outperform the broad market. For some institutional investors, this might just be the bargain they are looking for.</description><link>http://feedproxy.google.com/~r/QuantitativeTrading/~3/SW7ADjx0sPM/hedge-fund-transparency-and-barometers.html</link><author>noreply@blogger.com (Ernie Chan)</author><thr:total>20</thr:total><feedburner:origLink>http://epchan.blogspot.com/2011/07/hedge-fund-transparency-and-barometers.html</feedburner:origLink></item></channel></rss>
