Brett Bot - Consistent Profits from 52 Week Lows

Small update to 52 week low buying of quality stocks strategy:
  • The real portfolio had a pretty bad week. But by bad I mean it's still in profit, just not as much in profit as before :oops:.
  • It was however a great week for adding to the portfolio, with a few good purchases purchased. There are now 200 live trades using real money, although a good percentage have completed for a profit. I've also begun to close down the earliest trades in order to try and break even. By April I should know if the 10% win, 40% breakeven, 10% loss odds will hold for the real money trades.
  • I've started a closely related strategy: buying at 50 day lows. Why 50 days? Finviz have a really excellent free screener for stocks at 50 day lows. Backtesting suggests this strategy is more profitable than the 52 week lows. Why? Because there are a lot more stocks to buy. For the real money tests of this strategy I've also been buying top quality A list stocks. Recently I picked up CI, O, VOYA and PFG. This stuff rarely makes 52 week lows. CI is an amazing stock - since 2000 it has never not returned 5% after hitting a 50 day low.
  • I've made a new backtester bot... this one buys stocks on any old date regardless of price. In other words what a dollar cost averager would do. The results have been... not impressive. I've only piloted PEP and MCD. MCD reached a maximum CAGR or 10.1% and PEP 6.0% [excluding dividends]. As traders we should not be satisfied with such poor returns. By contrast buying PEP at the 52 week lows and aiming for a 10% profit produces an average CAGR of 49.2%. 50 day lows return 30.2%. 50 day low returns are lower however as I mentioned earlier there are so many more to buy that it works out a better strategy on paper.
What's also interesting is that still almost nobody in the investing community (except maybe some here) believes me that such simple stuff outperforms the market.
 
Ugly week for the real money portfolio but it's down ~2.5% so not too bad really.

I made a huge breakthrough today and now really understand how to write PineScript strategies (the TradingView scripting language).

I'll post some backtesting scripts just as soon as I figure out what strategy works best. The first strategy I've tested is buying a 52 week low then hodling for a 25% profit. This works very nicely with large cap "must own" stocks (e.g. MCD, PEP). It mostly has a 75-100% success rate. If a trade goes wrong then you can normally hodl for 1-2 years collecting dividends and waiting for the day you can break even. This isn't real trading of course but it does appear to beat "buy at any price and hodl" that most investors do.

As an example Elevance Health (ELV) has always been super profitable for this except for 2008 when you would have had to hodl for 2 years until it broke even. That was a 2.4% loss according to FastGraphs. But given the size of that crash, it was a decent result.

This is kind of what Luke L. Wiley does in The 52 Week Low Formula. He's kind of vague on the sell criteria. I think he sells if there's a decent profit and he needs money to buy more quality stocks at 52 week lows.

Incidentally this is a fantastic week for picking up large cap stocks at actual 52 week lows. PEP appeared on the list again. This is a rare event, so make the most of it!
 
What's also interesting is that still almost nobody in the investing community (except maybe some here) believes me that such simple stuff outperforms the market.
Hi Brett, I'm definitely in the camp that simple wins, however im gonna have to say im a bit sceptical. You're a software developer so you must have tested the "s**t out of this. you're results however only go back to 2018. have you tried backtesting this when the broader market didn't recover so quickly, namely 2001 and 2008? you will definitely have had many buying opportunities and i can only imagine a pretty significant drawdown which is where my scepticism comes from.
testing the principle seems quite straight forward, but when you say you would only have bought "quality" is there an objective factor (fundamental or otherwise) that says, this is "quality" and would have made it into your list?
I'd be happy to help backtest, if nothing else but to see "what may have been" and to perhaps refine your filter.
 
Yes I have backtested back to 2000. Usually I test from 2018 since it has a decent enough number of bull/bear moments and I have more data for this period.

2021 was a weird year due to the almost lack of any 52 week lows after the covid crash. Such events are extremely rare though.

For quality screening I use FastGraphs (I have a subscription). I basically look for:
  • Long history (i.e. no IPOs).
  • No untested tech (a.k.a. the Lindy Effect)
  • No smallcap pharma etc.
  • Rising sales.
  • Growing dividend.
  • No overvaluation bubbles (so no TSLA, CRDA).
  • Good EPS.
  • Low debt.
  • Buying at a good valuation (this is so obvious on FastGraphs).
Basically I'm looking for a chart like PEP, MCD and most of the utilities that basically go up in a steady line over time.

Having said all that, this strategy is a numbers game. More trades = more profits and my backtesting would suggest "buy all the things" is the way to make the most money.

Here's my script applied MCD from 2000 - 2004. It enters on the 52 week low and exits for an 8% profit. It did 2 profitable trades then got stuck in 2002 so would have broken even just over a year later. What I would have done irl is to buy further significant lows - my script doesn't do that.

MCD would have made far more money hodling for a 50% bounce instead of an 8% quick profit. But then not all stocks will bounce that much. That's probably where my database of 52 week lows will become useful. In fact I take historical CAGR into account when I make my actual trades.

What I don't think can be disputed really is that 52 week lows are really interesting longer term entry points. Right now are tonnes of them and this will be an epic time to buy stuff (assuming we're in a pullback).

McDonalds-PineScript-52-Week-Lows.PNG
 
Ugh... a brutal week. However the portfolio of mostly stuff at 52 week and 50 day lows is holding up. To be honest I thought it would be down more given all the red in the portfolio. The worst performer is down 21%.

