Tuesday, June 19, 2012

Momentum strategies: a book review

As a devout mean-reversion trader, I find Mike Dever's new book "Jackass Investing" unexpectedly well-argued and readable.

You see, 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 brusquely 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.

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!

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. 

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&P500 index (SPX) with the S&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:
S&P DTI index
Since its high watermark in 2008/12/5, this representative momentum strategy has been in a relentless drawdown. Why? This is due to another well-studied and troubling property of momentum strategies: they always performed poorly for several years after a financial crisis.






65 comments:

  1. Hi Ernie,

    Although I agree it can be two different mindsets, I wonder if mean-reversion and momentum traders "can all get along" if we just consider it on two quite very different timeframes. Both want to get in soon after the turn and ride the (temporary) momentum, whether it is minutes or days, to the next turn.

    Or, what other nuances do you see the trading methods differing?

    Best,
    Ken

    ReplyDelete
  2. Oh, and us "more sensitive types" are welcome to buy his identical book, but otherwise titled "Exploiting the Myths." Now that's marketing!

    ReplyDelete
  3. Hi Ken,
    Certainly we have find both momentum and mean reversion on the same time series but at different time frames.

    Also, we can impose a mean-reversion filter on a momentum strategy to make it more consistent.

    Ernie

    ReplyDelete
  4. Hi Ernie,

    great article. I also like the idea of combining momentum and mean-reversion strategies. But as i favor the mean-reversion approach as well, i would be more interested in a momentum filter on a mean-reversion strategy. Like first filtering all stocks out that will be likely to follow an "unnatural" trend (probably because of some reason hard to measure by a quant, like news of "fashion", like with APPL), and second applying the mean-reversion strategy to the rest.

    What do you think about that?

    Greets Timo

    http://thekairosaiproject.blogspot.com/

    ReplyDelete
  5. Hi Timo,
    Sure, we should filter out "news" stocks in a mean-reverting strategy because they likely have momentum due to the news. I don't know how to define fashion though.
    Ernie

    ReplyDelete
  6. Hi Ernie,

    I understand that you use IB to trade.

    Their combos only allow for two legs to be executed.

    If you would like to place a limit order consisting of several legs, how do you go about?

    I am aware of the basket trader but then you have to watch each limit order yourself.

    Thanks for your insights,

    Jack

    ReplyDelete
  7. Hi Jack,
    I typically have to control the execution of such basket using a Matlab program together with the quant2ib api provided by exchangeapi.com
    Ernie

    ReplyDelete
  8. Hey Ernie,

    Thanks again for the book suggestion! The main nugget that I walked away with centered around his view of diversification, focusing not on asset classes like one normally hears, but on his termed "return drivers", or translated for this forum, "trading strategies/algos on different instruments". As you highlight in your book the case for evalutating the cointegration of strategies, his take on diversification matches nicely. And, with this diversification, one can see the potential to minimize drawdowns.

    Some small points I might not agree on, nor follow blindly, and re-chart as you already highlighted; but, certainly a worthy read; plus, accessible for newer audiences as well, to whom I was at ease to recommend.

    Thanks again for the suggestion to us!

    Regards,
    Ken

    ReplyDelete
  9. Interesting observations. I have formed and opinion on this over the years. Success lies in walking this razor blade between "trend religion" and "reversion religion". I do agree that people would seem to naturally gravitate to one or other pole. However, I hold the conviction that success follows commitment to doubt and a good weather eye. In short, focus attention on reading the conditions as to which is best and allocate accordingly. Recognizing that you can't be certain, allocate to each.

    This is the very hardest thing to do in markets and the one TRUE secret of success. Have the wisdom and courage to know that both work but certainty is not a luxury afforded those who venture into markets.

    All wisdom is educated doubt against the certainty that what works now will not work in perpetuity.

    ReplyDelete
  10. Thanks for your reply Ernie.

    Are you aware of any software that is good at executing multi-leg trades and that can be linked to IB?

    Jack

    ReplyDelete
  11. Hi Jack,
    I am not aware that there are other software packages linked to IB that can execute multileg trades.
    Ernie

    ReplyDelete
  12. Hello Ernie,
    Thanks for the article. You, on a few occasions, refer to "positive kurtosis" but do you instead mean "positive excess kurtosis"?..just want to make sure I understand fully.

    Thanks

    ReplyDelete
  13. Hi Anon,
    Yes, by kurtosis I meant "excess" kurtosis.
    Ernie

    ReplyDelete
  14. Hey Ernie

    I want to ask how do you normally monitor your legs for a pairs trade? I know Interactive Brokers has a combination order function but you still have to monitor the prices as I understand. Do you just constantly switch between what contract you are requesting? I'm a bit worried about the slippages in executing the trade and missing my trades being filled.

    I guess this may be a bit too specific for you to answer but it'd be great if you could provide some insight. THanks!

    ReplyDelete
  15. Hi Anon,
    The IB combination order allows you to set a limit price for the combination, so you don't have to monitor prices yourself at all.
    Ernie

    ReplyDelete
  16. I recently had a momentum strategy that worked great for a couple of months and then died a rather sharply defined death. It involved hundreds of different stock, and many different trades so I don’t think it was as simple a data snooping bias, or some general market trend issue.

    I got to thinking, what could make such a broad based strategy work, and more importantly not work, in such a short time span. That led to speculation about market manipulation for the purpose of money laundering. I know, it sounds like some sort of a wacko conspiracy theory, but hear me out.

    Suppose party A wants to anonymously give money to party B for whatever reason. Party in this case could be a political organization, government entity, foreign party, corp. or whatever, and the reason might not be nefarious. It goes something like this. A buys a stock pushing it up, then at a pre-determined point, B sells the stock short even as A keeps buying. Then A starts selling, pushing the stock down, and B buys to cover at the lower price. A loses money (by design) and B makes money, creating a transfer of funds with no obvious connection between A and B. There are a million variations on this theme, so they spread it out over many stocks or other vehicles, and many not so obviously similar techniques. There are many other unaware parties to the transaction so they have to pick their spots carefully, otherwise the efficiency of the transfer could get pretty bad. Then again, if they pick their spots well the transfer efficiency could sometimes be better than 1:1. Also, any loss of transfer efficiency could be a price they are willing to pay for the anonymity of the transaction.

    The key, is knowing who is doing what when. Then we can siphon off a portion of the transfer for ourselves. Obviously they won’t just tell us what their plan is so we have to detect it from the data. If they are smart, and I assume they are, they will make that very difficult. The point of all this is, once we realize that this is the game we are actually playing, and not some more rational game based on real market forces, we might just be able to play the game better. (Not that I am making any claims about playing the game very well myself…)

    So what do you and your readers think? Is this nuts or what?

    ReplyDelete
  17. This comment has been removed by the author.

    ReplyDelete
  18. Thanks for the quick reply last time early on the combination order thing!

    I have another question that I hope you can help me with. Is there anyway to directly monitor the spread using the combination order? Can you just stick the Contract object that contains the two legs of the trade into the reqMktData() function, or is that not the way to do it? Thanks so much!


    As for the post above me, personally I think the specific purpose of such a transaction doesn't necessarily need to be money laundering specifically. I think a steady buildup of optimism for a single stock followed by immediate realizaton that the stock isn't that good after will create the same effect, and with hundreds of players on the markets, its no coincidence if something like it happens. if money laundering really was the driving factor, then you just picked up on an heavy amount of illegal activity during those few months with your strategy and should probably notify someone (i'm just kidding)

    ReplyDelete
  19. Hi R.D.
    Certainly your story is one of the many possible explanations.

    But first, how long had your momentum strategy been working? How long in backtest?

    Second, how do you know it won't recover next month?

    Third, have you looked at any macroeconomic or corporate fundamentals explanations?

    Ernie

    ReplyDelete
  20. Anon,
    If you constructed your Contract object with 2 legs, you can get market data on it just like any other Contract on IB. I.e. via reqMktData.
    You can see that from the IB API reference pages on Placing a Combination Order.
    Ernie

    ReplyDelete
  21. Ernie, I had to do some research to answer your questions.

    How long had your momentum strategy been working? How long in backtest? – The origional backtest was for a years worth of daily data 11/29/10 to 12/1/11, on 586 stocks. It generated 198 trades on 169 different stocks meaning it mostly didn’t trade the same stock twice. The Sharp ratio was 2.86%. Truth be told, most of the gains were from 8/19/11, to 11/4/11, a little over 2 months, comprised of 42 trades. As of 12/1/11, it wasn’t clear that the opportunity I had found was already dead for most of a month. With the benefit of more recent data it is very clear.

    Second, how do you know it won't recover next month? – I don’t. All I can do is continue to run it with new data and see if it perks up again. If it did perk up I would lose some time waiting to see if it was reliable again. Then if I started trading and it died again I would lose some money before recognizing that it was dead. I am not hopeful at this point.

    Third, have you looked at any macroeconomic or corporate fundamentals explanations? – I looked at broad market data like market indexes, but didn’t see any obvious correlation. As for corporate fundamentals, there were many different corporations and industries involved. The truth is, I don’t have any really good tools to answer this question.

    By the way, my personal bias is towards mean reversion, not momentum models. I worked out this momentum model because that is where the data led.

    So, If I were a party creating this pattern as a side effect of my primary goal, I would monitor the efficiency of my primary result. When the efficiency started to drop I would assume that someone had figured out the pattern and started to siphon money off for themselves. At that point I would switch out the pattern parameters and make the parasites find the new pattern. Or if I was really clever, I might somehow reverse the pattern to make the parasites pay me until they gave up. I suspect however, that broader market forces would make it impossible to simply reverse the pattern without losing lots of money, even if it did manage to hurt the pattern hunting parasites. By switching up time frames, trading vehicles, etc. I could probably accomplish my goal without repeating the same pattern too often. Then again, there might be hundreds of other pattern creators, and some of them might not be clever enough to realize that they are leaving tracks for someone like me to follow. If so, they will give money away until they can’t afford to any more, and then stop for that reason. Either way, it looks like I should not expect to find something that works steadily for any length of time.

    If this whole thing turns into an escalating battle of wits and computer horsepower, then I assume I will lose. I am just one person with a PC, and not the brightest person at that...

    ReplyDelete
  22. Hello Ernie,

    It's a bit off topic, but i was wondering if u can give me an opinion.
    Is it possible to create a weigthened portfolio according to Markowitz theory, in Forex exchange? currency trading.

    I know that this model is pretty static, and i wanted to use daily returns (instead of monthly)to determine which currency pairs to trade according to return/risk ratio. Thus, i would create a basket that would have best risk-reward.
    I know that u have sugested Kelly formula ( or half Kelly), to determine leverage, but if we trade more pairs, than our overal risk is not lower.
    Also,i assume that higher correlation would be an issue when constructing portfolio, but if its under 100%, than it's still worth ?

    Regards,
    Marko

    ReplyDelete
  23. R.D.:
    I think your backtest period is too short to draw any conclusions. If you backtest this for 5 years, then we can see what the maximum drawdown duration is and compare with the current drawdown to see if it is unusual.
    Ernie

    ReplyDelete
  24. Hi Marko,
    By using Markowitz portfolio optimization method to hold currencies, you are assuming that the historical mean returns of each currency will persist, which may or may not be true. It is worthwhile to test this hypothesis, but I suspect your holding period and thus drawdown will be quite long.
    Ernie

    ReplyDelete
  25. Ernie,

    Not to argue, but just to clarify, about my backtest period being too short...

    I have always felt that the critical issue was not the length of time, but the number of trades. The distinction is especially important since a 10 year backtest could produce only 3 lucky trades, or a 1 day backtest could produce thousands of trades. So are you really saying that the time frame is too short, or that 198 trades is not statistically significant? To be harder on myself, the 42 trades where the strategy was making money hand over fist is a small enough number to make me nervous. Adding the remainder 156 trades that were apparently under a different regime doesn’t really help, assuming that there really was something special about the time frame of those 42 trades. Likewise, 10 years of “out of regime” data wouldn’t help either.

    In my experience there is never enough data, and I always want more. That is why my model is based on 586 stock years of data, which is not only almost all the stocks that meet some basic volume and volatility requirements, but it also represents enough data to nearly give Excel a heart attack. (Yes, a different backtest platform would solve the latter problem.)

    By the way, I have read your book (with relish), and much of what you wrote is confirmed by my experience, although I thought your rule of thumb about the sample size to minimize data snooping bias (on page 53) is a bit off. IMHO, it’s the ratio of trades to free parameters that’s important, not the ratio of raw data to free trade parameters. You could, for example, have one free parameter that finds one single profitable trade in a huge data set, but it would be a terrible model, both because you can’t expect to make much on one (future) similar trade and because you can’t expect that one fringe condition to have a repeatable outcome.

    On a related topic, I think it is practically impossible to quantify the number of free parameters in a model. (You allude to this in your book without ever actually saying it.) There are the obvious free parameters, the ones that change during optimization, and then there are the many others that are just part of the structure of the model, and even though they might not be formally optimized, they are chosen, and sometimes modified as the model is being developed. Even then, you can’t just count them up as integers because some free parameters are more free than others. For example, you can optimize a free parameter over a wide range, a narrow range, or even fix it at one value, though you must have chosen that one value somehow... So how do you determine how much data or how many trades is enough? I humbly admit, I don’t know, but my intuition tells me that more trades is better.

    Oh, and I also humbly acknowledge your superior knowledge and ability, as evidenced by your ability to make a living doing this stuff, something I have yet to do.

    ReplyDelete
  26. R.D.
    I agree with your point of using number of trades per parameter instead of number trading days per parameter as the better rule of thumb, in terms of statistical significance.

    However, the point of using 3-5 years of data is precisely because financial statistics is not stationary. So even though the vast number of trades within a year may be highly statistically significant, this backtest does not show how likely that this is just a temporary regime. As another rule of thumb, quant traders always want to make sure that their backtests include data from both bull and bear market, and include periods of financial crises and their aftermath. In our current world, that means starting with data dating back to at least 2007.
    Ernie

    ReplyDelete
  27. Ernie,
    I see your point. Backtesting my strategy over a longer period might find other periods where it works, giving me some idea whether it is something that comes and goes, or is a 1 hit wonder, as my current one year data set suggests. I was previously working on the assumption that the older the data the less likely it is to be relevant to present time, but if we assume that things might be cyclical, then older data might be more relevant than more recent data. Thanks for the insight.

    R.D.

    ReplyDelete
  28. Great stuff as always. Thanks for answering questions as well. Great read.

    ReplyDelete
  29. Haha I meant to ask. You never mentioned whether the book was worth the read or did your post cover most of the important stuff to glean from the book?

    Thanks.

    ReplyDelete
  30. John,
    The book is worth the read, considering the price and all the extra materials on his website that you can access.
    Ernie

    ReplyDelete
  31. Dear Ernie,

    May I ask a question?

    I want to buy intraday equity data which is already dividends and splits adjusted.

    Is Kibot a good choice?

    Or you have other suggestions?

    Best

    Chu

    ReplyDelete
  32. Hi Chu,
    Kibot does seem like a good choice. Not only is it split/dividend adjusted, it is also survivorship-bias-free. I confess I haven't heard of this company before you mentioned it.

    I myself use tickdata.com, which seems more expensive than Kibot.
    Ernie

    ReplyDelete
  33. Hi Ernie,

    Do you trade single stock futures at OneChicago?

    Where do you get historical data for SSFs?

    Thanks,
    Jack

    ReplyDelete
  34. Hi Jack,
    I have traded SSF before. You can get daily data from CSIdata.com
    Ernie

    ReplyDelete
  35. Hi Ernie,

    Usually how much leverage do Prime Brokers provide for their clients?

    Thanks.

    ReplyDelete
  36. Hi Anon,
    For a market-neutral stocks portfolio, typically 6x.

    You may be able to get that from IB using portfolio margin too.

    Ernie

    ReplyDelete
  37. Hi Ernie,

    Does IB send our orders to stocks Exchange directly? Or they do netting on their desk first?

    Thanks.

    ReplyDelete
  38. Hi Anon,
    If you specify an exchange for your order instead of "Smart", then I believe your order will not be netted before it is sent to that exchange.
    Ernie

    ReplyDelete
  39. Hi Ernie,

    Do you still trade stocks pairs?

    regards

    ReplyDelete
  40. Hi Ernie,

    How about company shares pairs in Exchange, such as IBM, XOM, CVX?

    Thanks.

    ReplyDelete
  41. Hi Anon,
    I have never traded pairs of stocks, only ETFs.
    Ernie

    ReplyDelete
  42. Hi Ernie,

    May I ask why you don't trade pairs of stocks?


    Is it too risky because of bankruptcy?

    Or stocks pairs are not stable.

    Or need more capital to trade stocks portfolio.

    Thank you.

    ReplyDelete
  43. Hi Anon,
    Stock pairs are very much affected by corporate news and events, and I do not have time to monitor and analyse those events.
    Ernie

    ReplyDelete
  44. Hi Ernie,

    In IB, Do you choose Primary Exchange for ETFs trading when we need to choose in "Contract"?

    Thank you.

    ReplyDelete
  45. Hi Anon,
    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.
    Ernie

    ReplyDelete
  46. Hi Ernie,

    I really like your blog. Thanks for your effort.

    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?

    Brian

    ReplyDelete
  47. Hi Brian,
    Do you mean backtest Sharpe ratio or real one over a few years?

    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.

    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.

    Ernie

    ReplyDelete
  48. Ernie,

    Thanks. i was referring to the realized sharpe but it's good to know the difference from backtests.

    Brian

    ReplyDelete
  49. I am thinking of buying this book, thanks for sharing your review about it ;)

    ReplyDelete
  50. Hi Ernie,

    I have enjoyed reading both your book and this blog. I have recently been developing and backtesting mean reversion strategies on FX pairs.

    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?
    i.e. Look for co-integration of the pairs and go long one leg and short the other

    If you are trading a pair of pairs, what is the benefit of doing this over just trading the resulting currency cross?

    Many thanks

    Ed

    ReplyDelete
  51. Hi Ed,
    By FX pair, I mean X.Y.
    Sometimes, X.Y may not be available from your broker, so you have create one yourself from USD.X and USD.Y.
    Ernie

    ReplyDelete
  52. 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.

    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.

    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.

    ReplyDelete
  53. Anon,
    Actually, I don't agree with your argument.
    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.
    Sharpe ratio is a universally applicable return vs risk measure, so I fail to see what you mean by "not applicable" to futures.

    Ernie

    ReplyDelete
  54. Hi Erine,

    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

    1. The contract months for this future traded on the two exchanges are different

    Exchanges Contract Months

    SHFE 1-12 months

    LME 3, 15, 27 months (the most active is the 3m forward contract)


    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?

    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?

    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.

    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

    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?

    Thx.

    ReplyDelete
  55. Hi Anon,
    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.

    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.

    Ernie

    ReplyDelete
  56. Hi Erine

    Thank you of your reply, I will go to get your book tomorrow.

    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.

    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?



    ReplyDelete
  57. Hi Anon,
    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.

    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.

    Ernie

    ReplyDelete
  58. Hi Erine

    I m reading your book now. It is a good book with practical examples. thx.

    Yesterday, you said I should avoid of using continuous future contract.

    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.
    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?


    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

    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.
    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?


    Thanks

    ReplyDelete
  59. Hi Anon,
    If you don't have enough data to run cointegration test, then you can indeed use forward-adjusted continuous contracts for that performance.

    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.

    Ernie

    ReplyDelete
  60. Hi Erine,

    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.
    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? thanks

    ReplyDelete
  61. Hi Erine,

    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.
    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? thanks

    ReplyDelete
  62. 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.

    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.

    Ernie

    ReplyDelete
  63. Hi Ernie,

    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.

    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?

    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?

    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.

    ReplyDelete
  64. Hi Tianyi,
    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.

    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.

    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.

    Ernie

    ReplyDelete