Follow-up on HSBA and CPR

Having being 100% right on my last post, I now find myself being 100% wrong. I am reminded of the joke about the scientist: “Our new drug showed an efficacious effect on one third of our chicken test subjects, little or no improvement on another third of our chickens, and I’m afraid the last chicken ran away.”

Six months ago, I was bearish on both HSBA (HSBC) and CPR (Carpetright), and promised to write up about their subsequent performance.

On HSBA, I wrote:

The reaction to the trading statement suggested that it was likely to be a busted trade.

An alert was triggered earlier today, indicating that the price fell below that, so I sold. I managed to achieve a little over 645p, dealing costs included. So I lost 2.1% on the trade. Disappointing, but of course less disappointing if the shares decline more.

So, to sum up, I had concluded momentum was lost, and I expect further declines in the share price thereafter.

The shares now trade at 742p, so I lost out on a considerable potential gain.

On CPR, I wrote:

What attracted me was the likelihood of momentum reversal. It’s momentum score is 14. A mere glance at the chart shows you that momentum is bad in any event. Its value score is 87. So here we have an interesting situation. The shares are cheap, the momentum has been bad in the past, but it is now trading above its 50dMA in what appears to be a reversal of trend. What’s more, on 31 Jan 2017, it issued its Q3 trading update, which raised the share price 8.8%.

CPR reminds me of DTG (Dart): terrible momentum, cheap, but with a trading update that caused a re-assessment of the company.

So I am going to stick my neck out and say that I expect the share price of CPR to be higher in 6 months time than it is now.

Alas, it was not to be. The shares traded at 208p at the time, and now trade on 194p. The shares have languished over the last 6 months. Its value score has been reduced to Stockopedia 76. Paul Scott had this to say at the end of June:

this share looks quite good superficially. However, it’s the type of share where, the more you dig into the numbers, the less impressive it looks.

There have been no divis paid since 2011 either, which isn’t good. Although a small divi is forecast for the new year.

Look how brokers have been steadily revising down forecast EPS in the last year, which hardly seems to be a business in rude health, does it?

So, not much to be excited about, especially since its overall StockRank score is an indifferent 50.

Stay safe out there.

Advertisements
Posted in Uncategorized | Leave a comment

A simple BASIC interpreter in C++

Writing an interpreter is something every programmer wants to have a go at at some point. I wanted to see if I could write a recursive-descent interpreter for the BASIC programming language using modern C++. There is some malice afore-thought, as I am also investigating the use of a programming language for my spreadsheet program neoleo.

I have called my language blang, derived from Basic language. What I like about it is that it is contained in one file, and is reasonably short, at 649 lines. It has if-then-else, for-next, let, print, while-wend and limited support for strings. It has no functions, or gotos.

The code is not perfect, but it shoud be comprehensible, and act as a base for those wishing to explore interpreters.

The idea is that each syntax element has a class with two parts to it:

  • a parser, held in the object’s constructor, that is able to parse the element in question, and dispatch to other elements as required
  • an evaluator, which, obviously enough, evaluates the stored parse expression.

Here is the class declarator for a statement:

class BlangStmt: public BlangCode { // some statement
	public:
		BlangStmt();
		void eval();
	private:
		unique_ptr stmt = nullptr;
};

A top-level statement handles lets, fors, ifs and whiles. Here’s its implementation for the parsing stage:

BlangStmt::BlangStmt() {
	string sym = nextsymb.value;
	nextsymb = yylex();
	if(sym == "print")
		stmt = make_unique();
	else if(sym == "let")
		stmt = make_unique();
	else if(sym == "for")
		stmt = make_unique();
	else if(sym == "if")
		stmt = make_unique();
	else if(sym == "while")
		stmt = make_unique();
	else
		throw runtime_error("Statement unknown token: " + sym);
}

Quite small. Notice what is not handled, though: the else, fi, wend, next statements. That is delegated to another class. Else and fi are handled by the BlangIf class, for example.

The evaluator for BlangStmt is on of the most straightforward evaluators:

void BlangStmt::eval()
{ 
	stmt->eval(); 
}

It just delegates the evaluation to whatever statement it creates. Here is how the if statement is implemented:

class BlangIf: public BlangCode { // if .. then .. [else ..] fi
	public:
		BlangIf() {
			rel_ptr = make_unique();
			checkfor("then");
			bool processing_then = true;
			while(nextsymb.value != "fi") {
				if(nextsymb.value == "else") {
					processing_then = false;
					nextsymb = yylex();
					continue;
				}
				if(processing_then)
					then_stmts.push_back(make_unique());
				else
	 				else_stmts.push_back(make_unique());
			}
			nextsymb = yylex();
		}

