Showing posts with label Systematic Trading. Show all posts
Showing posts with label Systematic Trading. Show all posts

Friday, 4 September 2026

Not another one! My fifth book...

Well yes, I am pleased to announce that as of this week I completed final proof reading of my new book "The Art And Science of Trading"(AAST). It joins the list of my existing books with their  own acronyms: Systematic Trading (ST), Smart Portfolios (SP), Leveraged Trading (LT) and Advanced Futures Trading Strategies (AFTS).

Due to the inherent delays involved in global dead tree supply chains the book won't actually be officially published until 1st December, although if you pre-order now you will probably get your copy a little earlier. 

I also approved the cover art, which looks like this:



Briefly, what is this book about?

This is effectively four books at once (I know, cool trick right?!). Firstly, it effectively forms a counterpart to my third book Leveraged Trading (LT). LT is an 'introductory' book to trading properly with leveraged instruments; things like futures or spreadbets. Essentially, AAST is the delta-one counterpart to LT. It's an introductory level to trading properly without leverage - so where you can't take on bigger positions than your account value, nor can you go short. It covers the classic delta one instruments used by retail traders: shares, ETFs and ..... crypto (I'll address that particular block chain sized elephant in a moment).

Note: Yes I did cover shares and ETFs in 'Smart Portfolios' (book#2) but from an investment rather than a trading perspective.

Secondly, it's the most introductory book I've ever written, and aimed at more of a mass market (is that because I'm trying to educate as many people as possible, or is it because I want to sell a gazillion copies rather than modest five figures.... well a little of both). So there is a lot more hand holding than there is even in Leveraged Trading; plus more careful explanations of why you can't trust 'gurus', and I've  also stripped back my usual introductory trend trading strategy to the simplest possible rule set it can be without being dangerous (essentially using Occams razor to the point where you are about to cut yourself with it, but not quite). For example, the trend rule - which you can have for free as loyal readers of this blog - is 'has the price gone up or down'?

Thirdly, and this is in the title, I think there is a bunch of 'science' that all traders need to know about, even retail traders - nay, especially retail traders. And actually I go into far more detail about explaining this intuitively than I have in any of my previous books. Familiar concepts like proper robust backtesting, judging outcomes by distributional uncertainty, and of course my old mate the Kelly criteria are all in here. These are all explained in an accessible way from first principles.

Finally, and this is also in the title, it's about the art and science of trading. I came up with the idea of semi-automatic trading in my 1st book, and I used it again in my 3rd. So if you are one of those gifted people who can intuitively predict price direction better than a systematic method, that's lovely, but you should still do that within a systematic framework for position sizing and risk management. Essentially by putting a set of science based guard rails around your trading methods, you will make the most of a good method, and protect yourself from the worst excesses of a bad one. This also means someone using a crap 'systematic' method like <insert obscure japanese sounding charting method name here> won't lose too much money, and if they're lucky enough might even make some.

The relationship between my 5 books is explained quite well on this web page https://www.systematicmoney.org/which-book-should-i-buy where you can find this neat diagram:



A brief aside: Crypto. Rob-seriously?

Let me quote from page 25 of AAST:

I should state my own prejudices up front: I am not a fan of cryptocurrencies, which are used primarily for gambling and criminal activities such as money laundering, and which consume a great deal of electrical power, with obvious implications for the climate crisis. In an ideal world I would ignore them completely. Although I am retained as a research advisor for a crypto hedge fund, and I trade Bitcoin and Ethereum futures, I do not hold any crypto in my personal portfolio.

But the point of this book is to guide traders into using certain scientific rules to reduce their chances of losing money, and nobody needs those rules more than those trading crypto. The message of this book as it pertains to crypto can be summarised as ‘I would not do this stupid thing if I were you, but if you insist, this is the least stupid way to do it.’

(is this because I'm trying to educate as many crypto people as possible, or is it because putting crypto on the cover will increase the sales by a factor of a gazillion.... well a little of both)


Do I need to buy it?

If you're reading this blog, there's a good chance you tick all of these boxes:

  • I consider myself something of a financial expert, actually
  • I only trade leveraged instruments, like futures
  • I'm a fully systematic trader, not interested in this 'intuitive trading' sounds like woke nonsense to me.
  • I've already read your other books and I have a firm grasp on the concepts, thanks very much
So if you tick all of these boxes then you probably don't need to buy this book. Of course you may still want to, because:
  • You have already derived $x000's or even $x,000,000's of benefit from my existing books and blog at minimal cost, and chucking me another $x0 seems only fair
  • My writing style is so awesome that people will happily read my books for fun
  • It's probably worth being reminded of certain basic concepts and ideas
  • You never know, there could even be some deep insight within the book that even you haven't thought of before. As one reviewer said "Despite being an experienced market practitioner, this book really gave me new ideas when it comes to trading". Thanks Saeed, the next burger is on me!
  • You have a friend or relative who doesn't tick all these boxes, but has an interest in trading. And... Christmas is coming!
However if you are someone who ticks one or more of these boxes:
  • Is a relative beginner at this trading nonsense;
  • Is unfamiliar with, or struggled to understand, books like Leveraged Trading, Systematic Trading and Advanced Futures Trading Strategies;
  • Trades non leveraged instruments like ETFs, stocks or crypto;
  • Trades in a non systematic way
... then I'd suggest that you should seriously consider a purchase of AAST. The worst outcome would be that you'd read it, decided trading isn't as easy as you thought, and then decide not to trade. You'd be out the price of a book rather than losing hundreds or thousands of <insert local currency unit here>. 

Of course if you do decide to trade, then owning a copy of AAST will seriously improve your chances of successful trading. Naturally, actually reading and doing what it suggests will help even more.

Has anyone read this nonsense, and liked it?

Five people! And only three of them are mates of mine! Here are some nice things they wrote without me having to give them money (or got AI to write, I didn't ask):


Saeed Amen, Author of Trading Thalesians; Co founder Turnleaf Analytics (ex Lehmans FX, ex Thalesians)

I’ve always enjoyed Rob’s trading books, because they’re always very practical. This new book is useful both for novice and experienced traders. I like the way he creates a framework in the book for managing risk that is applicable to both discretionary and systematic traders. Crucially he takes you through the whole lifecycle of a trade, from position sizing to execution and the broader question of how to manage different assets in a portfolio. Despite being an experienced market practitioner, the book really gave me new ideas when it comes to trading.

Andreas F. Clenow, Chief Investment Officer and author of multiple financial bestsellers (his words!)

Rob Carver is an outlier among financial authors. He has managed billions at tier one institutions and he is a world class quant professional. Seeing his name on the cover of a book should be enough to buy it. I have all his previous books in my office and reference them often in my own work. This time, Rob brings his institutional perspective to tackle equities, ETFs, and crypto in the same structured and well-researched manner as his previous work. In particular, I enjoyed his ruthless analysis of crypto returns, day trading, and the separation of internet hype from the brutal reality of real-world, professional trading. I am clearing space on my office shelf for another book which I will read and reference many times, and so should you.


Alex Spiroglou, CFTe, Dip(TA) ATAA Semi-systematic macro trader

A highly insightful and practical read for anyone looking to improve their trading. Rob Carver cuts through the noise and shares a thoughtful approach grounded in experience, discipline and real-world market understanding. The book offers plenty to reflect on, whatever your trading style or experience level.


Tony Guida, Head of Quant Research AtonRa Partners

In a few words: I really liked it. It reads well and fast, and you got the ordering right. In my world almost all the effort goes into the opening signal and almost all the P&L comes from what surrounds it. Very few authors are willing to say that out loud, because "here is how to size a position" sells fewer books than "here is how to pick winners". The costs chapter and the trade management rules are what I would hand to a junior on day one. A few other things I liked. Chapter 12, on adjusting positions and stops when risk changes, is the chapter almost nobody writes and everybody needs. The forecast-based stop losses in 13 are the right way round: the stop follows the conviction rather than a round number on a chart. And I appreciated that the diversification section treat it as an operational problem, instrument substitution, and portfolio construction, not as a slogan about not putting eggs in one basket.

I should declare my bias. I would have happily read another two hundred page of formulas and python. But I am clearly not the main target here, and that is the point. Putting it in spreadsheets is what makes the rules usable by the people who need them, and the rules do not get worse for being written in Excel.

My humble endorsement: “A discretionary trader and a systematic PM can read this book and end up agreeing with each other, which almost never happens unless the building is on fire or bonuses are at stake. Carver's argument is that you can keep your intuition for choosing what to trade, provided everything about how you trade it follows rules. Thirty years of experience compressed into procedures that fit in a spreadsheet, with no equations and no black boxes. He has written something a beginner can act on and a professional cannot argue with.”


Sam Beatson, PhD, EMBA, FRSA Lecturer in Finance, Risk and Banking Nottingham University Business School and CEO, MarketNous

Robert Carver has managed to combine a rigorous approach with accessibility, without pretending that trading in markets is anything other than demanding and challenging. The Art and Science of Trading is the perfect primer to the wider Carver canon, but also stands strongly in its own right as a practical and intellectually grounded guide to trading.

One of the book’s most useful contributions is the distinction between the art of finding trades and the science of managing them. Carver gives intuition, judgement and experience a legitimate place in trade-finding, while making a persuasive case that position sizing, costs, risk and trade management demand much stricter, rules-based discipline.

He shares his expertise on the less glamorous but essential aspects of trading: randomness, overfitting, transaction costs and the difficulty of distinguishing genuine skill from good fortune. Rather than looking for shortcuts, the reader is encouraged to question apparently impressive results, understand why a strategy should work, and think carefully about whether an edge is likely to survive beyond the historical data in which it was discovered.

In characteristic Carver style, you’ll find answers grounded in evidence, scepticism about any easy path to market profits, and an abundance of practical lessons for new and experienced traders alike.”

Seems appropriate to say thank you

Yes, I do have a list of thank yous:
  • The panel of Elite Traders who helped me pierce my Anglocentric bubble and get a better understanding of the international landscape for retail traders: Alexey Chursanov, ‘Elder’, ‘Kernfusion’, Matthijs Vákár, Professor Paul Calluzzo, Goran Peretin, Dr Sebastian Schmidt, and Vikram Mundkur.
  • A couple of key crypto people from Twitter/X: Crunchster and Scott Phillips. They didn't know they were contributing to a book but their posts were very helpful in my research process.
  • My sister Vicki and my 'sister' Debbie who forced me to write their names into the book despite me insisting it wasn't a novel. This isn't really a thank you, it's documentary evidence I will need for the police report.
  • The expert reading panel: Burak Yenigun (of Stylus Digital) and Riccardo Ronco (of recently retired). This is an unpaid position requiring many hours of reading the first draft of my prose. Which is awful. I can barely read it myself. And the only reward is a signed copy and passive aggressive responses from me ignoring nearly all their comments. Why do they do it? To get this brief mention in a blog post only 50 people will read? I guess.
  • Various random people from my publisher Harriman house: Myles, Victoria, both Charlottes, Sally, Lucy and Suzanne
  • Editors: Comissioning - Craig Pearce, Copy - Dominic Fenn, Proof - Amy Webber (who also as assistant editor has assidously guided this book on it's journey from concept to physical copies). This is a paid position requiring many hours of reading the 2nd, 3rd, 4th..... 89th drafts of my prose. And you can't get AI to do it. Because AI would be like "This is great! Just needs more em-dashes and it would be perfect".
  • The people who live in my house with me (some or all of the time) and put up with all my nonsense.

Is that it then? No more books? <slightly pleading voice>

Ha! If only. No, I'm currently in the early stages of thinking about book#6 which will provisionally be  a relatively advanced book about backtesting. And I'll probably stick AI on the cover to get some more sales.


Note: for those that don't understand the 'not another one' it's a UK political reference to 'Brenda from Bristol' 

https://www.reuters.com/article/world/us/not-another-one-brenda-from-bristol-speaks-for-britons-sick-of-elections-idUSKBN17L1FX/

To see Brenda live, watch the first 5 seconds of this video:




Thursday, 14 April 2022

Trading and investing performance: year eight

 Eight years! Wow. 

In late 2013 I walked out of an office for the last time where I had been working for AHL, a large systematic futures trading fund. A few months later, in April 2014, I had my own very small systematic futures trading account, and I started doing these performance reviews. And this is my eighth review. Double wow! 


As usual these cover the UK tax year, in this case from April 6th 2021 to April 5th 2022.

TLDR:

Great futures trading, no thanks to 'Black Friday', mostly thanks to the energy crisis. Outperformed AHL, but a little short of the wider index. Poor stock selection and country allocation; better in bonds; good asset allocation. Net-net: 8.2% vs my benchmark +3.8%



Overview of my world


I promised last year I would simplify things, and I have. My investments fall into the following categories:


Investing:

  • 1 UK stocks
  • 2 Various stock ETFs
  • 3 Various bond ETFs
  • 4 A small amount of uninvested cash
Trading:
  • 5 Futures contracts traded by my fully automated trading strategy
  • 6 Cash as trading capital for the above, of which usually around a third is required for initial margin
Excluded from this analysis is:

  • My house
  • A cash buffer I keep to cover living expenses
I benchmark my investments in the following way:

  • A: UK single stocks 
    • Benchmarked against ISF, a cheap FTSE 100 ETF (FTSE 350 is probably a better benchmark but these ETFs tend to be more expensive).
  • B: Long only stocks investments: All stock ETFs and UK stocks
    • Benchmarked against a cheap global equity fund (VEVE)
  • C: Long only bond investments: All bond ETFs
    • Benchmarked against a cheap global bond fund (AGGG)
  • D: Long only investments: All UK stocks, bond ETFs and stock ETFs
    • Benchmarked against a cheap 80:20 fund. 
  • E: Futures trading: Return from the futures contracts traded by my fully automated system. The denominator of performance here is the notional capital at risk in my account (usually close to, but not exactly the same as the account value).
    • Benchmarks are a similar fund run by my ex employers AHL, and the SG CTA index, adjusted for volatility.
  • F: Everything: Long only investments, plus futures hedge, plus futures trading. I include the value of any cash included in my trading or investment accounts, since if I wasn't trading I could invest this. 
    • For the benchmark I use a cheap 60:40 fund.


If you prefer maths, then the relationship to the first set of categories is:

A = 1
B = 1 + 2 
C = 3
D = B + C = 1 + 2  + 3
E = 5 + 6
F = D + 4 + E = 1 + 2 + 3 + 4  +5 + 6

If you've been following me for a while you can see that I've opted to split out my equities and bonds performance; something I haven't done before. I've also moved stuff around a bit - the 'risk' section is now under the relevant performance category, and there are some more detailed figures on costs and turnover.


Performance contribution


The figures shown are the contribution of each category to my total investment performance:


1) UK equities 1.8%

2) Stock ETFs 2.6%

3) Long only bonds 0.07%

5) Futures trading 3.7%

4 & 6) Cash 0.0%

F) Total +8.2%


