Hi Friends,

This is my first message. I am very confused. :frowning:

I have been trying to establish a formula to get median 10 years price/earnings ratio. If anyone help ?

Thank you in advance. Regards, aLL_oFFs

Here is a 1st approximation to start:

LoopMedian(“close(CTR*252)/EPSExclXor(CTR,ANN,FALLBACK)”,10)

Apparently only EPS (not PE) offers an annual offset going back 10 years, so must divide it into closing price.
I’d prefer an average (SMA) vs the close, but its offset can only go back 500 bars, about 2 years.
LoopMedian function iterates over formula for CTR going from 0 to 9 (years back).
Most years have 252 trading days, (e.g. 2017 is 251), so closing price will slip one day once in a while.

Thanks a lot for your help…


Try to stick to the predefined factors as much as possible to avoid problems. The approach below may not work in some cases. In this case PEExclXorTTM is a good candidate because it’s not affected by splits.

Try this:

Create a custom formula $PEHist defined as FHist(“PEExclXorTTM”,CTR)

Next start a new screen to test and enter these rules

Ticker(“ibm”)
Showvar(@pemedian, LoopMedian(“$PEhist”,3,0,52,TRUE,TRUE))
showvar(@pe0, PEExclXorTTM )
showvar(@pe1, FHist(“PEExclXorTTM”,52) )
showvar(@pe2, FHist(“PEExclXorTTM”,52*2) )

When you run this screen and set the report to be “Screen Factors” you will see in the column @pemedian IBM’s median PE for the past three yearly samples. Please see the documentation for FHist & LoopMedian

Let me know if you need more assistance

Thanks a lot

Hi Marco,

Sorry to bother you again. I just needed 10 years median PE and I put 10 take place 3 at the following formula you specified.

Showvar(@pemedian, LoopMedian(“$PEhist”,10,0,52,TRUE,TRUE)

I just got the same result like 3 years. Is it possible to see 10 year Median pe ?

It changes for me in at least one case. The calculation of the median using the form that is in the @pemedian function stops when it encounters a meaningless PE, so it’s not going to change in every case.

I hate to contradict my boss, and do so with the utmost in respect and caution, but I wouldn’t use his method. I would use sglinski’s.

First, it’s simpler. There’s a lot to be said for that when I’m not sure that the extra effort is rewarded here.

Question: How, exactly, is Steve Job’s release of the iPhone 3GS in 2009 affecting the price of AAPL today?

That’s exactly what you’re doing when you’re looking at the P/E of 10 years ago in your formula. One can make a case that Apple’s brand was getting more valuable or that its innovation pace has waned, but both of those are analysis over time, and you’re not doing that. You’re giving equal footing to the valuation of 10 years ago and of yesterday.

Remember that the markets are pricing stocks based on two things: Present total assets (the starting point) and projected growth of those assets through business operations. I get the idea of trying to test if a stock is expensive relative to historical valuation, but three years ago is already ancient history for this purpose. I personally wouldn’t be looking back more than a year.

Finally, I think – and I could be wrong here – that the use of FHist is unnecessary in this case mathematically. If a company splits, the same ratio would be applied to numerator and denominator, so the PE should be more or less unaffected. That’s for a simple split, of course, but if a company does some more complicated M&A activity then the whole analysis goes out the window anyway. I would also note that we can’t easily detect those situations from the data.

Actually, thinking about it, I would include a check to make sure that you’re using only positive EPS, though. Use this rule:

LoopMedian("Eval(EPSExclXor(CTR,ANN)>0,close(CTR*#year)/EPSExclXor(CTR,ANN),NA)",3)

Change the final three to any number between 1 and 10.

I would use this rule to test only over the last year:

LoopMedian("Eval(EPSExclXor(CTR/#year,TTM)>0,close(CTR)/EPSExclXor(CTR/#year,TTM),NA)",#year)

That takes the reading daily.

Hi pdmartino,

Thank you for your comments and formula. I agree with you companies can be different place when you compare 3-5 or 10 years. (New patents, acquiring companies at different sectors -it changes average pe, roe etc.)
I try to use median value to exclude negative earnings years and some unmeaningful pe’s like 1500 or 3000 when the company make small yearly profit.

My point was ; Even best companies like AAPL, GS or BRKA can be valued less than their historical average (or median9 PE. Sometimes not good reasons. (General market decline, sector ruling changes (ex Coal Industry Or Pharma)

As you pointed out you can miss good fashionable companies with this screen because of their pe looks higher. On the other hand you might find best bargains in this basket like HOG, ESRX (last year) AYI, FDX, UPS (currently)

Once again thank you for your help :slight_smile: Regards…