Magic Hat – LAM increased, SHOS sold, DTG reduced

The MHP (Magic Hat Portfolio) on Stockopedia ( is an experiment by me to see if a human can improve on a mechanical Greeblatt Magic Formula screen. I am trying to weed out “mistakes” that I feel the screening commits: unseasoned companies, scams, foreign companies (particularly Chinese), fishy accounting, and statistical quirks. Apart from that, I am agnostic as to the sector the company operates in, although I will try to avoid heavy concentration in any one sector. I will mostly apply “Strategic Ignorance”, by which I mean that I wont try to be clever in my stockpicking. My picking will be mostly mechanical. A summary of most of my Magic Hat articles can be found on the web page This will allow you to see, at a glance, what shares have been bought and sold in the past, as well as what shares have been rejected from consideration and why.

Well, what a month January has been! My portfolio lost 6.8%, compared with the ASX (All-Share) of 7.4%. Mid-month, I decided I was too obsessed with stock market movements, and so switched my attention to other things. When I looked at my performance this morning, I was relieved to find that my portfolio had improved, rather than worsened.

My spent my time programming in Fortran again. GFortran has some neat features, and makes Fortran a truly usable programming language. Many of the features of the latest Fortran standards are included, and it has a lot of convenience. Fortran will never have closures though, which can be very useful.

SHOS (Sears Hometown and Outlet Stores) was kicked out of the portfolio by rotation. It lost 41% over the year, which is not good. It was originally purchased as a net-net. So, buying net-nets is clearly no guarantee of beating the index.

LAM (Lamprell) was also due to be kicked out the portfolio by rotation, except that it now qualifies for the Greenblatt screen over on Stockopedia. LAM shows an EV/EBITDA of 0.91, which is absurdly low. A director had made purchases worth £166k at around 103p in May 2015. LAM is a “provider of fabrication, engineering and contracting services to the offshore and onshore oil and gas, and renewable energy industries.” It has been hit hard by sentiment in the Oil & Gas industry.

On 26.1.2016, LAM announced ( that a subsidiary had signed an MOU (Memorandum Of Understanding) with Saudi Aramco for a partnership agreement on establishing a Maritime Complex in Saudi Arabia.

It is impossible to call the bottom on oil prices, of course, but things aren’t all doom and gloom at LAM. If oil picks up, we could find LAM shares doing well. Nothing is guaranteed, which is why the MHP has a number of shares, rather than bets the farm on just a couple.

To bring LAM up to a full size holding, some DTG was sold. I was far to top-heavy in airlines, so it made sense to dial things back a little.

That’s all for now. Peace.

Posted in Uncategorized | Leave a comment

Thoughts on #Fortran versus

Lately I have been helping with the packaging of milancurcic’s datetime-fortran module ( I needed it because I wanted to turn dates into indices.

I am taking a decade’s worth of Yahoo share data in CSV format, and stuffing it into a NetCDF file. It turns out that parsing the CSV file is relatively straightforward in Fortran. There’s no need for additional libraries. I chose NetCDF over HDF5 format because the latter was too much effort. Fortran’s interface to NetCDF has worked for me so far, although admittedly I haven’t played with the string functionality. That may prove to be more problematical.

One problem that faces many Fortran programmers is knowing array size at the outset. My solution so far is to overallocate the space I need, and, possibly, return an allocated array of the correct size with a copy of the data. It is not necessarily a general solution under all circumstances, but it is likely to be a good solution under most circumstances. Fortran will automatically deallocate the array for me (yeah Fortran!), and obviate the need to pass back array size explicitly.

I think the watchwords on Fortran are to use solutions which work, and avoid premature optimisation. I have said this before, and I’ll say it again: all programmers should be forced to work in Fortran for five years to teach them to solve problems in obvious and simple ways.

To give an example, a few years back I was working on some hydrocarbon allocation problems. The original code was written in Fortran. The data was in a file, for which the developers had a “mask”. Basically, the data file consisted of a number of arrays, with one number per line. So if you have arrays arr1, arr2, etc. you can read this file in using a single read statement: read(unit=whatever, fmt=*) arr1, arr2
That’s it! Done! Fortran just gives me that right out of the box. No other programming language is likely to be that simple.

I overheard an outside consultant talk about enhancing the system, probably using Java or somesuch. His solution was something along the lines “well we can always output extra values in XML”. Think how complicated that is! Now if I want to read in values I’m going to need an XML library.

I have found, too, especially when trying to wrangle data from third parties, that there’s rarely such a thing as “straightforward”. Murphy’s Law dictates that what can go wrong, will go wrong. Input data can have a lot of quirks to them. Even with high-level languages like Python, it seems that data providers devise obfuscations to subvert even good-quality libraries.

Fortran is usually more verbose than Python. It doesn’t necessarily “have” to be. You can let Fortran make assumptions about the types of your variables, but the general consensus is “don’t do that!”. So Fortran code might have something like real(kind=8), intent(out) :: foo
in a subroutine. This tells the compiler that you definitely want foo to be a 64-bit real. The “intent(out)” is completely optional, but it makes it clear to the compiler that foo is an output variable for the subroutine, and it automatically tells someone who is interested in your subroutine that it is an output. No-one is left in any doubt about what is expected to happen.

I think that, often, in the end, programming in Fortran is no more difficult or time-consuming than other languages. I wouldn’t necessarily use if for everything. Sometimes a bash script can be more effective. But do use a modern Fortran. Restricting yourself to Fortran-77 is making a rod for your own back.

People need to stop thinking that Fortran in terms of Fortran 77, and start thinking about more modern standards.

Go Fortran!

Posted in Uncategorized | Leave a comment

coprocesses in bash using dc as an example

Coprocesses are a feature of bash which allow you to communicate with the stdin and stdout of a subprocess. I illustrate this by having a bash script to interact with “dc”, the arbitrary precision calculator, to sum up a sequence of floats to produce an output of running balances:

#!/usr/bin/env bash
# example of using coprocesses with dc

coproc mydc { dc; } # run process dc, calling it `mydc'

# define convenience functions for writing/reading to mydc
say () { echo "$1" >&"${mydc[1]}" ; } # echo 1st argument to mydc
get () { read res <&"${mydc[0]}" ; } # set var `res' is response

say "0" # initialise stack with 0

for v in 10.01 11.02 12.03
    say "$v + p"
    echo "Val: $v, Running: $res" # produce output
say "q" # quit dc

# output will be:
#Val: 10.01, Running: 10.01
#Val: 11.02, Running: 21.03
#Val: 12.03, Running: 33.06

The code above is available as a gist, and also works on cygwin.

Posted in Computers, Uncategorized | Tagged , , | Leave a comment

$RTN.L – Restaurant Group – Post close update

RTN (Restaurant Group) operates over 500 restaurants and pub restaurants throughout the UK. Its principal trading brands are Frankie & Benny’s, Chiquito, Coast to Coast, a Pub restaurant business and a Concessions business which trades principally in major UK airports.

It released an RNS today ( announcing that turnover was up 7.9% and like-for-like was up 1.5%. That sounds pretty good to me. The markets disagreed, and the shares have dropped nearly 15% in early trading. The company added caution, which is likely what spooked the market:

It has become apparent from much of the recent data from the retail sector and the wider economy that the trading environment for many consumer facing businesses has been tougher in recent months than it was earlier in 2015. This has caused like-for-like sales growth to trend lower and accordingly we are more cautious than previously on the outlook for 2016. A possible referendum on the UK’s continued membership of the European Union, National Living Wage implementation and global uncertainty are all additional issues that we are conscious of going into the new year.

These worries seem somewhat speculative to me, though. Why would a living wage be bad for sales, for example, and why should leaving the EU be necessarily construed as a disaster? When is anything ever certain like that?

My take on all this is that it’s a good company whose shares perhaps got a little toppy, and the update, combined with the diabolical state of the stock market right now, was the trigger that moderated the price. All the other disastrous stuff could still happen, of course, but when was that ever outside the realm of possibility anyway?

Analysts forecast dividends of 17.2p, which gives it a yield of 3.2%. That looks like a pretty good deal to me. RTN has enjoyed excellent returns on capital, operates with modest debt, and, according to Stockopedia, dividends have increased at a rate of 14% over the last few years.

I was a former shareholder in RTN. Although I don’t remember, offhand, what price I sold them at, it was likely to have been much lower. My sale was a mistake.

Personally, I’m not sure I would buy RTN, because I have a fair slice of TAST (Tasty), which is another restaurant chain. So I don’t want to be too top-heavy in that sector. But if I didn’t own own TAST, I would be severely tempted by RTN.

Conclusion: Top quality steady compounder now with an attractive yield. A portfolio of similar quality companies at similar valuations should do well.


Posted in Uncategorized | Leave a comment

QVM lite

I was thinking about HOME (Home Retail Group), the recent rumours of a takeover of LRD (Laird), and the success of the “Tiny Titans” Screen on Stockopedia.

The Tiny Titans screen was developed by O’Shaughnessy in his book “What Works on Wall Street”. Stockopedia has shown annualised returns onf nearly 25%, with a maximum drawdown of 12%. That’s reasonably low compared with the other screens. The rules are very simple:

  • Mkt Cap £m < 150
  • Mkt Cap £m > 15
  • P/S < 1
  • RS 1y > 0
  • Spread (bps) < 1000

It made me think that the following screen is likely to be a good idea:

  • P/S <1 (cheap)
  • RS1y > 0 (momentum)
  • net cash (quality, sort-of)

Having net cash makes them more attractive as takeover candidates. Removing the restriction on market cap might also help in this regards, as it could allow a bigger fish to make a chunkier acquisition than they could with a tiny company.

Just a thought.

Posted in Uncategorized | Leave a comment

NIPT – Premaitha Health

NIPT is engaged in molecular diagnostics.

It has never made a profit, has a stock rank of 4, and it is on Stockopedia’s Z-score shorting screen. I would have thought it was a short if anything, but Tom Winnifrith has rated it a “buy” on 3 Jan 2016 (, with a target of 30p.

I tweeted the view that there would be dilution for shareholders. I was worried about cash burn. Tom responded “clearly did not look at balance sheet”. I noticed that they raised £7m in 13 m/e 31.3.2015. On 2.7.2015 they had a placing of £8m (

On 14.12.2015 the company announced an investment from Thermo Fisher Scientific ( for £5m by way of secured loan. 20.3m warrants have also been issued to Thermo, which is not quite 10% of the shares currently in issue (228m).

Analysts have been downgrading forecasts over the last month.

I say it is a story stock with further dilution/placings on the cards. Tom Winnifrith gives it as a share tip of the year. Tom has a much greater reputation than me, BTW.

We can’t both be right.

Let’s see in a year’s time.


Update 10-Jan-2016: @Vanvagabond tweeted me: “ you obviously don’t know much about the company nor the market nor the NHS.”

Posted in Uncategorized | Leave a comment

Some good quality stocks

This (tax) year I have been putting together some companies that I think are high quality, and are suitable for a LTBH (Long Term Buy and Hold). The selection criteria are:

  • ROCE5 (5-year mean ROCE) >=15%
  • Debt < 3 * PBT (Profit before tax)
  • Yield >= 2.5%
  • PE < 20
  • CAGR of dividends at least 5.5%, as reported by Stockopedia

It is very much a “dividend growth” strategy. I am willing to accept a lower dividend than typical “dividend stocks” if it means the company has good returns on capital, and I expect the company to expand. So it will have no utilities, or companies like VOD (Vodafone), which have meagre returns on capital and are loaded with debt.

Here’s some of the companies I like and own:

DPLM – Diploma

A conglomerate, which is usually a dirty word, but its share price has risen 373% over the last decade. It has net cash, so it has not been squandering money foolishly.

IGG – IG Group

Anyone who invests has probably heard of this company. It has branched out into stockbroking. I recently joined it as a customer, and I like its platform. It has a dividend yield of 3.7%.

PAY – Paypoint

PAY provides transaction processing and settlement at shops and on mobile. Its dividends have grown 12% annually over the last few years, and the current yield is 5.1%.

XPP – XP Power

It is a Singapore-based company providing power supplies to the industrial, healthcare and technology sectors. Usually I would groan at the mere mention of Asian stocks, but XPP is not some Chinese AIM junk.

Here are some other companies that I own that are perhaps not quite up there with the list above, but which are still pretty good:

CGS – Castings

It’s an iron casting and machining company. It sounds very boring, but its return on capital has averaged 17.3%, and its dividends have increased at a rate of 5.9%. Yield is around 3%, and trades on a PE of 12.9. It has net cash.

IMT – Imperial Tobacco

Makes ciggies. It carries a fair amount of debt, which is why it’s not in my top tier. It is in a defensive industry, so I am reasonably sanguine about the debt levels.

NXT – Next

A retailer that needs no introduction. Management truly are a class act. It is quite large, and does not have the growth opportunities as perhaps some of the other companies do, but it does have a yield over 5%.

PZC – PZ Cussons

Cussons, as in the famous brand of soap. It is a family-owned business, and one in which Lord Lee said he was happy to buy. PE of near 15 is hardly excessive, and it has a yield over 3%. Its mean ROCE is just shy of 15%, and it has been growing dividends at 6.3%. It took on some debt last year to increase growth. That can be a warning sign, although in PZC’s case I’m reasonably confident that they will invest wisely, as opposed to going on a debt-fuelled expansion binge. We might need to be forgiving about subsequent ROCE levels, as the returns may take some time to feed through. It’s probably viewed as a bit of a stodgy company, but with sales of “only” £819m, it has a long way to go before it reaches the size of, say, Unliver.

Some other good companies that I don’t own which I think are very good but perhaps a little pricey, or I just haven’t gotten around to buying:

HLMA – Halma

It makes security products. Sounds boring, but it has great returns on capital. Its share price has increased 349% over the last decade. There’s nothing boring about that.

RTN – Restaurant Group

A restaurant chain. I owned some shares a few years ago, but sold them. Silly me.

ULVR – Unilever

Everyone knows Unilever.

VCT – Victrex

Manufactures “polymer solutions”. Dividends have increased 13.4% annually over the last few years. It has net cash.

A couple of other companies that perhaps don’t meet the standards above, maybe don’t have much in the way of dividends, etc:

DTG – Dart Group

Anyone who reads Stockopedia must surely have heard of this airline and logistics company by now. It’s in a cyclical industry, which may put a lot of people off. It has actually been growing steadily for a number of years. The management seem very canny.

TAST – Tasty

Restaurant chain run by the Kaye family with a good track record in the business. Not exactly cheap, but I’m well in the money on this one, and want to let it ride.

Are there any more that should be added to the list? Not Vodafone, or other lumbering Footsie giant that is past its prime.

Posted in Uncategorized | Leave a comment