Here is another way of putting it:

Long only MTM (mark to market): 1.2%

Stock and ETF dividends: 3.2%

Futures: 3.7%

Now for the same figures as 'internal rates of return', which are effectively for the 'capital' employed in each area. I use the Excel function XIRR. You can't add these up, but they are comparable and account for flows between categories. Benchmarks are also shown.


A) UK equities +9.8% Benchmark +16.6%

B) Long only stocks +6.1%   Benchmark +12%

C) Long only bonds 1.5%  Benchmark -3.0%

D) Long only investments 5.9% Benchmark +7.9%

E) Systematic futures trading  27.0% Benchmarks -4.9% +32.3% (vol matched)

F) Everything +8.2% Benchmark+3.8%


I have colour coded these to give an indication of where the good, bad and unsure are.


UK equities


This portfolio is traded using a system which I've explained before (value bias, with trailing stop of 30%), but which is not automated. Instead I have the stocks set up in a spreadsheet, with alerts reminding me when stop losses occur. If I sell then I download some data to pick the best value share.

The current portfolio looks like this:

Hammerson PLC (LSE:HMSO) 0.21%

Babcock International Group PLC (LSE:BAB) 2.45%

Greencoat UK Wind (LSE:UKW) 2.60%

Imperial Brands PLC (LSE:IMB) 3.17%