		void eval() {
			if(rel_ptr->get_value())
				for(auto& s: then_stmts) s->eval();
			else
				for(auto& s: else_stmts) s->eval();

		}
	private:
		unique_ptr rel_ptr;
		vector then_stmts, else_stmts;
};

You can read the whole source code for how other statements, including relational operators, work.

Because it’s a recursive-descent parser, some classes are defined in terms of other classes in in mutually-recursive fashion. This is sometimes considered “bad form”, but it is just an expression of the underlying algorithms. A little bit of sheparding of class definitions and declarations are required. You need to forward-declare some classes, and sometimes separate the class prototype from its implementation.

I have in mind the idea to completely re-write the code. The parsers contain quite a lot of “grunt work”, compared to their BNF form. Here, for example, is the BNF for parsing numerical expressions:

E --> R {( "<" | "<=" | ">" | ">=" | "==" | "!=" ) R}
R --> T {( "+" | "-" ) T}
T --> P {( "*" | "/" ) P}
P --> v | "(" E ")" | "-" T

It is very simple and readable compared with the code that implements it, relatively speaking. So the plan would be to write a meta-parser: one that could take BNF expressions as a way of transforming the target language into a source tree. The code for the interpreter would be much simplified: the bulk of the code would go in the evaluator.

Except … let’s back up a bit. If we’re going to write another interpreter, then let’s see what the easiest one to implement there is. The answer to that question is: s-exprs.

So, a simplistic Scheme-like interpreter could be made that has injectible functionality. S-exprs are very easy to parse, and you can extend them.

We see, in the example above, the definition of E as being list-like. There are many similarities between the definition of E and R and T. So perhaps, instead of the BNF above, we might write:

