Market stats

It’s time for me, once again, to compile a list of stats for the market, using what I hope is a reliable data source. Here are the results:

DATE          --------------PBV-------------     --------------PER---------------
               P20   P40   P50    P60   P80      P20    P40    P50    P60    P80
14-Nov-2018   0.97  1.69  2.17   2.80  5.14     8.31  11.82  13.63  15.93  23.01
14-Nov-2017   1.11  2.04  2.63   3.52  6.55     9.07  13.87  15.91  18.32  25.50
14-Nov-2016   1.09  1.82  2.33   3.03  5.40     8.42  12.97  14.73  16.61  23.01
04-Nov-2015   1.16  1.92  2.54   3.12  5.30    10.30  13.83  15.62  17.40  23.09
08-Nov-2014   1.12  1.75  2.20   2.77  4.65    10.30  13.58  14.96  16.58  21.83
05-May-2014   1.23  1.93  2.39   3.10  5.06    11.66  14.73  16.37  18.11  22.77
06-May-2013   0.85  1.34  1.71   2.19  4.12    -1.27  10.87  12.77  14.51  20.09
21-Nov-2010   1.13  1.88         2.76  4.93



As you can see, the median PE is 13.63, slightly less than the long-term average. I am therefore happy that the UK market is not over-valued.

Posted in Uncategorized | Leave a comment

Magic Hat Portfolio: SOM stays in

The MHP (Magic Hat Portfolio) has taken a dive over the last month, and I thoroughly expected it to have under-performed the indices. To my surprise, it has actually done relatively well over the short term: 1-week, 1-, 3- and 6- months.

SOM is due for ejection from the protfolio this month, but I have decided to be lazy and keep it in, despite it not passing the Greenblatt Screen. However, it does have a Magic Formula Score of A+, a PE less than 12, a yield above 5%, and a Stockopedia StockRank of 94.

That will do for me.

The support level for the indices seems to have held, so I would expect a quick recovery, at least in the short-term. Valuation levels seem reasonable, so I am actually sanguine about the state of the market. I am, of course, disappointed that I am nursing a loss.

No-one knows what the future will bring, and for all anyone knows we still have further substantial falls on the cards. In my view, that’s not the way to bet, though.

Stay safe out there.

Posted in Uncategorized | Leave a comment

Ubuntu is the best all-round distro

Ubuntu 18.10 was out yesterday, and it’s quite a pleasant distro.

Ubuntu’s look is good, certainly much better than the hideous brown they had for many years. It looks better than Windows 7 by default. I have only interacted with Windows 10 once, and I found it to look quite good, too. I doubt that I will ever install it on my machine, though. The horror stories I have heard make me want to avoid it.

I have even grown to tolerate Ubuntu’s default desktop. I hated it for a long time, but now find it acceptable. I think there are more usable window managers out there. I think the flatter icons are a step down from their previous design, which were about the best I have seen and could hope for.

As Alan Kay once said, the problem with computing is that it’s a pop culture rather than a real engineering discipline. There’s too much fad-chasing.

Ubuntu is often considered a “beginner” distro, and not for “professional” use. Whilst it certainly is beginner-friendly, I don’t see how it would be considered unprofessional. Ubuntu, for the most part, Just Works (TM). Why waste time fiddling around when I can get something useful out of the box.

I have tried many distros in the past, including:

  • Arch: my second-favourite Linux distro. It is a rolling-release distro, and I actually find it the most stable. You need to do jiggering around with Arch than you do with Ubuntu, though.
  • Debian: pretty good, although rather behind the curve
  • Fedora: this distro is an abomination. Every time I have installed it, I have regretted it. It’s too much cobbled-together half-broken junk. I hesitate to say all this, because I just know that the advocates will come up with a bunch of rationales as to why they think I’m wrong. I’m not going to rehash their arguments, suffice it to say, my answer is still “no.”
  • Mint: tried it, and liked it. I don’t really have anything bad to say about it, and it’s been a long time since I have actually used it. It’s a perfectly fine distro
  • OpenSuse: can’t see the point. It was OK, but it didn’t have many of the packages I was interested in.
  • Slackware: my third-favourite Linux distro. It’s solid, but dependency management is tedious. I am aware of apps than can help here, but still, it’s more work than I would care for

What Ubuntu offers is ease-of-use and a large collection of up-to-date software. It may not the absolute latest version, but it’s close enough. I like the Aptitude package management system, and it seems faster than some of the other systems I have tried. You can also get proprietary software and drivers for it. I am not puritanical.

Downsides? Well, it’s unlikely to be as fast as Arch or Slackware, nor as stable. I wish it wouldn’t ask to send crash reports, either.

Posted in Uncategorized | Leave a comment

Forth equivalence

Suppose you have

: myword do something useful ;


s” myword” find-name name>int execute

is the same as


Works in gforth.

Posted in Uncategorized | Leave a comment

Magic Hat Portfolio: TMMG in, CCT out

CCT leaves the portfolio by rotation, having lost 0.4% during its tenure. It has been in the portfolio for 3 years. The FTSE350 has risen 15.8% during that period, so the performance of CCT has been disappointing.

TMMG enters the portfolio, having a Stockopedia StockRank of 97. Let’s hope this proves to be a greater success.