Johnson Matthey PLC (LSE:JMAT) 3.24%

Morgan Advanced Materials PLC (LSE:MGAM) 3.47%

Castings PLC (LSE:CGS) 3.50%

Barratt Developments PLC (LSE:BDEV) 3.53%

Phoenix Group Holdings PLC (LSE:PHNX) 3.64%

Lloyds Banking Group PLC (LSE:LLOY) 3.75%

BT Group PLC (LSE:BT.A) 3.82%

TP ICAP GROUP PLC (LSE:TCAP) 3.96%

Centamin PLC (LSE:CEY) 4.05%

Renewables Infrastructure Grp (LSE:TRIG) 4.24%

Greencore Group PLC 4.33%

Redde Northgate PLC (LSE:REDD) 4.39%

Aviva PLC (LSE:AV.) 4.46%

Rathbones Group Plc 4.49%

Central Asia Metals PLC (LSE:CAML) 4.58%

Morgan Sindall Group PLC (LSE:MGNS) 4.89%

Centrica PLC (LSE:CNA) 5.30%

Direct Line Insurance Group PLC (LSE:DLG) 5.87%

Investec PLC (LSE:INVP) 16.05%


Most of these were bought 'normally', but I bought a double dose of Investec last year as it was a screaming buy at a time when nothing else passed my filters (this was a good decision - see below). All are above their stops except Hammerson, which was the first share I bought coming out of the 2020 COVID market pandemic: too early as it turns out. It completely cratered before I could activate the stop and now I keep it as an out of the money call option on UK property or sentimental reminder of the importance of stops - take your pick.

Here is the performance of every share I held over the year. Percentages are taken from the start of year price, or from when I bought it during the year:

                                         MTM % Divi % TR %

Investec PLC (LSE:INVP)                         138.2% 8.3% 146.5% HELD LEGACY

Morrisons (LSE:MRW)                         62.7% 2.8% 65.5% SOLD LEGACY

Morgan Sindall Group PLC (LSE:MGNS)         33.5% 4.0% 37.4% HELD LEGACY

Babcock International Group PLC (LSE:BAB) 36.5% 0.0% 36.5% HELD LEGACY

Greencoat UK Wind (LSE:UKW)                 20.2% 5.5% 25.7% HELD LEGACY

Rathbones Group Plc                         19.6% 4.2% 23.8% HELD LEGACY

Imperial Brands PLC (LSE:IMB)                 11.5% 9.3% 20.8% HELD LEGACY

BT Group PLC (LSE:BT.A)                         17.8% 1.5% 19.2% HELD LEGACY

Aviva PLC (LSE:AV.)                         7.5% 5.2% 12.7% HELD LEGACY

Lloyds Banking Group PLC (LSE:LLOY)         8.1% 2.9% 11.0% HELD LEGACY

Senior (LSE:SNR)                         10.5% 0.0% 10.5% SOLD LEGACY

Marks And Spencer Group Plc (LSE:MKS)          8.9% 0.0% 8.9% SOLD LEGACY

Central Asia Metals PLC (LSE:CAML)          8.8% 0.0% 8.8% HELD BOUGHT

Redde Northgate PLC (LSE:REDD)                  4.3% 1.5% 5.7% HELD BOUGHT

Johnson Matthey PLC (LSE:JMAT)                  1.1% 0.0% 1.1% HELD BOUGHT

Renewables Infrastructure Grp (LSE:TRIG) -0.5% 1.2% 0.8% HELD BOUGHT

Phoenix Group Holdings PLC (LSE:PHNX)          0.6% 0.0% 0.6% HELD BOUGHT

Centrica PLC (LSE:CNA)                          0.0% 0.0% 0.0% HELD LEGACY

Hammerson PLC (LSE:HMSO)                 -2.5% 1.2% -1.3% HELD LEGACY

Morgan Advanced Materials PLC (LSE:MGAM) -3.5% 2.1% -1.4% HELD LEGACY

Centamin PLC (LSE:CEY)                         -3.9% 0.0% -3.9% HELD BOUGHT

TP ICAP GROUP PLC (LSE:TCAP)                 -6.8% 0.0% -6.8% HELD BOUGHT

Direct Line Insurance Group PLC (LSE:DLG) -14.3% 4.5% -9.8% HELD LEGACY

Royal Mail Plc (LSE:RMG)                 -13.5% 2.1% -11.5% SOLD LEGACY

Synthomer Plc (LSE:SYNT)                 -16.4% 3.7% -12.7% SOLD LEGACY

Barratt Developments PLC (LSE:BDEV)         -12.8% 0.0% -12.8% HELD BOUGHT

Castings PLC (LSE:CGS)                         -17.3% 1.0% -16.3% HELD BOUGHT

Greencore Group PLC                         -18.2% 0.0% -18.2% HELD LEGACY

Crest Nicholson Holdings Plc (LSE:CRST)         -21.0% 1.0% -20.0% SOLD LEGACY

Micro Focus International Plc (LSE:MCRO) -27.6% 3.2% -24.5% SOLD LEGACY

Vesuvius Plc (LSE:VSVS)                         -29.0% 3.8% -25.2% SOLD LEGACY

Currys Plc (LSE:DC.)                         -28.4% 2.8% -25.6% SOLD LEGACY

ITV PLC (LSE:ITV)                         -31.3% 0.0% -31.3% SOLD LEGACY

Go-Ahead group (LSE:GOOG)                 -34.5% 0.0% -34.5% SOLD LEGACY


Let me explain the columns: MTM is mark to market (the % price change since I bought it, or the start of the year), Divi(dend)% is self explanatory, TR is total return - the sum of the first two columns. The next column describes the current state of this position: do I still HOLD or have I SOLD. The final column shows when I obtained the position: at the start of the year (LEGACY) or it's something I subsequently BOUGHT.

Of course there is a bias towards selling shares that have gone down, because of the effect of the stop loss. Morrisons is an obvious exception; I sold it in October because it was being taken over and I didn't want to wait for the cash to arrive - I actually got a small premium above the final takeover price so that was a nice fluke.

I did 21 trades in this portfolio last year for a turnover of around 85%; i.e. my average holding period is probably around 15 months. That is pretty much what I expect to achieve, and I've calibrated my stop loss accordingly. It's certainly quieter than the frantic trading I did in 2020, which covered two of my performance years. Commissions came in at 0.035% of the initial portfolio value, and stamp duty tax was 0.125% plus a few quid in PTM levies. 

Stamp duty is 0.5% on buys only, but some of my shares weren't eligible (not sure why and don't really want to find out). I could avoid this by trading CFDs, but the broker I mainly use for UK shares doesn't offer these, and I'm not sure I could do this within a tax protected wrapper (as I'm actively trading, I want to avoid capital gains tax or having my trades distorted by tax optimisation).I would have paid other taxes on dividends, but generally in this post I ignore taxes.

I don't record slippage data here, but as I'm only trading FTSE 350 stocks it won't be too bad. There were other custody charges but I will account for those later since in most of my accounts I mix UK shares and ETFs (although I've since taken steps to simplify this, so I now have a single UK shares only account).

Over the year I was a net seller of UK stocks to the tune of 6% of the starting value; this was to achieve my required regional weightings (see the next section).

