Showing posts with label Trend Following. Show all posts
Showing posts with label Trend Following. Show all posts

Tuesday, February 19, 2019

Systematic Trading: Week 1

This weekend the Russel 3000 index has been above its 200 MA for 3 days.

Who knows if it will continue?  It could be a false breakout.  Or it could be like 1998: a correction before a final 18 month melt-up.  I will trade the system regardless.

Value (The Acquirer's Multiple)

Yesterday, bought the top 3 stocks from The Acquirer's Multiple All Investable Stock Screener.

I will continue to buy and sell as the number of days the index is above the moving average. (N) changes.

After each stock has been held for 1 quarter, I'll rebalance.  i.e.: replace it with another stock if it is no longer within the top N rated stocks.

Momentum (Clenow)

Bought 3 stocks yesterday:
  • LIVX (Livexlive media Inc), bought 673 shares @ $5.95
  • LCI  (Lannet Company Inc), bought 389 shares @ $10.28
  • EHTH (EHealth Inc), bought 64 shares @ $62.66

Saturday, November 17, 2018

Stock Market Momentum - Part 2

Rules & Implementation

My system is based on Andreas Clenow's "Stocks on the Move", a readable and entertaining book that adapts trend following strategies to stocks.  Its a long-only rotational trading system, where stocks are ranked by momentum and the highest ranking ones are bought.  It only buys or holds stocks that are above their 100 day MA.  And only takes new positions when the market index is above its 200 day MA.

I made some small changes:

  • I don't size and re-balance positions by volatility.  It makes no sense when a position is $2-4K.  Its hard to code.  And I don't see the benefits since a stock's volatility can change in a heartbeat, and the whole market usually changes with it.  I just buy 25 stocks 1.
  • I use the lower 100-day Bollinger band (1 std-dev) instead of the 100 MA to filter if a stock is in an uptrend.  This takes volatility into account, unlike a moving average.  I want to hold winners as long as possible.
  • His algorithm buys all positions when the market index is above its 200 MA.  I gradually 'ease in' to the market.

The 'easing in' part works like this. We usually hold 25 stocks.  The first day the index closes below its 200 MA, we will set the 'target number of stocks to hold' (N) to be 24.  We don't explicitly sell stocks to meet that target - the system just goes into 'bear mode' and stops buying (Stocks may be sold based on the other criteria).  For each day the index is below the 200 MA, N decreases by 1.  So N will be zero if the index is below the MA for 25 or more consecutive days.  The first day the index goes above the MA, N is incremented by 1.  And if we are holding less than N stocks, we buy up to N.  Therefore, the index needs to be above the ma for some time in order for us to be holding the full allocation of 25 stocks.

This subtracts from my returns a little, but I need it to be comfortable trading the system. Otherwise I won't be able to follow it.

I am running on Amibroker, and selecting stocks from the Russel 3000 with Norgate Data taking care of tracking index constituents.  I exclude stocks trading under $5, or with a median 90-day turnover less than $250K.   For slippage, buying and selling is at the day's average price.  Brokerage is $1 per trade from Interactive Brokers.  Starting amount USD 73K.  I run the system over the weekend and trade on Mondays.

Backtest Results

I get a 14.2% CAGR from 1999 to Aug 2018, and 17.4% from 1991 to Mar 2003.  Decent numbers.

Looking at monthly returns:

Returns are unpredictable.   We often get a few years of boring single digit positive or negative returns, followed by a year of stunningly good 30-60% returns.

The volatility is sickening.  There is a 61% drawdown in the 2000 tech wreck, and a 33% one in 2006.  20-30% drawdowns occur every few years.

Trading It

Can I stick with this?  Trend following strategies are notoriously frustrating.  You have to just follow the system mechanically, week in, week out, and not think about how much you're making.  Or losing.  From Nick Radge (What makes a Successful Trader? 37:00):

  • We have created a system with positive expectancy.  Like a casino.
  • Remove yourself from the trading environment. Place your trades, turn off the computer.  In the long term, positive expectancy will look after you.  All you have to do is be there for it.
  • Think 'Next 1000 trades'.

When will I start?  The Russel 3000 index is currently below its 200 MA, so I'll let the market decide.

1 The tests I saw measuring different momentum with holding different numbers of stocks started with 50 as the smallest number.  I am using 25 due to low capital.  May increase it to 50 later if account size grows.

Friday, November 9, 2018

Stock Market Momentum - Part 1

I'm looking at a systematic, momentum-based stock market strategy.  Why?
  • The existence of momentum in markets is proven by numerous academic studies.
  • The system I have gives a nice CAGR 14-20%, over 10-15 year periods.
  • I will be buying stocks that have gone up.  Completely different from the value stocks I normally buy.
  • I want to be able to trade the markets systematically, without having an opinion. 

What is Momentum?

From academic studies, stocks that have gone up in the past 6-12 months are statistically likely to go up in the next 1-2 years 1.  Most papers use similar methods to measure momentum, for example:

  • Value and Momentum Everywhere: Found evidence of momentum worldwide in stock markets, stock indexes, currencies, bonds, and commodities.  For stocks specifically: they selected large, liquid stocks from 4 markets over nearly 40 years.  Stocks' momentum was ranked by their past 12 month return, skipping the latest month.  They were sorted into 3 equal sized groups: Lowest momentum, Medium momentum and Highest momentum.  And re-balanced monthly.  The Highest momentum group outperformed the Lowest by 5.4% (US market), 6% (UK), 8.1% (Europe) and 1.7% (Japan).   
  • 212 Years of Price Momentum: Looked at US market from 1801 to 2012.  Same methodology as above.  The Highest Momentum group outperformed the Lowest one by around 4% a year.

Why does Momentum occur?

No one knows.  There are many papers arguing whether its due to 'risk factors' 2, or behavior.  I think its behavior.  Humans are herd animals.  Once we see other people doing something, we want to do it too:
  • Fads and Fashion.  Whether its primary school children playing, or women comparing handbags, how often have we seen some trend catch on, then grow in popularity, until everyone 'has one'?  At which point they become not cool anymore, and the cycle starts again.  Look at the stock charts of Crocs or Michael Kors for example. 
  • Capex Cycle: For mining and heavy industry, it takes years to bring new capacity online, so they respond slowly to increased demand, while the price of their commodity/product shoots up over several years.  At the end of the cycle, prices are sky high and everybody is prospecting/investing.  Leading to oversupply and a crash.  Look at Rio Tinto's stock chart for example: up 7 times from 1999 to 2008, then losing all of that in 2009.
  • Success begets success: As business become bigger and stronger, they entrench their position, leading them to become bigger and stronger.  Especially prevalent in technology, with winner-take-all network effects, like with Microsoft or Facebook.  Until someone new comes along, disrupting the market, and the cycle starts again.

Why is it still Profitable?

How can such a simple, dumb, and well known strategy - buying stocks that have gone up - still make money?  Shouldn't everyone be doing it, removing its effects from the market?

Momentum strategies are hard to follow.  They have long and hard drawdowns: a 30% loss every few years is normal.  50-60% losses occasionally occur (the 1929 great depression and the 2000 tech wreck).  And there are long periods...a year or more... of sitting around doing nothing.

There's an interesting presentation by Wes Grey on why Momentum still works.  He considers that, for most fund managers, there is too much career risk in following momentum strategies.  I especially like his 'God Portfolio' (33:00 to 37:00) - not even God can prevent drawdowns!

In the next post I'll look at the system I'm using, and what its like to trade it.

1 Not true for shorter or longer time frames: if we're predicting under one year into the future, or from two to five years, then stock prices tend to mean-revert.
2 i.e.: stocks that posses momentum have higher returns to compensate for being riskier.

Saturday, June 18, 2016

Trend Following: Part 2

TLDR: I could not find a worthwhile systematic trend following fund to buy into, as I don't live in the US.

I don't have enough capital to do-it-myself and diversify among many markets, so I looked to buy into a fund.

    Past Performance

    What type of returns can you get?

    Use the SG Trend Index (previously the NewEdge Trend Index) to benchmark trend-following funds' performance.  It's a simple index, rebalanced and reconstituted at the start of each year, currently consisting of the ten largest managers (by AUM) that meet their criteria.  Before 2012, it had a wider range of constituents, with similar selection criteria.  

    I selected funds from Jezebel Liberty's Trend Following Wizards page (the ones I could get data for), and charted their performance against the SG Trend Index and S&P500.

    (Data source: IASG)

    The percentage increase and CAGR for those funds active the entire period:

    A few funds have astounding returns: 10 times your money!  Most give between 2 and 6 times.  The SG Trend index gives 2.7 times.  But before running off to buy, these funds were winners selected with hindsight, and are not now available to retail investors.  You can't buy the SG Trends Index either.

    So a lot depends on which fund you choose.  I couldn't find why the different funds performed so differently.  Perhaps different volatility targets.

    The general pattern is a short sharp peak, followed by several years of drawdowns.  You spend most of your time under the high-water mark.  So a lot also depends on when you enter.

    The correlation coefficient of each fund's monthly returns (log difference) to the SG Trends Index was 0.6 to 0.8.  So they are all doing the same thing.

    You might say that starting in 2000 just before the great Nasdaq crash puts trend following in a particularly good light.  Lets pick another date at the start of 2003,  which is one of the S&P's bottoms:

    The percentage increase and CAGR for those funds active the entire period:

    Even here, a worst case scenario for trend following, the SG Trends Index still gives 5% returns.


    There are 2 main risks.

    First, drawdowns are long and large, even for funds with high returns.   Look at the table here - its from 2012, after which there was another year of drawdowns!  Can you live with this?  Easier said than done.

    Second, sometimes a fund's rules just stop working, as the market changes.  For example, the original rules used by the famous turtle traders gave a CAGR of 216% from 1970 to 1986, but were flat from 1986 to 2009.  From 2003 to 2006, the highly successful Dunn Capital (in the graphs above) had a drawdown of 50%, while other funds rose.


    Fees are very high, most funds charge 2 & 20.  Or more.  High minimum investments mean they are not available for retail investors.

    Retail investors can find a lot of feeder funds which will allow you to invest in the Big Boy's funds. But they typically use swaps to gain exposure to the underlying fund's after-fee performance.  This means that the underlying funds' performance fees are hidden - often not disclosed.  On top of this the feeder fund has a management fee (typically 1-2%) plus a swap feee (typically 0.5%).  They're charging money for nothing!  And the swaps may be worthless if the banking system comes under extreme stress, like in 2008.

    Morningstar covers a couple of systematic trend following funds which charge low fees - around 2+% total.  They're available through Schwab with no front loading fee.  But can only be bought by US residents.

    Since most trend following funds do the same thing - there are only so many ways to 'follow a trend' - fees are an important criteria.  I think this space will become more commoditized in the future, though fees will never be as low as index funds.

    Other Factors

    Many large funds concentrate on bonds, which are more risky now in a zero interest rate environment.  See the last 7 slides by Andreas Clenow here.  Safer to buy into a smaller fund which can trade a larger range of commodity markets.


    Its worthwhile buying into a diversified systematic trend following fund, not just for 'diversification' or 'non-correlation', but because the long term returns themselves are worthwhile.  Most years are down years - be prepared to suffer.  As always, there's a bit of luck in choosing a fund - hope that it dosen't suddenly stop performing after you buy it.

    I don't live in the US, so couldn't find anything to buy.  Shit!

    Checklist for buying into a Trend following CTA fund:

    • Fees. 2+ % all-in seems reasonable.  Avoid swaps.
    • Fund size.  Probably between 1bn and 20bn.  Large enough so it wont close.  Small enough that it can trade less liquid commodity markets, and is not forced to trade bonds in a ZIRP environment. 
    • Correlate its past monthly performance against the SG Trends Index to check its really doing trend following.

    Thursday, April 21, 2016

    Trend Following: Part One

    What is it?

    "The core idea of Trend Following is extremely simple...Wait for momentum to build in one direction and get on the bandwagon.  Expect to lose about two thirds of the time and so make sure your winners can pay for your losers and leave enough over to cover the rent." (Clenow)

    In other words, buy after prices start moving up, sell after they start moving down:

    The rules used are simple, for example:
    • moving average crossovers above, 
    • channel breakouts
    • "buy when the price has spent 5 days above the moving average", etc.  
    You may also have an overriding rule to decide "market direction" first, and only take the trades in that direction.  For example:
    • based on a 200 day MA.  
    • For the stock market - based on macro economic data.  
    • For a currency - based on its strength compared to all other key currencies.

    Key Components of Trend Following Systems

    Back Testing

    Rules are back tested against old data to be chosen for the system.  You must know computer programming.  The process is harder than it sounds - there are pitfalls like over-fitting. The book Systematic Trading by Robert Carver covers these.

    After testing, you start the system in real life and hope it keeps working.


    60-70% of trades fail.  These should be made up for by rare winners.  You must systematically take every trade, you can't start second guessing which ones will win.  

    Individual markets often have long periods, sometimes years long, where they are trendless, like soy from 2009 to 2011.  Even after bleeding for years, you need to take every trade.  After eight, nine, ten, eleven, twelve trades in a row lose, you still have to take the next one.  Hard to do, unless you enjoy pain.

    Position Sizing by Volatility

    Unlike investors, Trend Followers measure risk by price volatility.  Specifically, volatility from the recent past is assumed to be close to volatility in the near future.  Potential loss is measured based on this volatility and the stop loss level given by your rule.  This should be limited to between 1% and 1.7% of your capital per trade.

    Potential return is also measured by volatility (again with the potential profit given by your rule). More volatile instruments require a smaller position, less volatile ones require a larger one (or maybe leverage).

    You shouldn't trade instruments where past volatility is artificially constrained e.g.:
    • Pegged currencies, e.g.: trading CHF when the Swiss government removed the peg --> you get blown up.  Maybe your brokerage too.
    • Going long on bonds in an low interest rate environment: Upside is limited as interest rates can't fall much further.  Downside will explode once rates move up.


    Trend followers typically trade 30-40 futures markets at the same time, spanning commodities, currencies and bonds.  The large number of markets is required because most markets are usually trendless. Adding new markets decreases your risk and increases your returns at no cost.

    The problem with exchange traded futures is that one contract size is large.  Clenow suggests you need a minimum of USD 1m to start trading safely.

    Yeah...if I had a million, would I spend my time implementing a Trend Following System?

    May not work on stocks

    Trend following may not work on stocks, as they are more volatile than futures.  Stock markets are highly correlated, and become more so when the SHTF, like in 2008.  So a trend following system in different stock markets is not diversified.  Also, vicious short squeezes will kill a simple automated system.  A systematic trend following system dealing with stocks will probably be long-only.

    What Next?

    The main benefit of a futures-based Trend Following system is to provide diversification, in particular, they tend to do well when stock markets do badly.

    If I was to stick to equities-only, to avoid the high capital requirements for exchange-traded futures, a trend following system may be useful as a counterpoint to value investing. When the market is high - like now - and buying and holding is too risky, a growth/momentum strategy with a cut-loss could gain exposure to the market with limited risk.  So it gives me a way to trade when I'm no good at discretionary trading.

    Next, I'll look into whether I could build my own system, or buy into a fund.


    Books and Websites

    1. Trend Following by Michael Covel: The book that popularised it.  Well written and entertaining, but lacking information.  Read if you're bored.
    2. Following the Trend by Andreas Clenow.  Describes what its like to implement and follow a system through his experience as a fund manager.  Well written, clear and concise, it is non-technical and an easy read.  An excellent first book for building a system - also see his writings online (1) (2).  Anyone buying into a TF fund should also read this, to discover what TF funds do, how they work, and what you're in for.
    3. Systematic Trading by Robert Carver.  More technical that the previous book, it goes into more detail on why Trend Following works, and common pitfalls in building a system.   I usually skimmed each chapter several times, first to determine what he is trying to do, then how he is doing it.  Its still well written, clear and concise, with the occasional dash of humour.  I think Part One of the book ("Theory") will be useful to any investor/trader.
    4. Au.Tra.Sys blog: Still digging through all the stuff here; useful for anyone building a system or buying into a fund.