tag:blogger.com,1999:blog-35364652.post3244506492170317025..comments2022-01-18T09:16:21.942-05:00Comments on Quantitative Trading: How a mean-reversion strategy performed in AugustErnie Chanhttp://www.blogger.com/profile/02747099358519893177noreply@blogger.comBlogger30125tag:blogger.com,1999:blog-35364652.post-27377467575614795362017-09-14T03:11:11.124-04:002017-09-14T03:11:11.124-04:00Maurice,
I am not a technical analyst, and am not ...Maurice,<br />I am not a technical analyst, and am not a big fan of "double top" and "head and shoulders". So I am afraid I can't help you there.<br />ErnieErnie Chanhttps://www.blogger.com/profile/02747099358519893177noreply@blogger.comtag:blogger.com,1999:blog-35364652.post-77164575466080854672017-09-13T18:02:48.861-04:002017-09-13T18:02:48.861-04:00Ernie how would you measure a divergence quantitat...Ernie how would you measure a divergence quantitatively?<br /><br />Example: A stock makes a double top or head and shoulders but a technical indicator like RSI divergences at those points. I'm not sure how to tell programmatically when the mins and maxes of the double top and head and shoulders actually happen.Maurice Hamiltonhttps://www.blogger.com/profile/06191896771005741519noreply@blogger.comtag:blogger.com,1999:blog-35364652.post-73436758980082649252017-08-24T08:58:08.976-04:002017-08-24T08:58:08.976-04:00Maurice,
1) Yes, optimal parameters do indeed cha...Maurice,<br /><br />1) Yes, optimal parameters do indeed change over time.<br /><br />2) Monthly should be fine.<br /><br />3) Sure, that would be systematic.<br /><br />ErnieErnie Chanhttps://www.blogger.com/profile/02747099358519893177noreply@blogger.comtag:blogger.com,1999:blog-35364652.post-82786155261758601722017-08-23T01:55:49.895-04:002017-08-23T01:55:49.895-04:00OK thanks I get that now.
I have my half life, g...OK thanks I get that now. <br /><br />I have my half life, good bollinger period, cointegration, linear regression determining my hedge ratio ect (will do this until i get Gretl or Matlab integrated into my program) <br /><br />These settings only work is specified periods in history, i assume to ensure they work in all application mean reverting periods the variables would need to be dynamic. <br />1.) Is this a correct assumption?<br /><br />2.) How often should I update the half life and check co-integration? Is it something i need to code into my program daily to red flag me if each hit some unreasonable threshold?<br /><br />3.) Should I have the program dynamically run tests and update the half life, hedge ratio, ect. as long as they stay cointegrated? <br />Maurice Hamiltonhttps://www.blogger.com/profile/06191896771005741519noreply@blogger.comtag:blogger.com,1999:blog-35364652.post-54237392879301986102017-08-18T17:48:46.780-04:002017-08-18T17:48:46.780-04:00Maurice,
If spread hits the lower band, long A sh...Maurice,<br /><br />If spread hits the lower band, long A short B.<br />If spread hits upper band, short A long B.<br /><br />If it remains cointegrated but strategy is unprofitable, that means your trading parameters do not suit that period. For e.g. if half life is very long, but the lookback period of your Bollinger band is too short, it won't be profitable.<br /><br />ErnieErnie Chanhttps://www.blogger.com/profile/02747099358519893177noreply@blogger.comtag:blogger.com,1999:blog-35364652.post-42721101650665145132017-08-18T16:26:24.810-04:002017-08-18T16:26:24.810-04:00Ernie, another question for you.
Steps taken
1.)...Ernie, another question for you. <br /><br />Steps taken<br />1.) I have found 2 cointegrated pairs using CADF test in Gretl<br />2.) I have created a program to trade it <br /><br />Problem<br />1.) I am using the spread = PairA - (HedgeRatio*PairB) with bollinger bands to enter trades. <br />1a.) I don't understand how to tell which pair to go long and which pair to go short. <br /> The best results have been when i always go long PairA and always go short PairB but that works well from 2010 - 2013 but completely falls apart in 2014 and gives mediocre gains 2015 forward. <br /><br />Questions<br />1.) How do I know which pair to go long and which pair to go short? I don't understand how to do this using the spread formula. <br />2.) What steps would you take to figure out why the strategy completely fell apart in 2014. The pairs were still co integrated during that time. <br />Maurice Hamiltonhttps://www.blogger.com/profile/06191896771005741519noreply@blogger.comtag:blogger.com,1999:blog-35364652.post-76357309257291962332017-08-06T19:25:22.865-04:002017-08-06T19:25:22.865-04:00Maurice,
Sure, rejection of null at 8% is good eno...Maurice,<br />Sure, rejection of null at 8% is good enough for trading. <br /><br />ErnieErnie Chanhttps://www.blogger.com/profile/02747099358519893177noreply@blogger.comtag:blogger.com,1999:blog-35364652.post-86051951130689071192017-08-06T19:22:01.817-04:002017-08-06T19:22:01.817-04:00Ernie, I have abandoned attempts to trade time unp...Ernie, I have abandoned attempts to trade time unpaired time series, it seems i have strategies that will work great for 2 or 3 years then as you said "i get stuck" and experience a YUGE drawdown. <br /><br />Question - I did some quick co integration (2 series) tests and find p values of 8%, i understand that you can only reject the null hypothesis with less than 5%. Would you take a swing at trying a strategy that is at 8%, doesn't seem that far. <br /><br />When i use the Johansen i get much better eigenvalues for 3 series but i don't understand how to trade 3 pairs just yet, still working on rapping my mind around that.<br /><br />Maurice Hamiltonhttps://www.blogger.com/profile/06191896771005741519noreply@blogger.comtag:blogger.com,1999:blog-35364652.post-12111627315527398402017-07-25T15:07:07.321-04:002017-07-25T15:07:07.321-04:00Hi Maurice,
Yes, this approach would only work for...Hi Maurice,<br />Yes, this approach would only work for pairs that are truly stationary. If there is an extended period where the prices deviate from the reference price, you will be stuck.<br />ErnieErnie Chanhttps://www.blogger.com/profile/02747099358519893177noreply@blogger.comtag:blogger.com,1999:blog-35364652.post-74452160609283892212017-07-25T11:46:46.802-04:002017-07-25T11:46:46.802-04:00Ernie, thank you for constantly replying to all of...Ernie, thank you for constantly replying to all of my questions. I really appreciate it. <br /><br />My first strategy is ready to go live on 5 pairs now i'm working on my second. <br /><br />1.) I merged your example of a bollinger strategy with one i found on youtube. The thing that makes the strategy work is the fact that the trades are not closed until at least one of the trades are in profit. <br /><br />Example: Sell when price is above upper band, average up as price moves up. When price hits the average only sell if one trade is in profit, if one trade is not in profit continue to hold until one trade is in profit then sell. <br /><br />This seems like a huge risk... On the other hand I could see doing this on stationary only pairs... <br /><br />What are your thoughts?Maurice Hamiltonhttps://www.blogger.com/profile/06191896771005741519noreply@blogger.comtag:blogger.com,1999:blog-35364652.post-63573246886017148152017-07-17T16:53:07.348-04:002017-07-17T16:53:07.348-04:00I may have just figured out the answer. This is pr...I may have just figured out the answer. This is probably why your book says trade baskets of the top 10 best performing and the top 10 underperforming so that I am more likely to get something that reverts and doesn't continue to trend.Maurice Hamiltonhttps://www.blogger.com/profile/06191896771005741519noreply@blogger.comtag:blogger.com,1999:blog-35364652.post-70860266115436193492017-07-17T16:38:11.012-04:002017-07-17T16:38:11.012-04:00Ernie, do you have any references to position sizi...Ernie, do you have any references to position sizing? I have a strategy that is consistently 60% accurate but is flat in returns year over year.<br /><br />I'm trying to figure out how to raise and lower my position size depending on some statistic or market condition that tells me there is a slightly better chance the market will go up or down tomorrow. <br /><br />I have tried a trail stop but the returns are mixed and not consistent enough to put in a live environment.Maurice Hamiltonhttps://www.blogger.com/profile/06191896771005741519noreply@blogger.comtag:blogger.com,1999:blog-35364652.post-28857850465548367162017-07-13T14:32:17.907-04:002017-07-13T14:32:17.907-04:00Maurice,
Yes, multiples of half life would be a re...Maurice,<br />Yes, multiples of half life would be a reasonable measure. I suggest at least 100.<br />Ernie<br />Ernie Chanhttps://www.blogger.com/profile/02747099358519893177noreply@blogger.comtag:blogger.com,1999:blog-35364652.post-72311008263177307702017-07-13T13:35:04.776-04:002017-07-13T13:35:04.776-04:00Ernie, I now have a list of about 10 strategies li...Ernie, I now have a list of about 10 strategies lined up to code and test.<br /><br />The first one is a intraday mean reverting strategy that I noticed by observing currency pairs last night. I will be testing for cointegration using the steps outlined in your book but I have no idea how much data I should use for a valid test. <br /><br />Would this be based on a multiple of half lives if the pair is proven to be stationary or and arbitrary 2 weeks of 15 minutes data? What are your thoughts?Maurice Hamiltonhttps://www.blogger.com/profile/06191896771005741519noreply@blogger.comtag:blogger.com,1999:blog-35364652.post-30628177819668871862017-07-13T09:44:43.942-04:002017-07-13T09:44:43.942-04:00Ok thanks!Ok thanks!Maurice Hamiltonhttps://www.blogger.com/profile/06191896771005741519noreply@blogger.comtag:blogger.com,1999:blog-35364652.post-8311995805410573802017-07-13T08:59:22.964-04:002017-07-13T08:59:22.964-04:00Hi Maurice,
Here is a paper on intraday momentum ...Hi Maurice,<br /><br />Here is a paper on intraday momentum trading: https://papers.ssrn.com/sol3/papers.cfm?abstract_id=2198816<br /><br />Here one that is a mixture: https://papers.ssrn.com/sol3/papers.cfm?abstract_id=2419243<br /><br />I haven't used Ultimate Trading Robot myself - no endorsement is implied by my shoutout.<br /><br />My Mean Reversion Strategies course does include discussions of FX and Futures, but mean reversion is most frequently observed in equities/ETFs. However, the techniques discussed are applicable to any markets.<br /><br />If you backtest enough strategies, either inspired by books, blogs, or published papers, and strive to improve on them based on your own backtests, sooner or later you will find one that works. I have seen that happened with many of my students.<br /><br />Ernie<br /><br /><br /><br />Ernie Chanhttps://www.blogger.com/profile/02747099358519893177noreply@blogger.comtag:blogger.com,1999:blog-35364652.post-81807148987066186132017-07-12T23:12:34.825-04:002017-07-12T23:12:34.825-04:00Thank you for the responses above Ernie.
Thanks ...Thank you for the responses above Ernie. <br /><br />Thanks to your blog I was able to fix my FX mean reversion strategy by removing my stop loss last night. GBPUSD and USDCHF worked out very well 2015 forward in back and forward testing. (1 Hour Candles) Then it dawned on me today that the daily swap charges in FX render this strategy useless....<br /><br />Now i am back to the drawing board after working on this thing for about 3 months.<br /><br />I want to focus on currencies because the leverage allows me to make larger profits then stocks or futures. (I don't have 25k to play with) I understand that leverage can be dangerous so i will be sure to manage the risk of my portfolio.<br /><br />Do you have any links or strategies for intraday FX strategies. Mean Reverting or Momentum<br /><br />1.) I just purchased your book today which has given me some great ideas.<br />2.) I found the London Breakout Strategy while digging through your blog today, I will review that and implement it<br />3.) The Ultimate Trading Robot - This price seems ridiculous at 650 bucks but if i have to buy it I will.<br />4.) Does your class focus on mean reverting stock strategies? If i enroll will i be able to implement any of it in the currency markets immediately after the class?<br />5.) Any other thoughts or direction you can give. I'm determined to make this happen if it takes me days, nights, and weekends for the next 10 years.Maurice Hamiltonhttps://www.blogger.com/profile/06191896771005741519noreply@blogger.comtag:blogger.com,1999:blog-35364652.post-49637296828451428922017-07-12T22:41:09.030-04:002017-07-12T22:41:09.030-04:00Thank you for the responses above Ernie.
Thanks ...Thank you for the responses above Ernie. <br /><br />Thanks to your blog I was able to fix my FX mean reversion strategy by removing my stop loss last night. GBPUSD and USDCHF worked out very well 2015 forward in back and forward testing. (1 Hour Candles) Then it dawned on me today that the daily swap charges in FX render this strategy useless....<br /><br />Now i am back to the drawing board after working on this thing for about 3 months.<br /><br />I want to focus on currencies because the leverage allows me to make larger profits then stocks or futures. (I don't have 25k to play with) I understand that leverage can be dangerous so i will be sure to manage the risk of my portfolio.<br /><br />Do you have any links or strategies for intraday FX strategies. Mean Reverting or Momentum<br /><br />1.) I just purchased your book today which has given me some great ideas.<br />2.) I found the London Breakout Strategy while digging through your blog today, I will review that and implement it<br />3.) The Ultimate Trading Robot - This price seems ridiculous at 650 bucks but if i have to buy it I will.<br />4.) Does your class focus on mean reverting stock strategies? If i enroll will i be able to implement any of it in the currency markets immediately after the class?<br />5.) Any other thoughts or direction you can give. I'm determined to make this happen if it takes me days, nights, and weekends for the next 10 years.Maurice Hamiltonhttps://www.blogger.com/profile/06191896771005741519noreply@blogger.comtag:blogger.com,1999:blog-35364652.post-50952653671287307972017-07-12T22:40:11.850-04:002017-07-12T22:40:11.850-04:00Thank you for the responses above Ernie.
Thanks ...Thank you for the responses above Ernie. <br /><br />Thanks to your blog I was able to fix my FX mean reversion strategy by removing my stop loss last night. GBPUSD and USDCHF worked out very well 2015 forward in back and forward testing. (1 Hour Candles) Then it dawned on me today that the daily swap charges in FX render this strategy useless....<br /><br />Now i am back to the drawing board after working on this thing for about 3 months.<br /><br />I want to focus on currencies because the leverage allows me to make larger profits then stocks or futures. (I don't have 25k to play with) I understand that leverage can be dangerous so i will be sure to manage the risk of my portfolio.<br /><br />Do you have any links or strategies for intraday FX strategies. Mean Reverting or Momentum<br /><br />1.) I just purchased your book today which has given me some great ideas.<br />2.) I found the London Breakout Strategy while digging through your blog today, I will review that and implement it<br />3.) The Ultimate Trading Robot - This price seems ridiculous at 650 bucks but if i have to buy it I will.<br />4.) Does your class focus on mean reverting stock strategies? If i enroll will i be able to implement any of it in the currency markets immediately after the class?<br />5.) Any other thoughts or direction you can give. I'm determined to make this happen if it takes me days, nights, and weekends for the next 10 years.Maurice Hamiltonhttps://www.blogger.com/profile/06191896771005741519noreply@blogger.comtag:blogger.com,1999:blog-35364652.post-3335972794313319142017-07-11T21:40:06.439-04:002017-07-11T21:40:06.439-04:00Thank you for your reply Ernie, this blog is and f...Thank you for your reply Ernie, this blog is and filled with nuggets!Maurice Hamiltonhttps://www.blogger.com/profile/06191896771005741519noreply@blogger.comtag:blogger.com,1999:blog-35364652.post-27798087851852968102017-07-11T17:38:39.744-04:002017-07-11T17:38:39.744-04:00Hi Maurice,
1) My next online Mean Reversion Strat...Hi Maurice,<br />1) My next online Mean Reversion Strategies workshop will be on July 29 and Aug 5, 9am-12pm New York time. Please see http://www.epchan.com/workshops/ for details.<br /><br />2) No, the basket in this article does not have to be cointegrating, or even correlated. However, each individual stock is definitely correlated with the average return of the basket. This correlation is often called "beta".<br /><br />3) Sure, my second book in particular discuss many different implementation of mean reversion strategies. And my course in 1) discussed a different set of such strategies.<br /><br />ErnieErnie Chanhttps://www.blogger.com/profile/02747099358519893177noreply@blogger.comtag:blogger.com,1999:blog-35364652.post-86783605841937560872017-07-11T13:50:55.860-04:002017-07-11T13:50:55.860-04:00Ernie
1.) When is your next work shop in the US?
...Ernie <br />1.) When is your next work shop in the US?<br />2.) Does this basket if stocks he is buying and selling have to be correlated or cointegrated?<br />3.) Does your book highlight things that will give me direction on finding mean reverting strategies?Maurice Hamiltonhttps://www.blogger.com/profile/06191896771005741519noreply@blogger.comtag:blogger.com,1999:blog-35364652.post-36852150356317769272010-11-17T17:02:28.746-05:002010-11-17T17:02:28.746-05:00Hi, I think mean-reversion system is paired with h...Hi, I think mean-reversion system is paired with huge intraday drawdown and that can NOT be avoided. If you use a tight, fixed stop loss for mean-reversion, the performance will be dramatically reduced. For a trend following system, the stop loss can be tight as 1 ATR without affecting performance much. But for mean-reversion system, the stop loss need to be at least 3 times ATR or most of cases higher. I think the huge drawdown is the cost to have a high winning percentage and you can't get the best from both world.Unknownhttps://www.blogger.com/profile/16120464805660473306noreply@blogger.comtag:blogger.com,1999:blog-35364652.post-88833384060864184242008-07-23T23:13:00.000-04:002008-07-23T23:13:00.000-04:00I had a done a similar thing but on the long term....I had a done a similar thing but on the long term. I invested in the long term for companies who did well one day and companies who did poorly one day.<BR/><BR/><BR/><BR/>Over 1.5 years my returns were 50% and 13% respectively. That 13% would be wiped out by all the fees I would've had to pay. Where as that 50% would've been ok. I don't know the current valuation in the current economy.Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-35364652.post-48095508898220177802007-10-31T22:05:00.000-04:002007-10-31T22:05:00.000-04:00Dear Anonymous,1) I think your argument is mainly ...Dear Anonymous,<BR/><BR/>1) I think your argument is mainly with Prof. Lo. I simply paraphrased his conclusions.<BR/><BR/>2) Strategies that trade highly liquid stocks (such as the midcap stocks in Prof. Lo's study) at most twice a day (once, in Prof. Lo's study; twice, in my suggestion) do not suffer so much impact from transaction costs that would render them unprofitable. This is both from my own theoretical studies as well as actual trading experience.<BR/><BR/>3) The point of Prof. Lo's study is not the exact magnitude of the daily returns, which would of course be lowered by the introduction of transaction costs. The point is the sign of the returns, which as I argued above, is unlikely to be changed here.<BR/><BR/>ErnieErnie Chanhttps://www.blogger.com/profile/02747099358519893177noreply@blogger.com