This has traditionally been the best part of my portfolio on a relative basis, but all good things must come to an end, or at least pause for a while. I earned an IRR of 9.8% which would be okay except the benchmark (a UK FTSE 100 tracker, ISF) returned 16.7%. It seems to finally have been the year when the much belagaured UK market actually started to catch up.

Of that sum dividends returned 3.3% - better than the 1% of last year, but still well down from the 4.6% of the year before. Forward expectations for my current portfolio show a further improvement next year, but we shall see.


2016 - 2017 XIRR  29.2%, benchmark  22.7%

2017 - 2018 XIRR  18.3%, benchmark   2.2%

2018 - 2019 XIRR  -2.3%, benchmark   7.6%

2019 - 2020 XIRR -23.1%, benchmark -24.3%

2020 - 2021 XIRR +64.3%, benchmark +24.6%

2021 - 2022 XIRR +9.8%,  benchmark +16.7%


Mean            Me 16.0%  benchmark 8.3%

Sharpe Ratio    Me 0.54   benchmark 0.45       

Geometric mean  Me 12.9%  benchmark 6.8%


Long only Stocks


As already noted this is a new category which consists of all my stock ETFs, plus my UK shares. For consistency, although it's perhaps less meaningful, here's my current portfolio of stock ETFs:

UC07 US Dividend 0.95%

PGIT* Global Infrastructure 1.46%

HMEF EM Normal         1.58%

EQDS Europe Dividend 3.69%

VHYL Global Dividend 4.30%

IAPD Asia Dividend 5.09%

PADV Asia Dividend 7.07%

PAXG Asia Normal         8.38%

IDVY Europe Dividend 9.41%

HDLG US Dividend 12.10%

EUDV Europe Dividend 12.78%

USDV US Dividend 13.10%

SEDY EM Dividend 19.20%