Looking at Stockopedia, the FTSE350 has a trailing PE of 14.7, the FT250 is on 14.3, the FT100 is on 15.0, the Small Caps ex ITs is on 13.8, the Techmark All Share is on 19.7, and the AIM All Share is on 18.4.

Broadly speaking, then, the UK markets look in completely safe territory to me, and I am not concerned with valuation levels.

Russia is on a CAPE of 6.8 and a PE of 7.0, so it’s looks like great value to me.

The US looks to be in bubble territory, with a CAPE of 31.9 and a PE of 21.7.

There can, of course, be no guarantees as to how the UK market will move. Some random event may tip the market lower. The UK markets have been rather lack-lustre over the year, and I get the impression that many have had unspectacular portfolio performances.

Like I say, I’m sanguine about the state of the market. Who knows, if we get this Brexit thing sorted out, the market might actually go up on account of the UK being “derisked.” I am talking about market perceptions here, not what I actually believe. I think that the pros, in particular, are overly-concerned about “riskiness” and “uncertainty” of the markets. The problem with that way of thinking is, in my view, that you never really know what’s going to happen, and that market valuation is a factor in determining “riskiness”.

What may look risky may be safe, and what looks safe becomes risky. There are two examples I can readily think of: the euphoria of 1999, and the collapse in 2008/9. In 1999, particularly the US, we had a “Goldilocks” economy, and everything was perceived as safe, in which books like “Dow 36,000” was published. Needless to say, everything subsequently went tits up. Then, in 2008, when everything was going wrong, stocks were trading at levels that proved to be an absolute bargain.

So you just cannot rely on general opinion to determine what is going to happen next. If anything, general consensus is a contrarian indicator. As one commentator noted: the market will do whatever it takes to prove the majority wrong.

Stockopedia reports that there are 1578 shares below their 200dMA, as opposed to 1054 above it. So shares have been struggling, and we’re not yet seeing signs of any kind of recovery. The market is one of malaise rather than dramatic movements at the moment. At the end of March 2018, the FT100 was on 6921, below its 1999 peak. There was a quick recovery, but the market seems to have come off the boil from May 2018. It does look suspiciously like it wants to test the March lows.

You can see, from the above, that the mid-caps are on a similar valuation to the large-caps, despite the fact that the mid-caps have done rather well over extended periods of time. It does seem a good general rule that, valuation levels being the same, you’ll likely do much better in the mid-caps, and possibly small-caps, than you will in the large-caps. Despite portfolio managers concentrating their efforts on the big guns, it is not, in general, a particularly good area to invest in. My own theory is that the large caps are quite often over-indebted, have poor returns on capital, and are perhaps at the peak of their form, from which the only place to go is down.

I can’t be bothered to proofread this post. I’d rather watch my DVD of Better Call Saul, series 3. Gotta pace myself, as it’s too easy to binge-watch.

So anyhoo, stay safe out there.

Posted in Uncategorized | Leave a comment

A test pattern for ultimc

File test.4th:


0 0 850 700 99 FBRECT # blue square
600 50 400 600 990000 FBRECT # red square
100 100 600 500 9900 FBRECT # green square

The output will look like:

Posted in Uncategorized | Leave a comment

Forth DSL example

Forth is a language, like Lisp, that has a certain fascination for me. I’ve tried Forth a few times, but have always gone back to other languages. Recently I tried creating a Forth myself as a learning exercise: ultimc [1]. It compiles on Linux, Windows (theoretically), and under the Ultibo [2] unikernel for a bare metal Raspberry Pi Forth.

Creating my own Forth has taught me a lot about the language, and really made me understand the way it works. In this post, I am going to peer a little under the hood to show that Forth, like Lisp, has a secret sauce that you just don’t get with most other languages. Maybe it will excite you a little as to the unique possibilities of Forth.

Recently I came across some Forth code [3] that was as follows:


Notice how there’s a lot boilerplate code there: “0 constant:”, “1 constant:”, etc. Wouldn’t it be nice to write something like:


and have Forth “do the right thing”. Well, let’s see …

Here’s the code, written in gforth:
variable enum \ the current enumerated value, starting at 0
: enum++ enum @ dup 1+ enum ! ; \ increment enum, leaving the original enum value on the stack
: >enum nextname enum++ constant ; \ Given a name, set it to the value of enum as a constant
: enum1 parse-word dup if >enum 0 else 2drop 1 then ; \ scan the input buffer, and call >enum if legit
: enum: begin enum1 until ; \ keep going until the input buffer is exhausted

Just 5 lines of code, although admittedly it did take me a lot of time to figure out. The code needs a little elaboration.

PARSE-WORD and NEXTNAME act a little bit like CREATE, except that PARSE-WORD gets the next word from the input buffer, and NEXTNAME creates a word from the input buffer.

Now, if we’re at the end of the buffer PARSE-WORD returns a zero length string. This is what ENUM1 checks for. It only calls >ENUM if the string has at least 1 character. What it returns on the stack is the value 0 to signify success, and 1 to signify failure.

ENUM: then just loops around until the value 0 appears on the stack, implying that the input buffer is exhausted.

Let’s test it, using more condensed names:

enum: foo bar baz

And check our handiwork:

foo . bar . baz . \ outputs: 0 1 2

Can your language do that?


Posted in Uncategorized | Leave a comment