Clenow’s Trend Following System
Its a new decade! Time to see what’s up with Trend Following.
I am a huge fan of Andreas Clenow’s books, and how he demonstrated that a typical trader could replicate the performance of most large Trend Following CTAs and not pay the 2% / 20% management/incentive combo fees. So. I felt the system that he described in his book would be a great representation of The State of Trend Following. At the same time I am going to demonstrate TradingSimula18 (the software included in my latest book).
System Description
Take a look at my last post. I provide the EasyLanguage and a pretty good description of Clenow’s strategy.
TradingSimula18 Code [Python]
I am going to go over this very briefly. I know that many of the readers of my blog have attempted to use Python and the various packages out there and have given up on it. Quantopia and QuantConnect are great websites, but I feel they approach back-testing with a programmer in mind. This was the main reason I created TS-18 – don’t get me wrong its not a walk in the park either, but it doesn’t rely on external libraries to get the job done. All the reports I show here are generated from the data created solely by TS-18. Plus it is very modular – Step 1 leads to Step2 and on and on. Referring to the code I calculate the ATR (average true range) by calling the simple average function sAverage. I pass it myTrueRanges, 30, curBar and 1. I am looking for the average true range over the last 30 days. I then move onto my position sizing – posSize = $2,000 / ATR in $s. PosSize must fit between 1 and 20 contracts. The ATR calculation can get rather small for some markets and the posSize can get rather large. Avg1 and Avg2 are exponential moving averages of length 50 and 100. DonchHi and donchLo are the highest high and lowest low of the past 50 days. If mp == 1 (long position) then a trailing stop (marketVal1) is set to whichever is higher – the current marketVal1 or the yesterday’s High – 3 X ATR; the trailing stop tracks new intra-trade highs. The trailing stop for the short side, marketVal2 is calculated in a similar manner, but low prices are used as well as a positive offset of 3 X ATR.
Now the next section of code is quite a bit different than say EasyLanguage, but parallels some of the online Python paradigms. Here you must test the current bar’s extremes against the donchHi if you are flat and marketVal1 (the trailing stop variable) if you are long. If flat you also test the low of the bar against donchLo. The relationship between avg1 and avg2 are also examined. If the testing criteria is true, then its up to you to assign the correct price, posSize and tradeName. So you have four independent if-then constructs:
- Long Entry – if flat test to see if a long position should be initiated
- Long Exit – if Long then test to see if a liquidation should be initiated
- Short Entry – if flat test to see if a short position should be initiated
- Short Exit – if Short then test to see if a liquidation should be initiated
That’s it – all of the other things are handled by TS-18. Now that I have completely bored you out of your mind, let’s move onto some results.
Results from 2000 – risking $2,000 per trade:
Sector Performance from 2000
From this chart it doesn’t make much sense to trade MEATS, SOFTS or GRAINS with a Trend Following approach or does it?
In the next post, I will go over the results with more in depth and possibly propose some ideas that might or might not help. Stay Tuned!