(PGIT is actually a UK investment trust, but I'm treating it as a stock ETF to avoid creating a new category)

Perhaps more useful are the risk exposures by region within this sub-portfolio:

              Start of year      End      Long term   Target

Asia             12%             14%         15%       14%

EM               23%             20%         25%       28%

Europe           23%             17%         20%       18%

UK               30%             29%         25%       28%

US               12%             20%         15%       12%


Start of year and End are self explanatory, whilst Long term is the strategic allocation (see my spreadsheet). After I have snapshotted the year I rebalance the portfolio to the target level shown, taking account of tax and transfers between accounts. 

Turnover on the ETF part of the portfolio was lower as I gradually rebalance according to the rules in my second book Smart Portfolios, and it came in at 30% with commisions of 0.0078%. Again I don't capture slippage here; and I will also of course be paying a management fee on my ETFs, but I try to keep this as low as possible. Incidentally a shout out to one of my brokers, iweb, who are now showing a very clear screen with all the charges you'd pay when you buy an ETF before the trade goes through. 

For the stock portfolio as a whole then then the turnover was 47%, with commissions and taxes coming in at 0.06% (most of that being the pesky taxes on UK shares). Again there are other management charges at the account level, but as I have both stocks and bonds in many accounts (I do try and keep my tax sheltered accounts purely for stock ETFs for reasons explained in Smart Portfolios, but my non tax sheltered accounts have both bonds and stocks).

I was a net buyer of stocks during the year, as will become clear below, to the tune of 12% of the starting value of the portfolio. 

Anyway, the XIRR for this weird stock/ETF hybrid beast is 6.1%, which isn't wonderful - in fact it's significantly less than the benchmark ETF I've chosen (VEVE) which returned 12%. Dividends were 3.9%.

Since the start of 2022 I'm seeing signs that my long run bets on value and the UK, and permanent US underweight, are starting to bear some fruit, so maybe this will look better next year.

No performance history here as this is the first time I've calculated this figure.



Long only Bonds


Another new section, this time with just ETFs. Current portfolio:

SLXX UK Corporate 8.48%

EMCP EM Corporate 9.00%

FAHY US High yield 9.15%

JNKE Europe High yield 10.31%

VSL* Global High yield 15.90%

VDET EM Government 19.80%

SHYG Europe High yield 27.36%


* VSL is actually a UK investment trust, but I'm treating it as a bond ETF to avoid creating a new category

Risk:

              Start of year     End      Long term   Target

Asia             1%               3%         None        5%

EM               44%             40%         25%        27%

Europe           20%             35%         25%        24%

UK               34%              8%         25%        28%

US               2%              13%         25%        16%

Note: in previous years I've classified the 'cash like' ETF XSTR as a bond ETF. This year I've classified it as cash, which makes reporting easier and also makes more sense. The UK starting risk figure above  has been recalculated to reflect this, so won't be comparable with previous years.

Note also that I don't own any Asian bond ETFs or have a long term allocation for them as there weren't any available last time I checked: the exposure shown is a 'look through' from the global bond ETFs I own.

Turnover was high in this portfolio at 178% of the average start and end value; but it's perhaps easier to point out that I was a huge net seller of bonds this year, the portfolio reducing in size by 60% (and that does not include the effect of reclassifying XSTR) which was entirely driven by net selling, not performance. Commissions were 0.044% of average capital.

The XIRR is 1.53%, which sounds mediocre until you remember we are in the middle of a massive bond bear market, and the benchmark AGGG was down -2.97%. My weighting towards  corporate and high yield rather than government bonds helped here. Dividends - or rather coupons - added a massive 4.63%. A weird year when bonds, albeit risky ones, earned me more in dividends than stocks! Although the fact I was a big net seller makes this figure hard to calculate.

Again no performance history here as this is the first time I've calculated this figure.


Long only investments


This is basically everything except my futures trading account (although to be pendantic, the odd chunks of univested cash I have lying around in my investment accounts won't be included in this section). You already know what is currently in this portfolio, and the regional risk exposures, so that just leaves the macro asset class level exposure. Here it is in cash terms:

              Start of year      End      Long term   Target

Bonds            13%             5%          22%        8%

Stock            87%             95%         78%       92%


And here's risk terms:

              Start of year      End      Long term   Target

Bonds            8%              3%          10%        5%

Stock            92%             97%         90%       95%


What has been happening here is that the sell off in bonds has driven the required allocation lower over the year. Now the needle is starting to move back - mainly due to poorer equity returns - so I'm gradually rebuilding my bond exposure although it's still only going to be half the long term target even after my current bout of rebalancing (which will take me to target).

It seems a bit weird to talk about winners and losers in the context of ETFs, but in the interests of transparancy here are the simple (not XIRR) returns for everything I held during the year in both stock and bond ETFs:

        MTM % Divi % TR %
HDLG Equity US Dividend 16.6% 3.6% 20.1%
USDV Equity US Dividend 16.0% 3.0% 19.0%
VSL* Bond Global High yield 5.4% 11.8% 17.2%
VHYL Equity Global Dividend 14.4% 0.6% 15.0%
PGIT* Equity Global Infrastructure 10.1% 4.4% 14.6%
EQDS Equity Europe Dividend 9.0% 4.8% 13.7%
UC07 Equity US Dividend 10.1% 1.8% 11.9%
JNKE Bond Europe High yield 7.1% 2.8% 9.9%
PAXG Equity Asia Normal         5.0% 3.6% 8.6%
IAPD Equity Asia Dividend -1.3% 5.2% 3.9%
SEMB Bond EM Government 1.4% 0.7% 2.1%
ISXF Bond UK High yield 0.3% 0.0% 0.3%
EMCP Bond EM Corporate -0.8% 0.4% -0.4%
PADV Equity Asia Dividend -5.8% 5.0% -0.8%
FAHY Bond US High yield -4.9% 3.5% -1.5%
SEDY Equity EM Dividend -9.5% 7.8% -1.6%
SHYG Bond Europe High yield -3.5% 1.7% -1.9%
EUDV Equity Europe Dividend -4.9% 2.5% -2.4%
VDET Bond EM Government -9.9% 6.2% -3.7%
IDVY Equity Europe Dividend -9.2% 3.9% -5.3%
HMEF Equity EM Normal         -10.3% 2.0% -8.3%
SLXX Bond UK Corporate -11.0% 1.5% -9.6%

* investment trusts, classified as ETFs

For the sake of completeness, the turnover was 58.7% on this aggregate portfolio and commissions plus taxes were 0.09%. 

You already know it was stocks good (but relatively bad), bonds bad (but relatively good), so how do we end up overall? Pretty good actually, the XIRR on all my long only investments was 5.9% which compares well to my usual benchmark, Vanguard 60:40 which returned 3.8%. However, mostly that is because my average equities allocation of around 92% cash was much higher, and equities outperformed bonds. Exactly 4% of that return was dividends.

Let's have a quick look at some history before discussing the benchmark.

2016 - 2017 XIRR  22.3%, benchmark   17.7%
2017 - 2018 XIRR   1.3%, benchmark   1.3%
2018 - 2019 XIRR   4.0%, benchmark   7.2%
2019 - 2020 XIRR -17.5%, benchmark -10.5%
2020 - 2021 XIRR +34.8%, benchmark +21.5%
2021 - 2022 XIRR  +5.9%, benchmark  +3.8%

Std. dev        Me 18.1%  benchmark 11.6%

I have said this before but it might seem a bit weird to have a 60:40 benchmark, when my long run cash allocation is closer to 80:20. The reason I have done this is because on my overall portfolio including futures trading I expect to hit vol closer to 60:40 due to diversification effects (despite my futures trading being run at 25% vol) - as you will see later, this is broadly correct. And I didn't want to use a different benchmark, because I was lazy. And indeed, the standard deviation differences above clearly show that I am running at a higher vol than 60:40

Normally changing benchmarks is cheating, but in this case it will actually make me look worse, so I hope you will allow it. So here are the restated figures again for Vanguard 80:20 as a benchmark:

2015 - 2016 XIRR   6.1%, benchmark    0.1%
2016 - 2017 XIRR  22.3%, benchmark  25.0%
2017 - 2018 XIRR   1.3%, benchmark   2.9%
2018 - 2019 XIRR   4.0%, benchmark   9.3%
2019 - 2020 XIRR -17.5%, benchmark -10.7%
2020 - 2021 XIRR +34.8%, benchmark +32.6%
2021 - 2022 XIRR  +5.9%, benchmark  +7.9%


Std. dev        Me 18.1%  benchmark 15.6%

Mean            Me 8.5%   benchmark 11.1%

Sharpe Ratio    Me 0.47   benchmark 0.72       

Geometric mean  Me 7.2%  benchmark  10.2%


The risk here still isn't spot on, but it's closer and since 80:20 is my long term target I think this new benchmark makes sense. On this revised basis then I underperformed this year, with 5.9% worse than the Vanguard 80:20 benchmark of 7.9%. This was despite my tactical weightings looking more like 90:10; but as we already know the 90% I put in stocks didn't do so well versus the benchmark. In fact a 90:10 Vanguard would have earned around 9.2%, so clearly my intra asset allocation was a bit rubbish especially in stocks.


Futures trading 

So far it's not going well, but don't worry futures will save the day :-)

Here are some statistics (all as a percentage of initial capital at the start of the year):

MTM: 24.7%
Interest: -0.07%
Fees: -0.09%
Commissions: -0.58%
Margin held, FX gain/loss: 3.1%

Net futures trading: +27.0%


Let's start with the long view:
And what about last year?





Basically I had a fairly jumpy few months where I made a small net gain, then 'Black Friday', a few days in November when I lost bigly, and then of course the acceleration of the last few months. This run up ended on March 9th when there was a modest loss resulting in my risk being cut and many positions being closed. Since then I'm pretty flat.

Which markets did I make profits in?

    codes   pandl
0    Bond  -5.0
1  Metals  -2.0
2  Sector  -0.3
3     Vol   0.6
4      FX   0.9
5  Equity   1.0
6     Ags   5.1
7  OilGas  21.7

These don't add up to the total p&l for reasons I haven't got time to check now, but the general pattern is clear. This really was the year of the energy markets, with a small contribution from the Agricultural markets offset by poor performance in bonds where I struggled to deal with the bear market. This is borne out by the p&l by market list:


           codes  pandl
0           PLAT   -2.7
1            AEX   -2.5
2           BUND   -1.4
3        LEANHOG   -1.3

<SNIP>
67           OAT    1.0
68         SP400    1.2
69           VIX    1.5
70   SP500_micro    1.6
71  NASDAQ_micro    1.6
72   GAS_US_mini    1.6
73           JPY    1.9
74           SMI    2.2
75       SOYBEAN    2.8
76          CORN    2.8
77    BRENT-LAST    4.1
78  CRUDE_W_mini    4.9
79       HEATOIL    5.1
80     GASOILINE    5.7


How about costs? Total slippage was a rather hefty 2.4%, which meant I paid around 3% in total costs. This is more than I normally pay (my backtest says 1%), but I have made quite a few changes to my models this year. My new dynamic trading strategy includes costs in it's optimisation, and I've become more systematic in excluding markets that are too price to trade, so I'm comfortable this will be back under control next year.

My slippage would have been higher but I earned about 0.5% using my simple execution algo which reduced it. 

Well 27% certainly shoots the light out in absolute terms, and beats the pants off the long only benchmarks, but what about on a relative basis?

As I've done in previous years I compare this to two benchmarks, 'Bench2' the SGA CTA index, and a 'Bench1' a fund run by AHL, my ex employers. The former has daily data, but for the latter I have monthly data only, this the figures are April to March. Both benchmarks are normalised so they have the same standard deviation. I redo this normalisation every year, so the figures here won't be exactly comparable to previous years.

On this basis I returned 27% versus 38.3% for SG CTA and a loss of -4.9% for AHL. It's clearly been an excellent year for trend following, especially in the last few months; the underperformance of AHL is somewhat puzzling but they had a pretty poor January which meant that a good March didn't really get them back in the game.

My historic figures here are only for futures trading (including FX margin mark to market) - remember I used to have an equity hedge component as well. 

     My futures Bench1 Bench2
2014 – 2015 58.2% 65.9% 50.7%
2015 – 2016 23.2% -8.2% -1.6%
2016 – 2017    -14.0% -5.8%  -25.5%
2017 – 2018     -3.7%  7.0% -4.4%
2018 – 2019  5.2%  7.6%  0.8%
2019 – 2020 39.7% 21.3%  9.3%
2020 – 2021  0.4%  0.7% 12.7%
2021 – 2022 27.0% -4.9% 38.3%

Correlation      1.0     0.73    0.80

Mean         17.0% 10.5% 10.0%

Sharpe ratio 0.70  0.43  0.41

Geometric mean 14.8%  8.5%  7.7%


Of course I don't charge fees so perhaps the comparison is slightly unfair, but I'm still pretty happy with that. On a long run basis I'm outperforming both Bench1 (which did very well prior to this year) and Bench2 (which has done particularly well in the last couple of years). 

It's worth noting that my daily and monthly Sharpe Ratios are better than those shown above; this is characteristic of positive skewed assets.


Everything

Well all that remains is to add up the futures and long only performance, and see what the aggregate scorecard is. The denominator here will be the total value of all the securities and investable cash I have, including both cash for futures margin and any temporarily univested cash in other accounts. I do exclude some cash I hold as a buffer, since that can't be invested. 

The bottom line is 8.2% vs the Vanguard 60:40 benchmark of +3.8%. Dividends were 3.2% (less than the 4% before since the capital base is larger, including the dividend cash). Here's the history:

2015 - 2016 XIRR 14.4%, benchmark   0.1%
2016 - 2017 XIRR 18.2%, benchmark  19.3%
2017 - 2018 XIRR  0.6%, benchmark   1.3%
2018 - 2019 XIRR  4.4%, benchmark   7.2%
2019 - 2020 XIRR -6.6%, benchmark -10.5%
2020 - 2021 XIRR 27.9%, benchmark  21.0%
2021 - 2022 XIRR  8.2%, benchmark   3.8%

Std. dev        Me 11.7%  benchmark 10.9%

Mean            Me 9.1%   benchmark 5.9%

Sharpe Ratio    Me 0.78   benchmark 0.54       

Geometric mean  Me 8.6%  benchmark  5.4%


Note: My historic figures include the 'equity hedge' part of my portfolio which I used to have prior to this year. 

As you can see the standard deviations above are fairly close, so it seems appropriate to continue using Vanguard 60:40 as the benchmark for this part of my portfolio. The correlation - with only six observations - is 0.96. I have had three years of underperformance, followed by three years of outperformance. I'm ahead, but probably not enough to be statistically significant. Of course the latter three years span the whole COVID crisis plus Ukraine; I don't know if that is important.


Summary

It's worth briefly reviewing my plans from last year:


 I've brought some more rigour to my methodology (in the form of the model portfolio) and also done some cleaning and tidying to simplify things (removing the equity hedge).

 UK stockpicking has obviously done well, but I have no interest in substantially increasing the size of my book here, that's now up to 25 names and is also a fraction over it's tactical target allocation. 

There are 24 names listed above, although I just bought another post the end of year so that's going well. The allocation has been fairly constant.

I'm happy with my new model portfolio based approach to managing my ETF exposure; now much more formally in line with the sort of thing outlined in Smart Portfolios, and only a few minutes of work every month to keep updated. 

I'm currently in the middle of a massive refactoring of my pysystemtrade research code; once completed I hope to research and implement some new futures trading systems. Watch this space!


For this year, as I've already mentioned, I am doing some more cleaning up by making one account a pure UK stock picking account. On the futures side I'm hoping to implement some of the new trading strategies I have been researching as part of my new book, which I'm going to go back to writing once I press 'pubish'.



Friday, 2 July 2021

Talking to the dead / simple heuristic position selection / small account problems - part four / EPIC FAIL #2

 Over the last few posts I've been grappling with the difficulties of trading futures with a retail sized account. I've tried a couple of things so far - a complex dynamic optimisation (here and here) where I try and optimise the portfolio every day in the knowledge that I can only take integer positions, and then a simpler static approach where I try to pick the best fixed set of instruments to trade given my account size - and then trade them.

In this post I return to a dynamic approach (choosing the best positions to hold each day from a very large set of instruments), but this time I'm going to use much simpler heuristic methods. I use the term heuristic to mean something you could explain to an eldery relative: let's call them Auntie Barbara.

I used to have an Auntie Barbara, but she died a long time ago. If there is an afterlife, and if they have internet there, and if she subscribes to this blog: Hi!




I've written this post to be fairly self contained (I can't really expect Auntie Barbara to read all the previous posts, she will be too busy playing tennis with Marilyn Monroe or something) and also a bit simpler than the previous three to follow.



