tag:blogger.com,1999:blog-35364652.post6638795298173825912..comments2024-04-16T09:30:34.503-04:00Comments on Quantitative Trading: My pairs trading workshop in LondonErnie Chanhttp://www.blogger.com/profile/02747099358519893177noreply@blogger.comBlogger63125tag:blogger.com,1999:blog-35364652.post-64164019757205067492010-06-30T17:05:47.141-04:002010-06-30T17:05:47.141-04:00Free Pair Trading Tool - http://catalystcorner.com...Free Pair Trading Tool - http://catalystcorner.com/index.php?m=pair_tool<br /><br />Go long/short at the same time. Tool is completely free.Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-35364652.post-70096107196694253962010-03-19T08:59:25.388-04:002010-03-19T08:59:25.388-04:00Hi Anon,
I think daily updates would be appropriat...Hi Anon,<br />I think daily updates would be appropriate.<br />ErnieErnie Chanhttps://www.blogger.com/profile/02747099358519893177noreply@blogger.comtag:blogger.com,1999:blog-35364652.post-78021023719960130922010-03-18T12:44:10.772-04:002010-03-18T12:44:10.772-04:00Hi Ernie
I'm tring to build pair trading model...Hi Ernie<br />I'm tring to build pair trading model using kalman filter. my question is , what is the frequency used to update the fair value of the spread using the filter ( daily/ weekly or at the end of trading period ...) <br /><br />thksAnonymousnoreply@blogger.comtag:blogger.com,1999:blog-35364652.post-48241353668195327082010-02-14T10:35:56.949-05:002010-02-14T10:35:56.949-05:00Hi Justin,
In pairs trading, we do not worry about...Hi Justin,<br />In pairs trading, we do not worry about daily fluctuations of the P&L. We are concerned whether the round trip trade is ultimately profitable. I have discussed the foundation of pair trading in my book and elsewhere on this blog quite extensively -- the foundation of pair trading is cointegration, which is based strictly on prices, not daily returns. In particular, we don't choose a hedge ratio to minimize the standard deviation of daily returns.<br />Hope this helps.<br />ErnieErnie Chanhttps://www.blogger.com/profile/02747099358519893177noreply@blogger.comtag:blogger.com,1999:blog-35364652.post-90068484314690249822010-02-12T19:06:47.735-05:002010-02-12T19:06:47.735-05:00Just for clarification in my post immediately abov...Just for clarification in my post immediately above.<br /><br />when I say "daily returns" i specifically mean "daily return in percent" (not in dollars in cents).Justinhttps://www.blogger.com/profile/00854498411719627288noreply@blogger.comtag:blogger.com,1999:blog-35364652.post-77462772086623266942010-02-12T18:32:59.399-05:002010-02-12T18:32:59.399-05:00Dr Chan,
How come you regress the direct price ser...Dr Chan,<br />How come you regress the direct price series against each other? Why don't you regress the daily return of each price series instead? <br /><br />Or perhaps a variation of this question is, regress the price time series against each other to find the spread that we are trying to "arb", but then when we actually put on the trade we determine our hedgeratio using the coefficient of the regression from a dailyreturn regression? Intuitively thinking about it, it makes more sense to me to regress daily returns for determining the proper hedgeratio if i'm worried about the day-to-day fluctuations of the trade.<br /><br />As an example, I'm using the timeframe from your book for GLD-GDX. Regressing price yields the coefficient/hedgeratio from your book of 1.6766*GDX, however regressing daily returns gives a coefficient of 0.4436. If I wanted to put $100,000 in the GLD side of the trade, using 1.6766 as the hedgeratio for GDX vs. 0.4436 would seem to make a world of difference (my dates for my regressions are startdate=5/23/2006 enddate=1/30/2008). Am I missing something really simple here in my logic?Justinhttps://www.blogger.com/profile/00854498411719627288noreply@blogger.comtag:blogger.com,1999:blog-35364652.post-91449421679631419952009-11-20T15:51:10.241-05:002009-11-20T15:51:10.241-05:00Rob,
A lot of the so-called technical rules are no...Rob,<br />A lot of the so-called technical rules are nothing but market making strategies in various guises. That's the reason they work for a lot of traders.<br /><br />I also disagree with your assertion that the only edge traders can have is technological. Market-making does not have to occur at the extreme high frequency end to be profitable. There are a lot of ways to reduce/diversify the risk in market-making at different frequencies. Some of these ways are in fact incorporated in the technical trading rules that people follow.<br /><br />ErnieErnie Chanhttps://www.blogger.com/profile/02747099358519893177noreply@blogger.comtag:blogger.com,1999:blog-35364652.post-18653544435366156472009-11-20T13:12:02.055-05:002009-11-20T13:12:02.055-05:00@Ernie
Good book by the way.....
In my comment I...@Ernie<br /><br />Good book by the way.....<br /><br />In my comment I said I am only including one specific agent: retail technical traders.<br /><br />Other agents in the game such as high freq arb funds are not taking pure directional bets on models induced from historical data (which is the case for most retail). It is most likely some variation on a market making strategy..... or a latency sensitive strategy ..... rebate strategies..... statistical front running..... much more sophisticated species ....<br /><br /><br />their edge is mainly technological.......<br /><br /><br />very very different species to the average retail technical trader...... the market is much like the natural ecological system.... there are different species competing at different levels in the food chain. I would argue that the expected value of the retail technical trader population is zero....... but there are always new retailers coming into the game.... believing they can be successful as they have heard about the profitable onces (the upper end of the equity curve distribution i mentioned) when in fact it is largely down to chance whether or not their basic technical rules profit in the long term.<br /><br /><br /><br />Once again....... devil's advocate.<br /><br /><br />Rgds,<br /><br /><br />Rob.<br /><br />Rob.Robhttps://www.blogger.com/profile/01896419420429612436noreply@blogger.comtag:blogger.com,1999:blog-35364652.post-30788759731205202672009-11-20T12:58:46.906-05:002009-11-20T12:58:46.906-05:00Rob,
My comments above refer to whether stationari...Rob,<br />My comments above refer to whether stationarity will persist, not whether a pair trading strategy's profitability will persist. There is a substantial difference here: stationarity tests use daily prices for statistical testing, and thus are much more robust and reliable than backtesting a strategy, which may only have a few trades a month. <br /><br />Your point about the role of luck in trading certainly has some merits (and it is similar to the argument made by Taleb's book Fooled by Randomness.) However, it is highly unlikely that the success of those high frequency traders who make more than 10,000 bets on different symbols a day, and win almost every day (yes, such people exist!) are due to random luck.<br />ErnieErnie Chanhttps://www.blogger.com/profile/02747099358519893177noreply@blogger.comtag:blogger.com,1999:blog-35364652.post-56188553768583848022009-11-20T12:49:19.504-05:002009-11-20T12:49:19.504-05:00Vipin,
You can test all 1, 2 and 3, and see which ...Vipin,<br />You can test all 1, 2 and 3, and see which one generate the best cointegration t-statistic -- the best statistic will determine the best model.<br />ErnieErnie Chanhttps://www.blogger.com/profile/02747099358519893177noreply@blogger.comtag:blogger.com,1999:blog-35364652.post-78012164296549521862009-11-20T12:35:21.704-05:002009-11-20T12:35:21.704-05:00@ Vipin
Of course I am not saying that..... howev...@ Vipin<br /><br />Of course I am not saying that..... however..... the price series is the emergent behaviour from the market..... and what is the market..... only an "ecology of competing trading strategies" to quote Lo.<br /><br />In my opinion...... the only strategies that you can guarantee as not being largely due to chance are pure arbitrage (eg flash order strategies - before they were banned) and trades on inside information.<br /><br />Models induced from historical data are a different story. Let's take an example...... Train a population of trading rules on a dataset...... then take the best rule and test out of sample..... now plot the out of sample equity curve.... lets say it looks good..... Great! we have a good strategy??<br /><br />Now...... repeat the above steps 1000 times and plot the out-of-sample equity curve from each run...... and tell me what you see. You will most likely see a distribution centred on 0.<br /><br /><br />My point is that...... there are 1000s of technical traders worldwide backtesting strategies on the likes of Tradestation, Ninjatrader, and other such software, and trade strategies they think gives them an edge.... but....... everyone thinks the same thing....... and if you plot the equity curve of every technical trader in the world i would bet my bottom dollar that the distribution would look much the same as my example above.<br /><br />Now i'm only including technicl traders in my example..... there are other agents in the market...... ultra high freq arb funds..... market makers .... etc.... who have a very different profile. So I am not generalising.<br /><br />Retail technical traders have an expected value of zero in my opinion..... and so long as there is fresh blood coming into the game the brokers are happy as they are the real winners in the long run.... along with the market makers and pure arb guys etc.<br /><br /><br />I'm not saying everything above is correct...... I'm just playing devil's advocate for a minute...<br /><br /><br />Food for thought...<br /><br /><br />Rob.Robhttps://www.blogger.com/profile/01896419420429612436noreply@blogger.comtag:blogger.com,1999:blog-35364652.post-91428123484068711122009-11-20T12:23:57.700-05:002009-11-20T12:23:57.700-05:00@Rob,
So essentially what you saying is that, al...@Rob, <br /><br />So essentially what you saying is that, all the traders, every logic applied for decision making in trade, every science ( both Quantitative and Qualitative ) is fake? <br /><br />It all boils down to random luck?<br /><br />Phew ! Thats a great accusation that you are making.Vipin Kumarhttps://www.blogger.com/profile/16990892515887795731noreply@blogger.comtag:blogger.com,1999:blog-35364652.post-75310298321112047112009-11-20T12:10:15.917-05:002009-11-20T12:10:15.917-05:00Hi Ernie,
You said in a comment above " If ...Hi Ernie,<br /><br /><br />You said in a comment above " If my statement were not true, no pair trading would be successful."<br /><br />I strongly disagree with this.<br /><br />If you run 50 simulation on a pair with random buying/selling/donothing at each bar and look at the equity curves.... the average equity curve (without costs) will be close to zero.... but a certain percentage will be highly profitable and a certain percentage will be the opposite (big losers).<br /><br />The point is.... that if you look on every pairs trader in the world as a random agent a certain percentage will be highly profitable just by chance.<br /><br />I'm doing a PhD in rule-based trading.... and the more research and backtesting i do of technical strategies (both sampled and tickbytick testing) the more i find myself pondering the role of luck in technical trading.<br /><br />Insider trading is of course not down to luck.... but technical trading is a different story. No profitable technical trader can prove his profits are the result of real skill or luck.<br /><br />I think to fully understand this concept is paramount to being a successful investor. One must understand the role of chance.<br /><br />Rob.Robhttps://www.blogger.com/profile/01896419420429612436noreply@blogger.comtag:blogger.com,1999:blog-35364652.post-66488166888351744422009-11-20T11:55:50.262-05:002009-11-20T11:55:50.262-05:00This comment has been removed by the author.Robhttps://www.blogger.com/profile/01896419420429612436noreply@blogger.comtag:blogger.com,1999:blog-35364652.post-26772251420587897882009-10-04T23:23:56.944-04:002009-10-04T23:23:56.944-04:00Thanks ernie for replying.
My question was howeve...Thanks ernie for replying.<br /><br />My question was however:<br /><br />we have three critical value for testing for cointegration, <br />1. Critical value for ADF no constant no trend.<br />2. Critical value for ADF constant but no trend.<br />3. Critical value for ADF constant and a trend.<br /><br />When we test for cointegration from lets say matlab, we can use three functions to evaluate the above mentioned three values, now the question is which value to consider as most important one?Vipin Kumarhttps://www.blogger.com/profile/16990892515887795731noreply@blogger.comtag:blogger.com,1999:blog-35364652.post-48427303131102250552009-10-02T11:01:45.520-04:002009-10-02T11:01:45.520-04:00tejas,
I expect both methods should give very simi...tejas,<br />I expect both methods should give very similar half-lifes.<br />ErnieErnie Chanhttps://www.blogger.com/profile/02747099358519893177noreply@blogger.comtag:blogger.com,1999:blog-35364652.post-38641824204317856342009-10-01T22:33:09.457-04:002009-10-01T22:33:09.457-04:00Hi Ernie,
Thanks again..
Like I said I have estima...Hi Ernie,<br />Thanks again..<br />Like I said I have estimated the rate of reversion of the OU process using AR(1) now if I use the method of regressing the difference between the spread with the spread itself and get the regression coefficient (which is the rate of reversion), should both the methods give me similar values if the data is the same. I feel they should because both are estimating the rate of reversion.If no, why?<br />Also, once the above regression is performed how good should its R-square value be.Unknownhttps://www.blogger.com/profile/07038537947080578313noreply@blogger.comtag:blogger.com,1999:blog-35364652.post-13257602852276169312009-10-01T20:46:53.356-04:002009-10-01T20:46:53.356-04:00Vipin,
Generally, 90% probability of cointegration...Vipin,<br />Generally, 90% probability of cointegration is good enough for a working trading model.<br />ErnieErnie Chanhttps://www.blogger.com/profile/02747099358519893177noreply@blogger.comtag:blogger.com,1999:blog-35364652.post-58733188705614803622009-10-01T17:24:08.526-04:002009-10-01T17:24:08.526-04:00Hi Ernie,
In your pair trading ..How do you decid...Hi Ernie,<br /><br />In your pair trading ..How do you decide which critical value out of 3 values of ADF statistics to use? <br /><br />Thanks once again for your valuable help.Vipin Kumarhttps://www.blogger.com/profile/16990892515887795731noreply@blogger.comtag:blogger.com,1999:blog-35364652.post-17619991588737673852009-10-01T14:29:53.920-04:002009-10-01T14:29:53.920-04:00tejas,
In order to estimate probabilities of mean-...tejas,<br />In order to estimate probabilities of mean-reversion (i.e. derive the probability distribution of the spread value), you need to solve the stochastic differential equation called Ornstein-Uhlenbeck formula. You can google this term and see if you can solve it analytically or numerically.<br /><br />I expect the mean-reversion rate to be different intraday vs interday. Which one to use depends on your desired trading horizon.<br /><br />ErnieErnie Chanhttps://www.blogger.com/profile/02747099358519893177noreply@blogger.comtag:blogger.com,1999:blog-35364652.post-76087332845024988272009-10-01T01:34:52.345-04:002009-10-01T01:34:52.345-04:00hey ernie...
i have been going through your blogs ...hey ernie...<br />i have been going through your blogs and they have been very helpful..<br />i am modelling the residuals between the pairs using the OU process.i have estimated the parameters using AR(1) process.is there any way to find the probability of mean reversion or waiting time for mean reversion?the application of half life to OU process seems a bit rigid to me(pl correct me if i am wrong)<br />i also had a problem with the frequency of observations.considering my time span is fixed should the 'end of day' and 'intra day(per minute)' data give me the same rate of reversion?<br />it would be great if you can help me with these things..Unknownhttps://www.blogger.com/profile/07038537947080578313noreply@blogger.comtag:blogger.com,1999:blog-35364652.post-88312793589532651342009-08-24T21:21:34.645-04:002009-08-24T21:21:34.645-04:00Vipin,
The entry and exit of your pair is determin...Vipin,<br />The entry and exit of your pair is determined by the zscore of the spread. For e.g., you might buy when the spread is at 2 std below the mean, and exit when it is at 1 std. For details, you can refer to the GLD-GDX example in my book.<br />ErnieErnie Chanhttps://www.blogger.com/profile/02747099358519893177noreply@blogger.comtag:blogger.com,1999:blog-35364652.post-71746158170877557842009-08-23T14:05:29.246-04:002009-08-23T14:05:29.246-04:00Great Blog Ernest. I learned quite a few things he...Great Blog Ernest. I learned quite a few things here.<br /><br />I have a query, if i decide my pair trades based solely upon the ADF test. How do i decide my stop loss and target for the same?Vipin Kumarhttps://www.blogger.com/profile/16990892515887795731noreply@blogger.comtag:blogger.com,1999:blog-35364652.post-51249045556065479492009-06-16T07:10:14.976-04:002009-06-16T07:10:14.976-04:00shailendra,
If you are a reader of my book or a su...shailendra,<br />If you are a reader of my book or a subscriber to my Premium Content, you can get these 2 articles on http://www.epchan.com/subscription on how to construct a basket of stocks that cointegrate with an ETF, where the residuals are stationary:<br /><br />1. Index tracking and arbitrage using cointegration<br />2. Arbitrage between XLE and its Component Stocks<br /><br /><br />ErnieErnie Chanhttps://www.blogger.com/profile/02747099358519893177noreply@blogger.comtag:blogger.com,1999:blog-35364652.post-76031738375084340492009-06-16T03:03:28.431-04:002009-06-16T03:03:28.431-04:00hiii i made all algorithm based on EG method coint...hiii i made all algorithm based on EG method cointegration and then ADF unit root test.<br />now when I tested this on second by second data of two stocks of 1 day then it showed the residual non stationary .<br />as i tried on many combinations it give all non stationary.<br />where I can get detail regarding selection of stocks and amount of data and tick by tick data or day by day.shailendranoreply@blogger.com