tag:blogger.com,1999:blog-35364652.post5883794759866180536..comments2022-01-18T09:16:21.942-05:00Comments on Quantitative Trading: Phantom quotesErnie Chanhttp://www.blogger.com/profile/02747099358519893177noreply@blogger.comBlogger31125tag:blogger.com,1999:blog-35364652.post-39292478060689427932010-10-25T08:39:58.329-04:002010-10-25T08:39:58.329-04:00Hi Anon,
Why not use bid-ask-last to backtest? If ...Hi Anon,<br />Why not use bid-ask-last to backtest? If not possible, then last is good enough. <br />ErnieErnie Chanhttps://www.blogger.com/profile/02747099358519893177noreply@blogger.comtag:blogger.com,1999:blog-35364652.post-86736592257618625642010-10-24T00:57:56.894-04:002010-10-24T00:57:56.894-04:00Thank you, I have another question on the intraday...Thank you, I have another question on the intraday pairs trading? I can get consolidated trades or consolidated quotes for the day. Do you have any advice as to what data I would be better off using? The quotes seem more complete since they will provide me with multiple bids and asks for every second. If I use the trades I won’t have data every second, but the data will be much less complex to sort. In intraday back-testing is it essential to use bid and ask prices as opposed to actual trade data?Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-35364652.post-8174824091376325052010-10-20T02:30:52.361-04:002010-10-20T02:30:52.361-04:00This Trader lost over $100k
http://stockmarketlos...This Trader lost over $100k<br /><br />http://stockmarketloss.wordpress.comAnonymousnoreply@blogger.comtag:blogger.com,1999:blog-35364652.post-56398642071870541042010-10-18T09:00:51.365-04:002010-10-18T09:00:51.365-04:00Hi Anon,
Sure, you can try pair trading intraday, ...Hi Anon,<br />Sure, you can try pair trading intraday, but you don't need correlation nor cointegration for that. You can just backtest your strategy with your intraday data, assuming you have a lot of trades to gain sufficient statistical significance. But you would still need to backtest this for at least 6 months. Sorry, I am unaware of any articles on this particular topic.<br />ErnieErnie Chanhttps://www.blogger.com/profile/02747099358519893177noreply@blogger.comtag:blogger.com,1999:blog-35364652.post-73082538457290513062010-10-15T20:07:26.435-04:002010-10-15T20:07:26.435-04:00hi ernie,It seems that you would recommend strateg...hi ernie,It seems that you would recommend strategies that don’t involve holding over night, for pairs trading strategies. I happen to have access to intra-day bid, ask data and want to try this out. I have mostly been using cointegration for my multi-day strategies. For intra-day would I use strictly correlation? Or could I use both correlation and cointegration. Would testing time period sample be intra-day over last couple days? Are there any sources I could read about intra-day pairs trading to answer these types of questions? thanksAnonymousnoreply@blogger.comtag:blogger.com,1999:blog-35364652.post-704350848808612212010-10-09T11:18:59.928-04:002010-10-09T11:18:59.928-04:00Anon,
You can try a much shorter lookback for your...Anon,<br />You can try a much shorter lookback for your hedge ratio and half-life calculations.<br /><br />ErnieErnie Chanhttps://www.blogger.com/profile/02747099358519893177noreply@blogger.comtag:blogger.com,1999:blog-35364652.post-11456447216030014442010-10-08T12:01:15.877-04:002010-10-08T12:01:15.877-04:00Ernie,
You mentioned calculating beta for hedge ra...Ernie,<br />You mentioned calculating beta for hedge ratio every day. I have been doing this in my back test. One day out of the training set I calculate a new beta using the most recent 252 days. Then for every day I calc a new standard deviation and mean (using that rolling 252 day window) and then make a daily z score. My results so far, are not very superior to the boilerplate way you showed us in your book (thanks). Wonder if im doing something wrong. Should I continue down this path? I expected better results from making my code more dynamic? I could use some direction.Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-35364652.post-52665808902152118632010-10-07T10:14:40.090-04:002010-10-07T10:14:40.090-04:00Hi Puzzled,
I recommend trading just a minute befo...Hi Puzzled,<br />I recommend trading just a minute before market close.<br /><br />However, no matter when you enter a trade, you would need to use split/dividend adjusted historical prices. You can use either Yahoo Finance or csidata for such historical prices.<br /><br />ErnieErnie Chanhttps://www.blogger.com/profile/02747099358519893177noreply@blogger.comtag:blogger.com,1999:blog-35364652.post-11641270916917737982010-10-07T04:44:39.197-04:002010-10-07T04:44:39.197-04:00Hi Ernie,
thought to share my findings and impres...Hi Ernie,<br /><br />thought to share my findings and impressions after back-testing the GLD/GDX pair, as I got really impressed from the profitability of the strategy. I have been struggling for months in vain with other strategies, and now I feel like the fish in the Zen story that was asking "where is the ocean?" <br /><br />Moving to applying the strategy in real-time, I was wondering what is the best time to send an order? Is it early in the day based on the price data available till yesterday (in which case the limit combo order would not necessarily be filled as the spread might have got a totally different value than yesterday), or maybe 1 minute before the end of the trading day, while sampling the prices at that time and taking them as the close price of the day? In the latter case, one would need though to adjust the prices based on dividends and splits, which I am not sure how to do.<br /><br />Thanks.Puzzlednoreply@blogger.comtag:blogger.com,1999:blog-35364652.post-32670569947814035242010-10-01T09:39:57.844-04:002010-10-01T09:39:57.844-04:00Hi Anon,
1) I would advise using the same entry/ex...Hi Anon,<br />1) I would advise using the same entry/exit Zscores for all pairs to reduce data snooping bias. In fact, you can try the "parameterless trading" method which sets market value to be proportional to the Zscore.<br />2) I enter whenever it hits the entry Zscore without waiting.<br />ErnieErnie Chanhttps://www.blogger.com/profile/02747099358519893177noreply@blogger.comtag:blogger.com,1999:blog-35364652.post-63500125506889289682010-09-30T17:14:05.533-04:002010-09-30T17:14:05.533-04:00Hello Ernie,
I thank you in advance for your time....Hello Ernie,<br />I thank you in advance for your time.<br />1. When trading a particular pair do you find the optimal zscores to enter and exit for each pair or do trade all of your pairs using the same enter and exit zscores?<br /><br />2. Do you enter into your pairs the first time they hit a particular z-score threshold or do you wait for the second time the threshold in touched, in hopes that the spread is now converging.Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-35364652.post-71405976456309038302010-09-30T09:01:35.790-04:002010-09-30T09:01:35.790-04:00Hi Puzzled,
Yes, GLD-GDX lost cointegration around...Hi Puzzled,<br />Yes, GLD-GDX lost cointegration around 2008. So it may be best to run any backtest or cointegration tests on 2009-10 data. <br /><br />I have not updated the hedge ratio on my website for a deliberate reason: I would like to demonstrate that some pairs remain stationary, while others do not. I.e. I wish to avoid survivorship bias. I recommend recalculating the hedge ratio regularly, maybe even daily for actual trading.<br /><br />ErnieErnie Chanhttps://www.blogger.com/profile/02747099358519893177noreply@blogger.comtag:blogger.com,1999:blog-35364652.post-32500907182366119882010-09-30T04:59:59.714-04:002010-09-30T04:59:59.714-04:00Hi Ernie,
thanks for your tip.
I tried in the l...Hi Ernie,<br /><br />thanks for your tip. <br /><br />I tried in the last couple of days to play with the GLD/GDX pair, downloading the data from Yahoo, and using R as in Paul Teetor guest blog to test for co-integration and calculate the hedge ratio (Date range is 2006-05-23 to 2010-09-28). I got that the ADF p-value is 0.2184305, and the hedge ratio is 2.066777. Plotting the spread, it seems that it had a big jump around 2 years ago - probably during the financial crises. Given the p-value, is this still a valid pair? Would it make sense to strict the analysis to a sub-period of the above dates - say only for the last 1.5 years? I also was wondering regarding the hedge ratio, which differs from the one available on your subscription web-page. How to decide which one to use?Puzzlednoreply@blogger.comtag:blogger.com,1999:blog-35364652.post-84996414225226444062010-09-28T08:27:08.037-04:002010-09-28T08:27:08.037-04:00Hi Anon,
Yes, your interpretation is correct.
Erni...Hi Anon,<br />Yes, your interpretation is correct.<br />ErnieErnie Chanhttps://www.blogger.com/profile/02747099358519893177noreply@blogger.comtag:blogger.com,1999:blog-35364652.post-49872155876582836422010-09-27T23:02:58.455-04:002010-09-27T23:02:58.455-04:00Hello, I have been reading your blog and this inte...Hello, I have been reading your blog and this interesting quote from you caught my eye..<br />"I advocate using parameterless entry, where you scale your market value (position size) proportional to the zscore."<br />Does this mean that for example if you have a zscore of 2 you might put up 2% of porfolio and for a zscore of 3 you might put up 3%? Could you expand on your comment Ernie?Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-35364652.post-56417669514693764972010-09-27T08:38:01.449-04:002010-09-27T08:38:01.449-04:00Hi Puzzled,
Certainly there are mean-reversion on ...Hi Puzzled,<br />Certainly there are mean-reversion on stocks both on an intraday timeframe, as well as pairs on an overnight horizon. <br /><br />However, mean-reversion on an intraday timeframe is more difficult to research, because the entry and exit times need to be optimized quite delicately. Hence I think for a beginner, pair trading ETF's are the easiest and least risky.<br /><br />ErnieErnie Chanhttps://www.blogger.com/profile/02747099358519893177noreply@blogger.comtag:blogger.com,1999:blog-35364652.post-20539559024405453982010-09-27T08:35:40.572-04:002010-09-27T08:35:40.572-04:00Henn,
Yes, you can potentially add some rules to t...Henn,<br />Yes, you can potentially add some rules to turn your pair trading model into a day trading model, which would vastly increase the returns via the day trading leverage.<br />ErnieErnie Chanhttps://www.blogger.com/profile/02747099358519893177noreply@blogger.comtag:blogger.com,1999:blog-35364652.post-20513101629347944822010-09-27T02:14:20.715-04:002010-09-27T02:14:20.715-04:00Hi Ernie,
I am new to trading and have been tryin...Hi Ernie,<br /><br />I am new to trading and have been trying to develop a first simple trading strategy. Reading your book and blogs, I thought to give "mean reversion" a try. However, I am a bit confused, as all my results have been poor so far. I am trying to implement mean reversion in a framework of day trading (window ranging from a couple of seconds to a couple of minutes) on a single stock (*not* market neutral). <br /><br />I was wondering if these are the settings that you have on mind whenever you talk about "mean reversion", or whether I totally misunderstood you, and you think more of pair trading in this context?Puzzlednoreply@blogger.comtag:blogger.com,1999:blog-35364652.post-44375405242862688822010-09-25T16:39:30.548-04:002010-09-25T16:39:30.548-04:00Indeed. At the moment my horizon for my pair trade...Indeed. At the moment my horizon for my pair trades mainly in ETF's is an average of 16 days. While I think there is value in trying to add more theory and math to some extent, I have experienced that having some gut feeling, nonquantitive decision making that is, helped me make better trades and prevent me from entering those where numbers look too good to be true. <br />So far my "timing" has been to enter after a strong widening of spread in the trading day, for example for GDX/SlV on friday, but that could be put into a more quantitive model very easily I guess. I am just starting with making my own codes and so far use quite crude tools.henn.dehttp://henn.denoreply@blogger.comtag:blogger.com,1999:blog-35364652.post-12922437041667061952010-09-25T10:12:35.540-04:002010-09-25T10:12:35.540-04:00Hi Henn,
Thanks for the link to the article -- but...Hi Henn,<br />Thanks for the link to the article -- but I wish these academic researchers will start running their tests on intraday data! <br /><br />I believe that short-term momentum is very hard to capture in stocks. Kudos to anyone who can get the timing right and take profit in time!<br /><br />ErnieErnie Chanhttps://www.blogger.com/profile/02747099358519893177noreply@blogger.comtag:blogger.com,1999:blog-35364652.post-85677965182400546222010-09-24T14:21:41.915-04:002010-09-24T14:21:41.915-04:00I have been thinking about using elements of momen...I have been thinking about using elements of momentum theory to increase my chances on getting the timing better with my trades and I am particulary interested in this paper http://papers.ssrn.com/sol3/papers.cfm?abstract_id=1663266 <br />What do you think about the idea ? Joined the alpha quant club by the way.henn.dehttp://henn.denoreply@blogger.comtag:blogger.com,1999:blog-35364652.post-54078483518594792372010-09-18T05:32:07.182-04:002010-09-18T05:32:07.182-04:00Exchange should start charging small fees for canc...Exchange should start charging small fees for cancelling and changing orders.<br /><br />For example, if an order over certain size from the same account is changed or cancelled within 50ms, then charge some extra fees.<br /><br />I think it is unfair for HFT to trick the market like that.Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-35364652.post-28710730537788206642010-09-12T08:21:45.568-04:002010-09-12T08:21:45.568-04:00Hi Henn,
No, I don't have any other technical ...Hi Henn,<br />No, I don't have any other technical indicator to determine entry. In fact, I advocate using parameterless entry, where you scale your market value (position size) proportional to the zscore.<br />ErnieErnie Chanhttps://www.blogger.com/profile/02747099358519893177noreply@blogger.comtag:blogger.com,1999:blog-35364652.post-43509003346483204242010-09-11T10:40:51.734-04:002010-09-11T10:40:51.734-04:00Hey Ernie
I have a question concerning the timing ...Hey Ernie<br />I have a question concerning the timing of pair trades. Generally I have the criteria to enter into trades with no less than 2 std. from the mean, but I wonder whether you have experience with using technical indicators on the spread curve that helps one to better define at what point to enter and exit a pair trade.henn.dehttp://henn.denoreply@blogger.comtag:blogger.com,1999:blog-35364652.post-38604947180436298932010-09-02T19:26:24.745-04:002010-09-02T19:26:24.745-04:00ok, Thank you.ok, Thank you.Jessenoreply@blogger.com