The setup


Here's the setup again. I have a universe currently of 48 futures markets I'd like to trade (for now - in practice I'm adding new instruments every few days, and in an ideal world there are around 150  I'd like to trade if I could). If I backtest their performance it looks great (this is just with the set of trading rules in chapter 15 of my book, 3 EWMAC + carry; but I do allow the instrument weights to be optimised):



That's a Sharpe Ratio of 1.18, pretty good for two trading rules (ewmac and carry). Oh the power of diversification...

Not only does it make money, it also (on average) has good risk targeting. Here's the rolling annualised standard deviation (which come in at 22.2% on average, slightly under the target)




Auntie Barbara (AB): "Great! You always were a little smart alec. Can I get back to my jacuzzi now? I've got James Dean and Heath Ledger waiting for me."

* Auntie is communicating with me from the spirit world via telnet, hence the Courier typeface

Sorry Auntie, I cheated slightly there. That's the performance if I can take fractional futures positions, o equivalently what I could do with many millions of dollars. 

This is what it looks like if I trade it with $100K (about £80K: this particular FX rate is roughly unchanged since my Auntie died)

I normally use $500K for these tests - but I'm trying to make the results starker.

AB "Why does it start going wrong, weirdly, not long after I've died? Are you saying this is my fault?"


Not at all! No, to begin with there are only a few instruments in the data. Then as more are added, we struggle to take positions in every instrument due to rounding. We end up with many instruments that have no position at all; the positions we end up making (or losing money) from just happen to be those with relatively small contract sizes. 

So the portfolio becomes more concentrated, and in expectation (and also in reality here), has worse performance. It also undershoots it's risk due to all that 'wasted' capacity of the instruments which can't take a position. There are many instruments here that we are just collecting data for, but can't hope to ever take a position in.

Now look at the rolling realised standard deviation again:


We're systematically undershooting, especially in more recent years when I have a lot more instruments in the dataset. The risk is also 'lumpier', reflecting the close to binary nature of the system.


AB "Hang on, I've just read your last couple of posts again. Or tried to. What happens if you do some kind of fancy dynamic optimisation on your positions each day?"

That doesn't work and is way too complicated.

AB "And what if you just select a group of markets and trade with those?"

Well if I use the 16 instruments I identified in my last post  as suitable for a $100K account I get these results:


Fewer markets is handicapped by having later starting data, but if I account for that:


AB "When does that data start now?"

The 11th May 1974

AB "Ah - that's your birthday. Coincidence?"

Well actually the data starts on 22nd April 1974, but that's close enough.

That feels slightly like cheating since they're identified using some forward looking information, but if I selected any 16 instruments on a rolling basis using any vaguely sensible methodology I'd expect on average to get similar results.

