[QBO] Part 1: Some Analysis of 2020 Using Back Testing and Stockopedia Rankings in a Breakout Strategy
Over the last 6 or so years, on and off, I've been performing a lot of back testing attempting to define a systematic, rules based, trading strategy. Recently I decided to revive this work focussing on trading in 2020.
Summary of main discoveries:
- August 2018 onwards, and 2020 in particular have been tough times for my ranking based strategy
- Buy and Hold would have worked better than stops / sell signals in 2020
- £SUK2 could be a very good hedge for falling markets
Background
The aim of my back testing never was, and still isn’t, to develop a mechanical trading strategy - I'm not temperamentally capable of following one even if I had it!
Rather what I'm hoping to achieve is to formalise, and test the effectiveness of, some of the decisions I make during my trading, and ideally to improve my trading outcomes as a result.
My original intention was to write up the process as I went, but it quickly became apparent it was going to be:
- VERY, very long, and
- VERY dull reading - lots and lots of tabular comparisons of data, and
- Take a VERY long time - in the last year alone I've run almost 400 experiments, each taking between a few minutes and a few days to execute (depending on what was being tested). Add in the time to analyse the results and develop the tests and it amounts to a lot of time, both compute and personal, so...
- I'll probably never be finished! And finally...
- The development of the strategy was undertaken using data in periods where I had no Stockopedia ranking information so is based on my own rankings, which I suspect are pretty irrelevant to Stockopedia subscribers.
Instead I decided to share where I'm up to, without going into the details of how I got there, and illustrate a couple of interesting (to me at least) learnings from starting to examine 2020 using Stockopedia ranking data.
I'm not going to discuss back testing as a process at all here as there are plenty of articles about it around already, for example on Investopedia .
It is certainly not without it's drawbacks, however I find it very useful.
The back testing approach I’ve developed aims to simulate my own trading patterns and circumstances (minus my own input, obviously!) as closely as possible, for example:
- Working within a limited budget
- Performing research out of trading hours, and buying the next trading day (after a quick check that I still want to buy)
- Taking trading transaction fees and 'slippage' into account (commission, stamp duty, spread)
To try to make the simulation more 'realistic' I assume that when I buy it is at a price towards top of the trading range on the day, and when I sell the price is towards the bottom of the range. On all transactions I calculate a simulated Bid / Offer price using the nearest spread data that I have to the day of the trade, and also calculate trading fees (commission and stamp duty).
So, without further ado, here is my breakout based strategy.
The Quality Breaking Out (QBO) Strategy
Trading Account Size: £20,000
Tradeable world: High quality, profitable, low debt, shares with reasonable liquidity
- Quality Rank >= 90
- MarCap >= £100M
- Profitable (Net Profit / MarCap > 0.025)
- Low debt (Net Debt < 3 * Net Profit)
- Liquidity:
Entry criteria: Breakout to a 1 month high on increased volume
- Low price greater than high price in previous month
- 5 day EMA of volume >30% above 50 day EMA
Risk management:
- No more than 2.5% of total equity at risk per trade
- Maximum Trade size 30% of total account value
- Stop loss at 5 times a 20 day EMA of the ATR
- Once in profit, use a trailing stop loss at 8 times a 20 day EMA of ATR (re-calculated daily)
- Maximum allowable size of each trade calculated based on the amount at risk (i.e. the stop value)
- Initial position size 15% of maximum allowed
- Scale in to 50% of maximum position when price has risen by 2 times 20d EMA of the ATR
- Scale in to the full position when price has risen by 5 times 20d EMA of the ATR
- Re-calculate stop loss on each additional purchase
Exit Criteria: Sell if position held for 49 days without scaling in (early exit)
Exit criteria: Breakdown to a 1 month low, or if the 21 day trend is down, on increased volume
- High price lower than low price in previous month, OR
- Lower lows AND lower highs on 11 or more of the previous 21 trading days
- 5d EMA of volume >30% above 50d EMA
Budget management:
- None. This part of the strategy is intended for rules to deal with situations such as being fully invested when I want to scale in, or buy something new. I haven't started to formalise that yet.
The QBO strategy worked pretty well up to August 2018, but from then onwards was a tough time for this strategy. The chart below shows the performance of the QBO strategy against the FTSE All Share from January 2017 through to December 2020.
I joined Stockopedia just before Christmas 2017 (an early Christmas present to myself!), and started collecting Stockopedia ranking data in April 2018. In the chart above the blue dashed line is the performance using just my own rankings and the red line is using Stockopedia rankings from May 2018 onwards. The table below shows the difference in performance in numbers:
The Adjusted P/L Ratio is a measure I got from Mark Minervini's book "Think and Trade Like a Champion", it's calculated as:
(win rate * average gain) – ((1 – win rate) * average loss)
So a value of 1.00 means breaking even, less than 1.00 means making a loss and greater than 1.00 means making a profit.
I find the combination of Adjusted P/L Ratio and CAGR to be a very effective way of measuring trading performance and also track them in my own portfolio.
It's very impressive, though not particularly surprising to me, how much better Stockopedia rankings performed than my own once I start using them in May 2018. One day I may feel inclined to look into why, but for now I'm very happy to just continue using the much superior Stockopedia rankings!
Further Analysis Item 1: The make up of the Tradeable World clearly has a big impact on the strategy performance.
In the two performance graphs above the strategies being executed are identical with the single exception of the source of the Quality Rank being used in the determination of the Tradeable World, so I want to look again at the Tradeable World definition.
Which bring me very neatly to my recent decision focus on the performance of the strategy in 2019/20, using purely Stockopedia rankings.
Back-Testing 2020 Using Stockopedia Rankings
When doing my back-testing, I like to do the development of the strategy on a different time period from the one I intent to test it on. This helps to prevent 'over fitting' changes to a specific time period and set of prevailing market conditions.
As I only have Stockopedia ranking data from May 2018, I have a limited set of data to work with. I want to test over 2020, and allow a 6 month 'run-in' period, so that really only leaves me June 2018 to May 2019 as a development period (with 1 months 'wiggle room' each side).
Here's a chart of the performance of each of the Stockopedia ranks since I started collecting data. The data is based on the ranking at the start of the month against the performance of the qualifying instruments over the following month, i.e. the gain / loss is after the ranking. So this is equivalent to what would have happened if I had bought equal sized positions in all of the 90+ ranked instrument at the start of each month, and then rebalanced each subsequent month so the portfolio always contained equal weight positions in all of the 90+ ranked instruments at the start of each month (ignoring trading costs and spreads). The overlayed area chart shows the proportion of riser / fallers overall in each month.
It shouldn't be that surprising that rankings, being ranked measures of performance, are fairly well correlated with the movements of all the instruments on the market.
The first thing I wanted to do was to baseline the performance of the QBO strategy over each period.
Based on the picture above I would have expected the strategy to perform better during the test period than the development period. This is based on the ranking performance, even though the test period includes the Covid-19 downturn. In addition looking at the proportion of risers and fallers then, excluding Feb-20 and Mar-20, there generally looks to be more green than red in the test period compared to the development period.
However the actual performance of the Quality Breaking Out strategy over the two periods when I baselined them was very different to what I would have expected.
Here's the performance over the Development Period (June 2018 to May 2019):
And here's the Test Period (July 2019 to December 2020):
The following table shows the comparison of the development and test periods in numbers:
The performance of the strategy between June 2018 and May 2019 isn't stellar, but neither is it awful. It significantly outperformed the FTSE All Share and returned a profit, albeit not a huge one.
The performance of the strategy in July 2019 to December 2020 is awful though. Why? Obviously the Covid-19 downturn is in the mix, but I don't think it's the whole story. So I started to look a little deeper.
The following chart shows the profile of the portfolio over time, cash against investments:
By early December 2019 the strategy is fully invested, however by mid-March 2020 it's fully back in cash. There are no more purchases, i.e. buy signals, until May 2020 and even at the end of the test period the strategy is still not fully re-invested.
The sell out in March can be seen even more starkly by looking at the value of each of the individual trades over time:
So next I looked at the sell reasons:
Quite a lot (34%) of the sells were down to my 'quick exit' rule where I sell if I've held for 49 days without scaling in. These sells can easily be seen on the chart above as short, flat, lines. The quick exit rule came about to try to prevent my limited capital being tied up in trades that were not performing as I would want them to in a breakout strategy, so that I could prioritise my limited resources on trades that were heading in the right direction.
The remaining 66% of sells were all triggered by either stops being hit (40% stops, 3% trailing profit stops) or a sell signal (23%).
Buy and Hold through Covid?
My own approach to handling the Covid-19 downturn in February / March last year was to sell off any holdings in my portfolio that I wasn't fully committed to, and just sit tight with the very few 'high conviction' holdings that remained. I've often wondered since if that was the right approach.
Last year I also did some analysis on my own trades since I started trading in 2010 and was disappointed to discover that if I'd just held on to my first few purchases and done nothing else for the next 10 years I'd have been better off!
For example my very first trade was ARM, which I sold for a 10% loss after 2 weeks when the reality of seeing my own money starting to vanish before my eyes panicked me. Of course ARM started to rise again straight after I sold it and was up 345% by the time it was bought by Softbank in 2016. Homeserve (LON:HSV) which I did manage to make a profit on but sold because it seemed to be trending sideways, and I needed to free up some cash for another purchase, was up a further 388% 8 years after I sold it. In fact 6 out of my first 10 selections were up more than 200% up 9-10 years later, and only 3 showed a loss.
Add to this that the NAPS portfolio has consistently done well, including in 2020, and that my own Stock Picking Challenge entries in 2020 did better than my actual portfolio (both of which are essentially 'select and forget' exercises) and I started to wonder if the stops and sell signals were getting in the way.
So I decided to try a "Buy and Hold" variation of the strategy to see how it performed. I left the 'early exit' rule in place, but removed the stops and sell signals. Here's how it compared with the 'baseline' QBO performance over the same test period:
Here's that comparison in numbers:
Further Analysis Item 2: Stop losses and sell signals clearly have a huge influence on trading performance.
This is probably not a surprise! I've always felt that buying shares was the easy part, but it's selling them at a profit that's the hard bit! This research just confirms this and I suspect, sadly, that there is no easy answer!
Some ideas I like to explore are:
- Making stops more dynamic to respond to market conditions, for example loosening them if the market is falling generally and tightening them if it's rising.
- Similarly, making the sell signals relative to the overall market conditions somehow.
- Experiment with a 'minimum holding period' (like Roland Head has in his Stock in Focus portfolio)
- Instead of a trailing profit stop, experiment with scaling out as the price drops (and then scaling back in if things start to recover).
Moving on to look at the make up of the portfolio, and the value of the individual trades, over time we can see a big difference to the baseline profile. Again, the strategy is fully invested in early December 2019, but this time remains pretty much fully invested until the end of the test period.
Similarly looking at the individual trade values over time the big gap where the strategy returns to cash is missing, but all of the individual trades are clearly impacted by the downturn in February / March:
Of all the trades made by the QBO strategy, Games Workshop (LON:GAW) is the only one that I actually held in my portfolio. It was also one of the 'high conviction' positions that I decided to hold on to during the Covid downturn after selling off others. I therefor 'randomly' selected Games Workshop (LON:GAW) for more detailed inspection.
The following image illustrates the main events in the execution of the QBO strategy with respect to Games Workshop (LON:GAW) overlaid onto a price chart. The events above the chart are from the baseline QBO strategy and the events for the "Buy and Hold" variant are shown in the blue box at the bottom for comparison. The coloured boxes are heat map tiles to show the performance Games Workshop (LON:GAW) at some key points. See my heat map thread for an explanation of the heat map contents.
The baseline strategy buys Games Workshop (LON:GAW) twice with a net loss over the two position of -£172.26, however with "Buy and Hold" the single buy goes on to return a profit of £775.80. That's quite a difference! Even more impressive considering the price dropped by almost 50% in March, to well below both the original purchase price and the scale-in price.
The other thing I notice in this analysis is that there are quite a few failed attempts to scale-in caused by having no available cash. Had the "Buy and Hold" strategy been able to successfully take a full position on 26th May 2020 the profit would have been even larger. I also notice that some of the position sizes are a little smaller than I would have expected. This is probably an error in my scaling logic, or a failure on my part to understand my own logic! Either way I'd better have a look at it more closely.
Further Analysis Item 3: Experiment with rules for scaling-in when fully invested
I have not tackled the "Budget management" aspects of the strategy yet, but this suggests that its about time I did.
Obvious options to experiment with are reserving some cash for scaling-in to winning positions, and looking for 'weaker' positions to scale-out of (or even sell completely) to free up cash to scale into a winning position.
Using SUK2 when the market as a whole is falling
The other idea I had was to use £SUK2 as a hedge against the falling market. I've known about £SUK2 for quite a while but have never used it. Last year there was a post by Michael Taylor on Stockopedia about using £SUK2 Trading the Trend - Hedging with SUK2 which reminded me about it and gave me the inspiration to try it.
I experimented with a number of buy and sell signals, and the one that worked best was a short term momentum rank, heavily inspired by the Stockopedia Momentum Rank, but with a much shorter time window. The idea being to buy SUK2 when it was the ‘hottest’ instrument in the Tradeable World, and sell when it wasn’t any more.
As an experiment I tried using the full £20,000 QBO budget just to trade £SUK2 in the July 2019 to December 2020 test period (not a great idea in real life I'd suggest!). The result was a profit of £9,570.03 (+47.85%) , equating to a CAGR of 29.63%. Much better than the actual QBO strategy!
Here's how it looks on the £SUK2 chart:
To put this into context, here are heat maps to show the state of the market as a whole (FTSE All Share and by ICB Industry) as it was on 26th February 2020 when £SUK2 gave it’s buy signal and 24th March when it gave it's sell signal:
Looking at these heat maps in conjunction with the £SUK2 signals the thing I notice is that on the same day as £SUK2 became a sell more than 75% of the instruments in the FTSE All Share, and 50% of the Instruments in every ICB Industry, were up on the same day. Over the previous month though virtually all instruments, and the FTSE All Share, were still down.
Looking at the instruments in the QBO Tradeable World as they were on 24th March 2020 shows a similar picture:
Virtually all of the QBO Tradeable World instruments were up on 24th March, and several of them were very significantly up. For example Sirius Real Estate (LON:SRE) up 23.46% on increased volume, Avon Rubber (LON:AVON) up 15.32% on increased volume and the 7d trend is up, and Aj Bell (LON:AJB) up 20.48% on news. Although, like the market as a whole, none of them were up over the previous month.
I wonder if £SUK2 might also also have some value as a ‘barometer’ of market sentiment?
Further Analysis Item 4: Explore SUK2 as a hedge and as a ‘barometer’ of market sentiment
I'd like to do more testing over a longer time period to see whether using £SUK2 as a hedge is effective more generally or whether this result is just a phenomena of the February / March Covid-19 downturn.
If it does prove to be generally applicable I'll experiment with including £SUK2 in the QBO Tradeable World definition and using it as a hedge.
I also want to explore it further as a potential 'barometer’ of overall market sentiment.
Wrapping Up and Next Steps
Obviously there is a lot of research still to do, and I have not even started the refinement process I was intending to yet. However I wanted to share this early as I was very surprised by the influence of "Buy and Hold" through the Covid-19 downturn, having always believed stop losses were A Very Good Thing, and by the potential of using £SUK2 as a hedge when the market is falling generally.
As a final thought I would love to do more historical testing using Stockopedia rankings prior to May 2018. If Ed or anyone else from the Stockopedia team reads this would there be any possibility of making historical Stockopedia rankings availability to subscribers? Either as a download, even as a separate paid for addition, or to allow screens to be run for a specific date in the past in addition to the present day? I know that a Screens Backtester has been 'In Consideration' on the roadmap since July 2019.
In the process of writing this post I've found four actionable areas to explore further, so it's been a useful exercise for me. If you are still reading I hope you have also found it interesting.
In my next post Part 2: Is Momentum More Profitable Than Quality? I'll start to look at the Tradeable World definition in more detail.
Edit: Changed title, and fixed a couple of typos
Edit: Added link to follow up post
Edit: Changed title to add [QBO] tag to tie posts together
Disclaimer
This is not financial advice. Our content is intended to be used and must be used for information and education purposes only. Please read our disclaimer and terms and conditions to understand our obligations.
12 comments
Thanks for taking the time to write this.
I found it very interesting and it certainly reinforces my belief that this website wouldn't be the same without some excellent commentators willing to selflessly share their knowledge.
If you do get time in the future, I would be particularly interested in your £SUK2 findings.
I did happen to use it for the first and only time in Feb and March 2020 to great affect, though I must admit that I was petrified to do so given that the market can fall significantly over a specific length of time and one could still lose money on it.
Thanks again.
Cheers
A
Thank You abtan,
I completely share your sentiment about Stockopedia commentator - they really add massively to the excllent value Stockopedia provides.
Huge well done on using SUK2 successfully - I was / am still too scared ;-)
When I do get round to looking at SUK2 more closely I will be sure to share.
Cheers,
greensiax
Wow, great data...
My strategy also focuses on Quality stocks making breakouts (on a weekly chart) so I found this quite enlightening, thanks
Thank you gpacker :)
PS: I love your book summary videos!
Thanks for this interesting article. Your suggestion of a Screen where the filters are applied on a specified date (rather than just today) is excellent. Screen performance could then be calculated from that date to the present. I don't think there is any pressing need for a complex suite of backtesting tools to be included in Stockopedia. But date-specific Screens would be a very welcome and relatively simple addition for those of us who like to tinker with investment strategies.
Hi ijontichy,
Glad you found it interesting :)
Warm regards,
greensiax
Monster but quality read out of interest how does one ass the minimum EMS size into a screen and is the value figure based on shares or pounds ?
Thanks Andy
Thanks Andy,
It was a monster write as well ;-)
I'm pretty sure EMS isn't screenable. I get them from LondonStockExchange where they are in number of shares. I then multiply that by current proce to get a value (which is more useful!).
Cheers,
greensiax
I tried to ignoring the overall stock rank to focus on combining two of the three components, for instance low quality, high value, high momentum has been working well for me since july. Also prior to that I found a stockrank of 80 tended to return better results than 90, I dont know why, perhaps 80s have more room to improve
Hi Ambrosia,
Funnily enough I have also turned my attention to Momentum recently. Still working on it but certainly in 2020, Momentum seems to have worked much better than Quality. However in 2019 the opposite was true!
Interesting point about rankings, here's a plot of the distribution of ranked future (1mo) price changes separated by MomentumRank ventiles (using data from Jun-2018 to May-2019):
So there certainly isn't a linear relationship! It's most apparent in the bottom ventile (0-19) of the Momentum Rank where it looks like a coin toss - one month later they are at one end or the other of the price change scale with very few in between!
Warm regards,
greensiax
PS: As for Quality 80 working better than 90, are you using a MarCap filter? Q80 includes more MicroCaps than Q90 which tend to move more!