tag:blogger.com,1999:blog-35364652.post617835404029376426..comments2023-01-31T01:51:34.473-05:00Comments on Quantitative Trading: Momentum strategies: a book reviewErnie Chanhttp://www.blogger.com/profile/02747099358519893177noreply@blogger.comBlogger66125tag:blogger.com,1999:blog-35364652.post-52484080459674704202015-10-10T20:32:51.627-04:002015-10-10T20:32:51.627-04:00http://mebfaber.com/2015/06/16/three-way-model/http://mebfaber.com/2015/06/16/three-way-model/Mhttps://www.blogger.com/profile/13278406145594006582noreply@blogger.comtag:blogger.com,1999:blog-35364652.post-54070008781289639582015-03-11T19:09:21.315-04:002015-03-11T19:09:21.315-04:00Hi Tianyi,
The Last.Low in Box R3 represents the l...Hi Tianyi,<br />The Last.Low in Box R3 represents the low price of the last bar. So the condition means that the last bar's low is in fact the 10-day low.<br /><br />I wouldn't worry too much about the exact boxes in the Alphacet program I wrote. Alphacet has ceased to operate as a company and no one can use that program any more.<br /><br />I do not have a current manual of Alphacet's perceptron algorithm, so I do not know its network architecture. I also do not claim there is anything particularly advantageous in their network architect: any decent neural network program (e.g. Matlab's NN toolbox) will probably work as well.<br /><br />ErnieErnie Chanhttps://www.blogger.com/profile/02747099358519893177noreply@blogger.comtag:blogger.com,1999:blog-35364652.post-57710150141936749852015-03-11T11:48:47.567-04:002015-03-11T11:48:47.567-04:00Hi Ernie,
Thank you for explanation of "77/2...Hi Ernie,<br /><br />Thank you for explanation of "77/27" in Thorp's paper. I have another question regarding Example 7.1 in the book "Quantitative Trading". I post the question here since I haven't find an article for both machine learning and momentum strategy in your blog.<br /><br />The first question is about the thresholds for buys and shorts. According to figure 7.2, in box R3, it seems we buy GS when the percentage change is greater than 1 and 10 days moving low is greater than some low price. What is the latter low price? What is the time horizon for the percentage change, daily or 10 days?<br /><br />The second question is I only found boxes S1, I2, R3, R4, I5, I6, C7, and C8 in figure 7.1. What is boxes I7 and I9 you mentioned to run a perceptron learning algorithm?<br /><br />My last question is regarding the perceptron learning algorithm. I am confused about the topology and activation function of the Neural Network, and data for the output layer. My guess is that the NN has three layers, 1 input layer with 3 nodes, 1 hidden layer with 2 nodes and 1 output layer with 6 nodes. The features for the input layer are percent-change(what is the time horizon), 10-day high/low from GS price time series. With these features, the hidden layer will out put the returns of 2 buy/sell strategies. The weights between input layer and hidden layer are all 1's. The out put layer will be the returns for 6 different holding periods. and we learn the optimal weights between hidden layer and the out put layer. Is this the structure of Neural Network you used for example 7.1? What is the activation function for hidden layer and output layer? My guess is linear function. What is the returns of 6 holding periods for output layer? My guess is that these returns are computed directly from GS price time series without implementing buy/sell strategy. Thank you very much for your clarification.Tianyi Jianoreply@blogger.comtag:blogger.com,1999:blog-35364652.post-49193653070682269032014-09-03T08:17:36.312-04:002014-09-03T08:17:36.312-04:00Yes, backadjusting does introduce a potential look...Yes, backadjusting does introduce a potential look-ahead bias into the data, since on day t, we need to know the price on day t+1 in order to obtain the adjusted value. Forward adjustment changes the price on day t based on prices t=1,..., t-1 only. <br /><br />However, many commercial software does not have forward adjustment. So you either have to do it yourself, or tolerate a bit of look-ahead bias.<br /><br />ErnieErnie Chanhttps://www.blogger.com/profile/02747099358519893177noreply@blogger.comtag:blogger.com,1999:blog-35364652.post-43592940904642382602014-09-03T00:59:40.649-04:002014-09-03T00:59:40.649-04:00Hi Erine,
I m reading P12. of your new book regar...Hi Erine,<br /><br />I m reading P12. of your new book regarding of how to built a futures continuuos contract for mean revision backtesting, in which you suggested of using back-adjusting method. <br />But from your reply to some other reader's question shown above, you suggested the forward adjusting method, so I m confused of which method should be the right one, you said that the forward adjusting method can eliminate the look ahead bias, can you elaborate on this? thanksAnonymousnoreply@blogger.comtag:blogger.com,1999:blog-35364652.post-34277945981968953932014-09-03T00:21:48.013-04:002014-09-03T00:21:48.013-04:00Hi Erine,
I m reading P12. of your new book regar...Hi Erine,<br /><br />I m reading P12. of your new book regarding of how to built a futures continuuos contract for mean revision backtesting, in which you suggested of using back-adjusting method. <br />But from your reply to some other reader's question shown above, you suggested the forward adjusting method, so I m confused of which method should be the right one, you said that the forward adjusting method can eliminate the look ahead bias, can you elaborate on this? thanksAnonymousnoreply@blogger.comtag:blogger.com,1999:blog-35364652.post-4108672063516215952014-04-23T16:06:12.396-04:002014-04-23T16:06:12.396-04:00Hi Anon,
If you don't have enough data to run ...Hi Anon,<br />If you don't have enough data to run cointegration test, then you can indeed use forward-adjusted continuous contracts for that performance. <br /><br />I did not say that you have to wait a while to get into position for a new contract after rollover. A trading strategy on futures will likely generate long signals for multiple contracts simultaneously: but of course we choose to enter into position in only the nearest contract at any one time.<br /><br />ErnieErnie Chanhttps://www.blogger.com/profile/02747099358519893177noreply@blogger.comtag:blogger.com,1999:blog-35364652.post-26503525377376522782014-04-23T14:43:05.087-04:002014-04-23T14:43:05.087-04:00Hi Erine
I m reading your book now. It is a good ...Hi Erine<br /><br />I m reading your book now. It is a good book with practical examples. thx.<br /><br />Yesterday, you said I should avoid of using continuous future contract.<br /><br />In that case, doesn't mean that I should still using a 3 years of 3M future historical data (without rollover gap adjustment) and treat it as a one price series to do the cointergration test and find the hedge ratio.<br />In this case, will the gap affect the long term mean and variance and gives an unreliable hedge ratio if the data points are not enough?<br /><br /><br />You also quoted "Using the actual contract prices will not cause a gap if you are careful: it is just like trading 2 different stocks on 2 consecutive days. One should not use the price of the first stock to generate signals on the second stock, nor calculate the P&L by mixing the prices of 2 stocks<br /><br />Let say I long the front contract,I should sell this contract before the rollover date at time T, and then buy the next contract after the rollover at time T+1. <br />Base on your suggestion above, I should not immediatedy long the contract at time T+1, but wait for a new trading singal (let say I m using z-score) that generated after T+1 to long again? Am I right?<br /><br /><br />Thanks<br />Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-35364652.post-42466707518302891862014-04-22T15:28:37.467-04:002014-04-22T15:28:37.467-04:00Hi Anon,
Yes, you should use the bid/ask for both ...Hi Anon,<br />Yes, you should use the bid/ask for both contracts at the same time at 15:00 for your backtest. It is not possible to ensure that one can filled at the settlement price, hence bid/ask is necessary.<br /><br />Using the actual contract prices will not cause a gap if you are careful: it is just like trading 2 different stocks on 2 consecutive days. One should not use the price of the first stock to generate signals on the second stock, nor calculate the P&L by mixing the prices of 2 stocks.<br /><br />ErnieErnie Chanhttps://www.blogger.com/profile/02747099358519893177noreply@blogger.comtag:blogger.com,1999:blog-35364652.post-36871905079340004732014-04-22T15:11:36.216-04:002014-04-22T15:11:36.216-04:00Hi Erine
Thank you of your reply, I will go to ge...Hi Erine<br /><br />Thank you of your reply, I will go to get your book tomorrow.<br /><br />Before that I would like to check with you. You said I should not use continuous contracts for spread trading: just the actual contract prices.<br /><br />Do you mean that I should use the the LME 3M (most active) intrady day price at 15:00 Asia Time and the SHFE M+3 months intrday price at 15:00, where M = given trading month, to do the backtesting ? Will the gap during the rollover period caused any error to produce a false mean reversion trading signal in this case? <br /><br /><br /><br />Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-35364652.post-11873040542641250282014-04-22T14:36:36.465-04:002014-04-22T14:36:36.465-04:00Hi Anon,
To backtest a spread strategy with 2 futu...Hi Anon,<br />To backtest a spread strategy with 2 futures that close at different times, you need to use intraday data. Settlement prices would not work. Please see page 15 of my book Algorithmic Trading for the detailed explanation.<br /><br />You also should not use continuous contracts for spread trading: just the actual contract prices. If you must use continuous contracts, forward-adjusted is better, since it eliminates any possible look-ahead bias.<br /><br />ErnieErnie Chanhttps://www.blogger.com/profile/02747099358519893177noreply@blogger.comtag:blogger.com,1999:blog-35364652.post-85109115954252947602014-04-22T14:10:47.283-04:002014-04-22T14:10:47.283-04:00Hi Erine,
It is turly great to read your blog, ve...Hi Erine,<br /><br />It is turly great to read your blog, very informative. I would like to seek your advice as I m currently working on a project of an intermarket spread arbitrage of a future product. And I only have little knowledge on future trading<br /><br />1. The contract months for this future traded on the two exchanges are different <br /><br />Exchanges Contract Months<br /><br />SHFE 1-12 months<br /><br />LME 3, 15, 27 months (the most active is the 3m forward contract)<br /><br /><br />If I would like to do a 3 years backtest to evaluate the spread arbitrage window. I have to collect the last 3 years of LME "3 months contract" to join them together to become a 3 years continuous data?<br /><br />For the SHFE, I should take which contract month to form a 3 years continuous data in order to synchronize the continuous data from LME? <br /><br />2.Base on your experience , which type of the rollover adjustment method is most effective, I heard there are Back-adjuste, Forward-adjuste, proportionally adjuste and perpetual series method etc.<br /><br />3. As the 2 exchanges are closed at different time, let say SHFE is closed at 15:00 Asia Time. By right, I should take settlement price at SHFE and the intrady Bid/Ask from LME @15:00 Asia Time<br /><br />But this settlement price from SHFE is weighted average price of the all the trades. In this case I should choose the close price or the settelement price for simulation?<br /><br />Thx.<br /><br />Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-35364652.post-68630682022327866982013-01-27T13:21:02.481-05:002013-01-27T13:21:02.481-05:00Anon,
Actually, I don't agree with your argume...Anon,<br />Actually, I don't agree with your argument.<br />The fact that a portfolio of futures strategies that have low covariance returns, resulting in a higher Sharpe ratio, is precisely why we like such a portfolio.<br />Sharpe ratio is a universally applicable return vs risk measure, so I fail to see what you mean by "not applicable" to futures.<br /><br />ErnieErnie Chanhttps://www.blogger.com/profile/02747099358519893177noreply@blogger.comtag:blogger.com,1999:blog-35364652.post-21971444545632883982013-01-27T06:36:13.082-05:002013-01-27T06:36:13.082-05:00Regarding the reference to the Sharpe Ratio being ...Regarding the reference to the Sharpe Ratio being higher for the portfolio of trend following future models (24) being substantially higher than that of the SP index..... I don't feel the comparison is statistically sound.<br /><br />The active trading present in the portfolio of futures introduces nonlinear dependencies between the individual future strategy returns which increases the Sharpe Ratio as the covariances are reduced.<br /><br />You can easily verify this by carrying out a numerical simulation in Matlab. Simulate bivariate normal returns with a 90% correlation ..... create a scatterplot .... compute the correlation coefficient... .9 ... everything is as expected.... now simulate a binary trading signal for each of the two assets (both with a hit rate o 55% for example) and create a scatter plot of the signal returns (element by element product of the return and signal vectors) .. and you will see an X shaped dependence structure .. compute the correlation coefficient.. you will get close to 0 (a horizontal line) as a straight line can't model an X shape ..... since covariance is based on lines, you can see that a Sharpe Ratio is not a reliable measure for a portfolio of futures models.<br />Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-35364652.post-70771500419048953112013-01-24T09:22:06.346-05:002013-01-24T09:22:06.346-05:00Hi Ed,
By FX pair, I mean X.Y.
Sometimes, X.Y may ...Hi Ed,<br />By FX pair, I mean X.Y.<br />Sometimes, X.Y may not be available from your broker, so you have create one yourself from USD.X and USD.Y.<br />Ernie Ernie Chanhttps://www.blogger.com/profile/02747099358519893177noreply@blogger.comtag:blogger.com,1999:blog-35364652.post-57634740564171873232013-01-24T09:04:22.185-05:002013-01-24T09:04:22.185-05:00Hi Ernie,
I have enjoyed reading both your book a...Hi Ernie,<br /><br />I have enjoyed reading both your book and this blog. I have recently been developing and backtesting mean reversion strategies on FX pairs.<br /><br />In an earlier comment you mention that you currently trade FX pairs too. When you say pairs, do you mean a single pair e.g. EURvUSD, (what I am doing) or do you treat a single currency pair like you would a single ETF and trade a pair of currency pairs as you would a pair of ETFs? <br />i.e. Look for co-integration of the pairs and go long one leg and short the other<br /><br />If you are trading a pair of pairs, what is the benefit of doing this over just trading the resulting currency cross?<br /><br />Many thanks<br /><br />EdEdnoreply@blogger.comtag:blogger.com,1999:blog-35364652.post-35066531562699306802012-11-01T01:56:15.014-04:002012-11-01T01:56:15.014-04:00I am thinking of buying this book, thanks for shar...I am thinking of buying this book, thanks for sharing your review about it ;)Morihttp://moriedka.com/noreply@blogger.comtag:blogger.com,1999:blog-35364652.post-67820001891190510662012-08-04T21:29:49.726-04:002012-08-04T21:29:49.726-04:00Ernie,
Thanks. i was referring to the realized sh...Ernie,<br /><br />Thanks. i was referring to the realized sharpe but it's good to know the difference from backtests. <br /><br />BrianAnonymousnoreply@blogger.comtag:blogger.com,1999:blog-35364652.post-45353835734397083692012-08-04T14:43:22.546-04:002012-08-04T14:43:22.546-04:00Hi Brian,
Do you mean backtest Sharpe ratio or rea...Hi Brian,<br />Do you mean backtest Sharpe ratio or real one over a few years?<br /><br />For backtest, it isn't too difficult to get a Sharpe of over 2. But in real trading, a Sharpe of 1 over several years is considered quite a success.<br /><br />Yes, mean reversion strategies can typically get higher Sharpe ratio than momentum strategies. But mean reversion strategies are subject to black-swan losses that used to hit once every 10 years, but are getting more frequent in the recent decade.<br /><br />ErnieErnie Chanhttps://www.blogger.com/profile/02747099358519893177noreply@blogger.comtag:blogger.com,1999:blog-35364652.post-75513975146302015872012-08-04T12:02:28.607-04:002012-08-04T12:02:28.607-04:00Hi Ernie,
I really like your blog. Thanks for you...Hi Ernie,<br /><br />I really like your blog. Thanks for your effort.<br /><br />My question is a little off topic. What kind of Sharpe ratios do you think a good systematic trader can achieve in trading FX or futures, respectively (assuming they use brokers like IB and hence no HFT)? You would think a mean reversion strategy would be a better candidate to achieve that than a momentum strategy?<br /><br />BrianAnonymousnoreply@blogger.comtag:blogger.com,1999:blog-35364652.post-72095792861744170092012-08-01T14:23:25.578-04:002012-08-01T14:23:25.578-04:00Hi Anon,
That depends on what type of order. If I ...Hi Anon,<br />That depends on what type of order. If I am sending a limit order, I typically just send it to Smart on IB. I haven't traded this for a while, so I don't remember if IB pays you the exchange rebate for providing liquidity. If so, then this is an additional consideration.<br />ErnieErnie Chanhttps://www.blogger.com/profile/02747099358519893177noreply@blogger.comtag:blogger.com,1999:blog-35364652.post-19250975840820607592012-08-01T09:56:52.209-04:002012-08-01T09:56:52.209-04:00Hi Ernie,
In IB, Do you choose Primary Exchange f...Hi Ernie,<br /><br />In IB, Do you choose Primary Exchange for ETFs trading when we need to choose in "Contract"?<br /><br />Thank you.Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-35364652.post-80322039280365128012012-07-31T13:24:23.467-04:002012-07-31T13:24:23.467-04:00Hi Anon,
Stock pairs are very much affected by cor...Hi Anon,<br />Stock pairs are very much affected by corporate news and events, and I do not have time to monitor and analyse those events.<br />ErnieErnie Chanhttps://www.blogger.com/profile/02747099358519893177noreply@blogger.comtag:blogger.com,1999:blog-35364652.post-26575214050494801732012-07-31T11:18:35.299-04:002012-07-31T11:18:35.299-04:00Hi Ernie,
May I ask why you don't trade pairs...Hi Ernie,<br /><br />May I ask why you don't trade pairs of stocks?<br /><br /><br />Is it too risky because of bankruptcy?<br /><br />Or stocks pairs are not stable.<br /><br />Or need more capital to trade stocks portfolio.<br /><br />Thank you.Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-35364652.post-3564255425749819152012-07-31T08:06:33.616-04:002012-07-31T08:06:33.616-04:00Hi Anon,
I have never traded pairs of stocks, only...Hi Anon,<br />I have never traded pairs of stocks, only ETFs.<br />ErnieErnie Chanhttps://www.blogger.com/profile/02747099358519893177noreply@blogger.com