Basically we make up some of the ground on the full 40+ instrument portfolio compared to the rounded situation, but we never quite manage it (although the green curve looks as good, it's actually got a lower SR and underperforms in more recent years as we get more and more instruments in the full portfolio). In expectation 16 instruments, no matter how carefully chosen, will underperform 50; never mind 150.



The simplest possible approach?


AB "Well it's obvious what you should do"

Is it?

AB "Do you remember when you were a boy, and you'd invite all your friends to your birthday parties?"

I'm 47 Auntie Barbara. I'm not 100% sure what I did last thursday.

AB "Well just bear with me then. Suppose you had 50 friends, and you could only invite 16 to your party. What would you do?"

I'd.... well I'd pick my favourite 16 friends (this is hypothetical! What kind of person has fifty 'friends'?).

AB "Now suppose you had a birthday party every single day. What would happen?"

Well... I suppose I'd pick whoever was my favourite 16 friends on that day. But, with respect, what on earth, (sorry insensitive), what the hell (worse!),  what in heaven does this have this to do with the problem at hand.

AB "Hasn't the penny dropped yet? I thought you were a smart alec."

OK it has finally dropped. What I need to do is just hold positions in the 16 instruments that have the strongest absolute forecast on that day.

AB "Someone give the boy a medal"



I choose to ignore that. Let's see some code:


class newPositionSizing(PositionSizing):

@output()
def get_subsystem_position(self, instrument_code: str) -> pd.Series:
all_positions = self.get_pd_df_of_subsystem_positions()
return all_positions[instrument_code]

@diagnostic()
def get_pd_df_of_subsystem_positions(self) -> pd.DataFrame:
all_forecasts =self.get_all_forecasts()
list_of_dates =all_forecasts.index

list_of_positions = []
previous_days_positions = portfolioWeights()
p=progressBar(len(list_of_dates))
for passed_date in list_of_dates:

positions = self.get_subsystem_positions_for_day(passed_date, previous_days_positions)
list_of_positions.append(positions)
previous_days_positions = copy(positions)
p.iterate()

p.finished()

df_of_positions = pd.DataFrame(list_of_positions)
df_of_positions.index = list_of_dates

return df_of_positions

def get_subsystem_positions_for_day(self,
passed_date: datetime.datetime,
previous_days_positions: portfolioWeights = arg_not_supplied) -> portfolioWeights:

if previous_days_positions is arg_not_supplied:
previous_days_positions = portfolioWeights()
forecasts = self.get_forecasts_for_day(passed_date)

initial_positions_all_capital = self.get_initial_positions_for_day_using_all_capital(passed_date)

positions = calculate_positions_for_day(previous_days_positions = previous_days_positions,
forecasts = forecasts,
initial_positions_all_capital = initial_positions_all_capital)
list_of_instruments = self.parent.get_instrument_list()
positions = positions.with_zero_weights_for_missing_keys(list_of_instruments)

return positions


def get_initial_positions_for_day_using_all_capital(self,passed_date: datetime.datetime) -> portfolioWeights:
all_positions = self.get_all_initial_positions_using_all_capital()
all_positions_on_day = all_positions.loc[passed_date]

return portfolioWeights(all_positions_on_day.to_dict())

def get_forecasts_for_day(self, passed_date: datetime.datetime)->portfolioWeights:
all_forecasts = self.get_all_forecasts()

todays_forecasts = all_forecasts.loc[passed_date]

return portfolioWeights(todays_forecasts.to_dict())

@diagnostic()
def get_all_forecasts(self) -> pd.DataFrame:
instrument_list = self.parent.get_instrument_list()
forecasts = [self.get_combined_forecast(instrument_code)
for instrument_code in instrument_list]

forecasts_as_pd = pd.concat(forecasts, axis=1)
forecasts_as_pd.columns = instrument_list
forecasts_as_pd = forecasts_as_pd.ffill()

return forecasts_as_pd

@diagnostic()
def get_all_initial_positions_using_all_capital(self) -> pd.DataFrame:
instrument_list = self.parent.get_instrument_list()
positions = [self.get_initial_position_using_all_capital(instrument_code)
for instrument_code in instrument_list]

positions_as_pd = pd.concat(positions, axis=1)
positions_as_pd.columns = instrument_list
positions_as_pd = positions_as_pd.ffill()

return positions_as_pd


@diagnostic()
def get_initial_position_using_all_capital(self, instrument_code: str) -> pd.Series:

self.log.msg(
"Calculating subsystem position for %s" % instrument_code,
instrument_code=instrument_code,
)

inital_position = self.get_volatility_scalar(instrument_code)

return inital_position


This code actually contains some future proofing, in that it is written for path dependence in positions - which we're not actually going to use yet. 



def calculate_positions_for_day(previous_days_positions: portfolioWeights,
forecasts: portfolioWeights,
initial_positions_all_capital: portfolioWeights):

## Get risk budget per market
##
risk_budget_per_market = proportionate_risk_budget(forecasts)
maximum_positions = int(1.0 / risk_budget_per_market)
idm = min(maximum_positions**.35, 2.5)
idm_with_risk = risk_budget_per_market * idm

initial_positions = signed_initial_position_given_risk_budget(initial_positions_all_capital,
forecasts = forecasts,
risk_budget=idm_with_risk)

list_of_tradeable_instruments = tradeable_instruments(initial_positions=initial_positions,
forecasts=forecasts)

current_instruments_with_positions = []

## Sort markets by abs strength of forecast
## Iteratively from strongest to weakest:
list_of_instruments_strongest_forecast_first = \
sort_list_of_instruments_by_forecast_strength(forecasts=forecasts,
instrument_list=list_of_tradeable_instruments)

for instrument_to_add in list_of_instruments_strongest_forecast_first:
## If already have position, keep it on - wouldn't be in this list
if len(current_instruments_with_positions)<maximum_positions:
## If haven't got a position on, and risk budget remaining, add a position
current_instruments_with_positions.append(instrument_to_add)
continue
else:
## If no markets remain with current positions in could be removed group, halt
break

new_positions = fill_positions_from_initial(current_instruments_with_positions=current_instruments_with_positions,
initial_positions=initial_positions)

return new_positions


Most of that should be self explanatory, the 'initial' position (perhaps badly named) is the position the system would want to take if we put all of our trading capital into that single instrument. We then scale that by a risk budget, which is equivalent to an 'instrument weight' that here is just 1/N (N is the number of assets we're currently trading), with a lower limit of 6.25% (to avoid having no more than 16 positions; this value can be tweaked depending on your capital), and an IDM calculated as N^0.35 (note if all subsystems had zero correlation this would be N^0.5, so this is a reasonable approximation), with my normal limit of IDM=2.5


def proportionate_risk_budget(forecasts: portfolioWeights):
market_count = market_count_in_forecasts(forecasts)
proportion = 1.0/market_count

use_proportion = max(proportion, 1.0/16)

return use_proportion

Now a 'tradeable' instrument is one with a non na forecast, but also a position that is equal to a single contract or more. No point wasting risk capital on a position that isn't at least one contract.

AB "No point inviting a kid to the party who can't come. That's a waste of an invitation."


Indeed.

def tradeable_instruments(initial_positions: portfolioWeights,
forecasts: portfolioWeights):
## Non tradeable instruments:
## We don't open up new positions in non tradeable instruments, but we may
## maintain positions in existing ones

valid_forecasts = instruments_with_valid_forecasts(forecasts)
possible_positions = instruments_with_possible_positions(initial_positions)

valid_instruments = list(set(possible_positions).intersection(set(valid_forecasts)))

return valid_instruments

def instruments_with_valid_forecasts(forecasts: portfolioWeights) -> list:
valid_keys = [instrument_code
for instrument_code, forecast_value in forecasts.items()
if _valid_forecast(forecast_value)]
return valid_keys

def _valid_forecast(forecast_value: float):
if np.isnan(forecast_value):
return False
if forecast_value==0.0:
return False
return True

def instruments_with_possible_positions(initial_positions: portfolioWeights) -> list:
valid_keys = [instrument_code
for instrument_code, position in initial_positions.items()
if _possible_position(position)]
return valid_keys

def _possible_position(position: float):
if np.isnan(position):
return False
if abs(position)<1.0:
return False

Let's have a gander at what this thing is doing:




I've zoomed in to the end of this plot, which shows positions for Eurodollar at various stages. The blue line shows what position we'd have on without position rounding, and with a fixed capital weight of 6.25% (equal weight across 16 instruments) multiplied by the IDM (2.5 here). The orange line - which is mostly on the blue line - shows the position we'd have on without rounding, once we've applied the 'You need to have one of the 16 strongest forecasts to come to the party' rule (I need a catchier name).

So for example between March and mid April this goes to zero, as the forecast weakens.

 Finally the green line shows the rounded position, once I've applied my usual buffering rule. You can see that's mostly a rounded version of the orange line.




OK. It's not great, although the last 10 years is pretty good. Also the vol targeting is somewhat poor:




... coming in at an average of 12% a year. 




Horrible path dependence



Let's turn our attention first to the poor performance. Some of that is due to costs; which go up from around 10bp of SR in the large and reduced benchmarks, to 26bp of SR. As I've said many times before, pre-cost performance is (to an extent) random but costs are predictable. Not a surprise when a forecast going from being ranked 16th best to 15th best will result in a trade; and then possibly the next day the same position being closed.


AB "It seems unfair to kick someone out of the party, just because they've gone from being your 15th to 16th favourite friend. Maybe you should let kids stay until they are really not your friends anymore."



OK, let's try it. I propose the following rule (bear in mind that my forecasts are scaled such that a forecast of +10 is an average long):
  • If we have a position, and the absolute forecast is more than 5, then hang on to it.
  • If we don't have a position, and the absolute forecast is more than 5 then try to open a new position. Starting with the instuments with the highest forecasts:
  • If we already have the maximum number of positions open, then:
    • For instruments that have open positions, starting with the lowest forecast close the position and replace it with the new instrument.
    • Do not close a position if the absolute forecast is more than 5. 
    • Once all possible positions (absolute forecast<5) have been closed, do not open any new positions

So:
  • Absolute forecasts greater than 10:
    • Existing position: won't be closed
    • New position: probably will be opened
  • Absolute forecasts between 5 and 10:
    • Existing positions: won't be closed
    • New positions: may be opened
  • Forecasts less than 5:
    • Existing positions: may be closed


def calculate_positions_for_day(previous_days_positions: portfolioWeights,
forecasts: portfolioWeights,
initial_positions_all_capital: portfolioWeights):

risk_budget_per_market = proportionate_risk_budget(forecasts)
maximum_positions = int(1.0 / risk_budget_per_market)
idm = min(maximum_positions**.35, 2.5)
idm_with_risk = risk_budget_per_market * idm

initial_positions = signed_initial_position_given_risk_budget(initial_positions_all_capital,
forecasts = forecasts,
risk_budget=idm_with_risk)

list_of_tradeable_instruments = tradeable_instruments(initial_positions=initial_positions,
forecasts=forecasts)

current_instruments_with_positions = from_portfolio_weights_to_instrument_list(previous_days_positions)

## forecast less than +5 or non tradable (could be removed)
list_of_removable_instruments = removable_instruments_with_positions_weakest_forecasts_last(current_instruments_with_positions,
forecasts=forecasts)
## ordered by weakness of forecast

## Sort markets by abs strength of forecast
## Iteratively from strongest to weakest:
list_of_instruments_with_no_position_strongest_forecast_first = \
instruments_with_no_position_strongest_forecast_first(
list_of_tradeable_instruments=list_of_tradeable_instruments,
forecasts=forecasts,
current_instruments_with_positions=current_instruments_with_positions)

for instrument_to_add in list_of_instruments_with_no_position_strongest_forecast_first:
## If already have position, keep it on - wouldn't be in this list
if len(current_instruments_with_positions)<maximum_positions:
## If haven't got a position on, and risk budget remaining, add a position
current_instruments_with_positions.append(instrument_to_add)
continue

elif len(list_of_removable_instruments)>0:
## If haven't got a position on, and no risk budget remaining,
## Remove position from market with current position and weakest forecast in 'could be removed' group
instrument_to_remove = list_of_removable_instruments.pop()
current_instruments_with_positions.remove(instrument_to_remove)
current_instruments_with_positions.append(instrument_to_add)
continue
else:
## If no markets remain with current positions in could be removed group, halt
break

new_positions = fill_positions_from_initial(current_instruments_with_positions=current_instruments_with_positions,

initial_positions=initial_positions)

return new_positions

def from_portfolio_weights_to_instrument_list(positions: portfolioWeights):
instrument_list = [instrument_code for instrument_code, position in positions.items()
if _valid_position(position)]
return instrument_list

def _valid_position(position: float):
if np.isnan(position):
return False
if position==0.0:
return False

return True

def removable_instruments_with_positions_weakest_forecasts_last(current_instruments_with_positions: list,
forecasts: portfolioWeights):
instrument_with_weak_forecasts = instruments_with_weak_or_non_existent_forecasts(forecasts)
instruments_with_positions_and_weak_forecasts = list(set(current_instruments_with_positions).intersection(instrument_with_weak_forecasts))

instruments_with_positions_and_weak_forecasts_weakest_forecast_last = \
sort_list_of_instruments_by_forecast_strength(forecasts,
instruments_with_positions_and_weak_forecasts)

return instruments_with_positions_and_weak_forecasts_weakest_forecast_last


def instruments_with_weak_or_non_existent_forecasts(forecasts: portfolioWeights) -> list:
weak_forecasts = [instrument_code
for instrument_code, forecast_value in forecasts.items()
if _weak_forecast(forecast_value)]
return weak_forecasts

def _weak_forecast(forecast_value: float):
if np.isnan(forecast_value):
return True
#FIXME SHOULD COME FROM SYSTEM HARD CODING IS THE DEVILS WORK
if abs(forecast_value)<5.0:
return True
return False

def sort_list_of_instruments_by_forecast_strength(forecasts: portfolioWeights,
instrument_list) -> list:

tuples_to_sort = [(instrument_code,
_get_forecast_sort_key_given_value(forecasts[instrument_code]))
for instrument_code in instrument_list]
sorted_tuples = sorted(tuples_to_sort, key=lambda tup: tup[1], reverse=True)
list_of_instruments = [x[0] for x in sorted_tuples]

return list_of_instruments

def _get_forecast_sort_key_given_value(forecast_value:float):
if np.isnan(forecast_value):
return 0.0
return abs(forecast_value)

def instruments_with_no_position_strongest_forecast_first(forecasts: portfolioWeights,
current_instruments_with_positions: list,
list_of_tradeable_instruments: list):

tradeable_instruments_setted = set(list_of_tradeable_instruments)
tradeable_instruments_setted.difference_update(current_instruments_with_positions)
instruments_with_no_position = list(tradeable_instruments_setted)
list_of_instruments_with_strong_forecasts = instruments_with_strong_forecasts(forecasts)

list_of_instruments_with_strong_forecasts_and_no_position = \
list(set(instruments_with_no_position).intersection(set(list_of_instruments_with_strong_forecasts)))

sorted_instruments = sort_list_of_instruments_by_forecast_strength(forecasts=forecasts,
instrument_list=list_of_instruments_with_strong_forecasts_and_no_position)

return sorted_instruments

def instruments_with_strong_forecasts(forecasts: portfolioWeights) -> list:
strong_forecasts = [instrument_code
for instrument_code, forecast_value in forecasts.items()
if _strong_forecast(forecast_value)]
return strong_forecasts

def _strong_forecast(forecast_value: float):
if np.isnan(forecast_value):
return False
#FIXME SHOULD COME FROM SYSTEM
if abs(forecast_value)<5.0:
return False
return True

That improves things a little; the cost comes down to 20SR units. But that's still a lot - about double what it is in the benchmark cases.

Let's restrict our universe of instruments we can consider adding to forecasts over 10, rather than over 5. Then we have:

  • Absolute forecasts greater than 10:
    • Existing position: won't be closed
    • New position: probably will be opened
  • Absolute forecasts between 5 and 10:
    • Existing positions: won't be closed
    • New positions: won't be opened
  • Forecasts less than 5:
    • Existing positions: may be closed
This creates a 'no trade zone' for forecasts between 5 and 10.

.... and makes almost no difference; lowering the costs by 1 SR unit.

Clearly I could play with these boundaries until I got a nicer result, but this reeks of implicit fitting and I feel the gap is just too large.


Some other things we could try


There are more complicated things we could do here, for example considering diversification when adding potential instrument positions, allocating the risk bucket by asset class or instrument cluster, perhaps a more sophisticated approach to costs.... but I think we'll just end up in the bad old world of complex dynamic optimisation that I narrowly escaped from in the second post. 


Conclusion


I feel this particular dead horse has been flogged enough. There is no easy way to get around the problem of having insufficient capital to trade loads and loads of futures markets. Any kind of dynamic optimisation, eithier by simple ranking (this post), or complex formula (posts 1 and 2) just isn't very effective, and involves making the nice simple straightforward trading system very ugly indeed.

By far the simplest approach is to sensibly choose some subset of those markets, and use those as your static set of instruments as I did in post #3 of this series. This also happens to be the best performing option in a backtest. For the $500K of capital that I have the effect on performance is fairly minimal in any case.

Yes there will FOMO if an instrument I don't own shows a seriously good trend, but I will just have to live with that.

Things are clearly tougher if you only have $100K or less, but then as my third book points out maybe you should be trading other leveraged instruments.

My personal 'to do' list now consists of tactically reweighting my portfolio towards the 28 instruments I found to be optimal for my account size here, and putting into place the technology to allow regular (annual?) reviews of my set of instruments.

Thanks for your help Auntie B.

AB "You're welcome. And I hope for your sake that the Jacuzzi is still warm."