I believe the UK portfolio is the same as the FTSE 100 (down 4%). The larger portfolio with a mix of US and UK stocks hasn't fallen as far as the S&P.

For the lurkers... here's my 52 week low Pine Script. I only have a free TradingView account so I can't make it searchable. You can still use it on that link though. By default it seeks a 25% profit which is kind of what Luke L. Wiley does in The 52 Week Low Formula. He's kind of vague on precise sell signals. I think he just rebalances once/twice a year (depending on tax) and I assume the winners are sold and replaced with more stocks at/near 52 week lows.

To anyone who tries the script then says "it doesn't beat buy and hold" - you're supposed to keep buying different quality stocks at 52 week lows (this is what my backtester bot does).

I just realised something else about the strategy... buying low means a higher yield when it comes to dividends.

I may be wrong but I think we've short term bottomed. Nothing really new has appeared in the 52 week low lists. Where my portfolio will win big is when the stuff I've been buying comes back into favour. I've been picking up a lot of different stuff, but I have quite a few REITs and healthcare stocks. Energy has been appearing on the lists a lot too but I'm more wary of that sector generally.

I've given up trying to time markets. However I think the stage is set for a colossal policy mistake by the BoE (especially), the Fed and global governments generally. I can see interest rates being slashed once it's clear the economy is in freefall. That should lift all ships, unless we enter some kind of early 90's malaise caused by soaring unemployment.

It's kind of difficult to make money with this strategy in a downtrend. However there are of course many more 52 week/50 day lows in this kind of market.

I'll try and do a bit of analysis on 52 week lows generally. I now have 620 stocks in my database so it's becoming a really valuable resource.
 
The real money portfolio's recovering. The Santa rally's very late this year but it looks like we're climbing the wall of worry. Historically this is looking like being one of the least profitable times to be buying 52 week lows. I will continue with the experiments.

I'm getting the hang of TradingView's PineScript and have been using it to optimise trading strategies. I have settled on two:
  1. Buy 52 week lows and aim for a 10% profit from the oversold bounce.
  2. Buy 50 day lows and aim for a 5% profit from the oversold bounce.
I'm in the process of rebuilding my home made backtesting tool. I will simplify it down to these two strategies. It will also be flexible enough to add in other strategies.

50 day lows appear more profitable than 52 week lows. However I only have a 50 day low scanner for US stocks. One for UK stocks would be really nice - I might have to build my own.

One issue I have with my current backtester is of dubious stock data. I use data from a number of sources and it's clear that any bad data has a big result on backtests. Most real stockbrokers appear to have this issue too as I'm always finding charts with mega candles that are obviously false data/outliers/flash crashes. So I'm going to switch backtesting to a price I calculate of the average of the open and close prices. These seem to be the most achievable prices in real life trading conditions.
 
The real money portfolio's recovering. The Santa rally's very late this year but it looks like we're climbing the wall of worry. Historically this is looking like being one of the least profitable times to be buying 52 week lows. I will continue with the experiments.

I'm getting the hang of TradingView's PineScript and have been using it to optimise trading strategies. I have settled on two:
  1. Buy 52 week lows and aim for a 10% profit from the oversold bounce.
  2. Buy 50 day lows and aim for a 5% profit from the oversold bounce.
I'm in the process of rebuilding my home made backtesting tool. I will simplify it down to these two strategies. It will also be flexible enough to add in other strategies.

50 day lows appear more profitable than 52 week lows. However I only have a 50 day low scanner for US stocks. One for UK stocks would be really nice - I might have to build my own.

One issue I have with my current backtester is of dubious stock data. I use data from a number of sources and it's clear that any bad data has a big result on backtests. Most real stockbrokers appear to have this issue too as I'm always finding charts with mega candles that are obviously false data/outliers/flash crashes. So I'm going to switch backtesting to a price I calculate of the average of the open and close prices. These seem to be the most achievable prices in real life trading conditions.
Hi Brett, i personally use sharescope. they can do 50 day lows, and its where i get all my data from. Its not free, but i cant recommend them enough
 
Hi Brett, i personally use sharescope. they can do 50 day lows, and its where i get all my data from. Its not free, but i cant recommend them enough
Thanks - I might check out something like that once I've improved my system.

I've now rebuilt my backtester. It now takes prices from the middle of the candle itself (excluding wicks). I've done this because buying midway between the opening and closing price seems more realistic than buying the wicks.

Profitability is now up to 90%, with losses of less than 10%. Strangely it's not working very well with UK stocks now, but US stocks are performing roughly in line with the S&P500.

Why not just stick to a tracker? My strategy might have a higher dividend yield than the S&P and also I'm still improving the algorithm. Also it did perform better prior to 2019 when the Mag7 went bonkers. I'm also mostly buying lower risk stocks.

Other interestingness:
  • 50 day lows are generally more profitable than 52 week lows, at least for shorter term trading.
  • I have at long last built my own indicator that actually works in reducing unprofitable trades. It improves CAGR by 1-2%. Over 6 years, that's huge.
  • At least 50% of the bot's catastrophic trades (i.e. loss of >25%) could have been avoided if it didn't buy stuff coming off of obvious valuation bubbles. In real life I wouldn't buy these because I always screen my real trades on FastGraphs. I need to write some sort of algorithm for spotting bubbles. I'm not sure if I can do it without fundamental data though. Probably all I'd need is PE, then I'd screen out trades where the PE is well above the historic norm for that stock.
  • Another red flag: unsustainable dividends. This cuts out a few more bad trades.
The next task is to see if Markov chains would be of any value in predicting trade outcomes.
 
Top