(def-form E (repeat-end ( "<" | "<=" | ">" | ">=" | "==" | "!=" ) R)

This may facilitate the evaluator, because it’s a kind of pattern that is common, and can therefore be abstracted. Instead of the evaluator having to chug through a vector of operators and sub-forms, it could define a function that knows how to reduce these vectors, which could be passed into std::accumulator, or something.

There are some exciting possibilities that I want to explore here.
index.png

Posted in Uncategorized | Leave a comment

CLLN – now what?

Mr. Market has been in a real punishing mood lately, and has not been afraid of clobbering even the largest companies.

Scanning Hargreaves Lansdown’s Biggest Fallers list, I see that construction and engineering company CLLN (Carillion) is down 13.6% to 41.7p. Stockopedia classifies it as a value trap, and gives it a momentum score of 0. A company must have done something seriously wrong to warrant a momentum score like that.

There doesn’t appear to be any news issues today, so I’m not clear what the fuss is about. However, I notice that yesterday they issued a statement saying that they will issue a trading update on the interims on 29 Sep 2017. That’s a Friday, the last day of the month. Last year, they issued the interims on 24 Aug 2016, more than a month earlier. There is one big implication to this, in my view: you ain’t gonna like what you’ll read.

John Kingham tweeted his article “What you need to know to avoid the next Carillion” recently. I recommend reading it highly.

Brace for impact.

41.7p

XJ2L4pOd.jpg

Posted in Uncategorized | Leave a comment

ALY – Laura Ashley – it figures

Well, well, well. I see that speciality retailer ALY (Laura Ashley) has scrapped its dividend. It issued its final report today, sending the shares down 6.1% to 8.2p. I see that Stockopedia reports its dividend yield as 17.2%, an overwhelming sign that the dividend is vulnerable.

Indeed, considering that the shares dropped “only” 6.1%, the market seemed to have been mostly expecting this development. Stockopedia classifies this company as a value trap – boy, did they get that right – and gives it a momentum score of 11. Looking at the chart, which is basically downhill all the way, I am not surprised by such a low score:

Chart-laura-ashley-holdings-2372017.png

Their sales revenue is down 3.1% on a like-for-like basis, which is bad. Their hotel revenue is down. For some reason, the directors have decided that a home furnishings and womens fashion retailer should also be in the hotel business.

I have long aired suspicions about this company. It’s a total bargepole for me, and these results only strengthen my suspicions. The directors simply cannot be trusted.

Paul Scott had this to say:

if this company had a conventional ownership structure, then I would probably buy some at the current valuation, for the speculative upside from expansion in Asia.

However, it is dominated by Malaysian shareholders & management. The problem with this, is that at some point they might simply decide that the UK listing is a waste of time & money. So the disaster scenario would be if we wake up one day, to find the company announcing its intention to de-list.

Tthe company has historically paid out extremely generous divis to all shareholders. Last time I looked, management remuneration looked reasonable too.

8.2p

Posted in Uncategorized | Leave a comment

WPP drops 12% on interims

Media and publishing company WPP dropped 12% to 1408p on the release of its interims. The company reports all sorts of numbers, which I’m too lazy to analyse. The market has spoken in any case.

The chart is quite ragged, although there were signs that you should have bailed:

wpp.png

Stockopedia gives it a value score of 73, which is OK, but not irresistable. WPP trades on a PE of 12.2. Debt looks to be within acceptable limits (PBT 1890m, net debt 4130). With a Stockopedia StockRank of 68, I can’t see anything particularly compelling to justify a buy. I notice that Neil Woodford does not own it in his portfolio, either, suggesting that if you’re looking for dividend stocks, you should be able to do better.

1408p

Posted in Uncategorized | 1 Comment

PFG – Provident Financial – dives 67%

Banking services company PFG (Provident Financial) dived 67% today to 571p after releasing a trading statement earlier today. So something obviously went wrong.

Stockopedia gives its dividend yield as 8.2%: a near-certain sign that the dividend is vulnerable. Sure enough, the company announced that it is withdrawing the interim dividend today, and indicated that a full-year dividend is unlikely.

The company is in Neil Woodford’s portfolio, who had this to say:

I believe Provident Financial shares started the day undervalued, and have become even more so as a result of the market’s reaction to today’s news. I am hugely disappointed by what has happened to the consumer credit division but I continue to believe that it will, ultimately get back on track (this business has been around for more than a century, by the way, and I believe it will be around for many decades to come).

Stockopedia gives it a Value rank of 73, which is good, but not exceptional. The Momentum rank is 7. I regard that as a warning of terrible things happening, as opposed to merely being weak.

The company qualifies for two Dividend Dog screens. However, given today’s news, those classifications are erroneous.

The chart was giving plenty of warning of the impending disaster, too:

Chart-provident-financial-2272017.png

Stockopedia gives a PBV of the company as 3.5, which is way above industry average. On another site, I have seen the PBV to be a little over 1. So it’s probable that Stockpedia has not yet updated its PBV figures.

A PBV of 3.5 is quite racy for a financial services company. LLOY is trading on a PBV at just under 1, for example, with RBS at about 0.7, HSBA at 1, STAN at 0.7. Some of those will be paying dividends, too, which is now more than can be said for PFG.

67% is quite a drop for such a large company. I imagine with such a large gap down it has to make some kind of rebound above 600p some time in the next 6 months. I am not making a prediction as to whether the share price will be higher or lower in 6 months time, though.

Let’s follow this up in 6 months and see what has happened. Stay safe!

571p

Update 22-Aug-2017: Paul Scott mentions PFG in his report:

Selling on the first profit warning is usually the best course of action … there were clear signs in Jun 2017 that something was going badly wrong … the FCA seem to be looking much more closely at businesses like this, which essentially rip-off the poorest consumers … Big dividend yields are often a signal from the market that something is going wrong

His overall view:

I think this share is probably too risky to have a punt on now, without doing a lot more research.

Posted in Uncategorized | Leave a comment

Follow-up on IRV and TCG

Six months ago I said I would follow up on predictions I made about the future share price of two companies: IRV (Interserve) and TCG (Thomas Cook). I am pleased to report that both predictions had been proven correct.

IRV: I predicted that the share price would be lower. It has fallen from 238p then, to 176p now. The share price had declined sharply, and there were a number of factors that I did not like. As the saying goes: just because a share reaches lows, it does not mean it cannot move lower.

TCG: I predicted the share price would be higher. It was 88p at the time, and has since risen to 124p. If only I had backed my hunch! I liked the fact that it was in a consolidation zone, with an uptrend established. The company’s announcement seemed fairly positive, and it was trading on a cheap multiple. The only real hesitation that I had was the market’s poor reaction to its trading statement; an indicator that I take seriously. On this occasion I decided to override this factor, and predict further advances in the share price.

If only I could be correct all the time!  Stay safe out there.

 

index.jpg

Posted in Uncategorized | Leave a comment