System Development

Popular Valuation Ratio

When ever you go about reading or researching companies at different websites, they always offer some sort ratio analysis. When a stock selling cheap relative to its book value, it seems like a good buy. Some screen for stocks based solely on them. But has the “intelligent”  investor ever thought if they actually have sort of predictive power for future return?

In this post, I take the popular valuation ratios and see how they perform. My experiment will be simply screening and buying stocks that are in the top percentile. I believe that it is more robust to use percentiles than hard fixed thresholds as stocks in different industries have different threshold that characterize their value.

The ratios I will be testing are Price To Sales Ratio, Price to Earnings Ratio, Price to Book Value, and Price to Free Cash Flow. The backtest will start from 2001 and end in 2012 and positions are rebalanced quarterly. When I am referring to top 20th percentiles, I am referring to stocks that have the “lowest” ratios in their respective universe of stocks. My universe contains 3647 stocks that are liquid and have market capitalization of 50 million or more; no ADR are included. All data are adjusted for survivor-ship bias. Below are the equity curves.

From the above you can see that compared to buy and hold, if the investor were to buy stocks with lowest respective ratios, they would outperform the market in the last decade.

But looking at the raw numbers, the investor would’ve have to put up with much higher drawdowns. In the upcoming weeks, I will come back in the future with a rolling return graph to show the consistency of these ratios performance over time.



Value Investing with Risk Management

When I started researching about investing at the age of 16, I only believed in value investing. The idea of buying things cheaply intuitively made sense. You’d find me constantly researching and reading value investing books night after night. As each company I researched had different business models and economics moats, a lot of my earlier methods of analyzing stocks weren’t systematic and therefore couldn’t really be tested. Besides where could a teenager get his hands on data back in 2006.

I stopped all my efforts in discretionary value investing in early 2010 but 2 years today, I finally could put my earlier ideas to test. Let me define some of my ideas for researching companies. There are a lot of ways to value a company. Be it using earning projections to discount future cash flows to deriving value from assets in the balance sheet, many value investors can only agree that value is dependent on how one defines it. For myself, I didn’t like outright projections of earnings due to the myriad of factors and assumptions I had to make regarding the future. Instead I placed heavy emphasis on assets on the balance sheet which really took out companies that weren’t heavily asset backed. Within the balance sheet, I really just simply looked at how healthy things were. The ratio of liquid assets verses long term debt and short term debt should be healthy. The current price should be trading near its book value per share minus liquid cash. Profit margins should be high indicating market share. One of my favourite ratios to look at is comparing trailing 12 month net income to total debt. Reason being the higher it is, the more assured I am that the company can pay money back to it creditors. These are just some of the analysis I do but what comes after is entirely subjective hence hard to know if its lucky or hard work.

To test my earlier methods of analyzing stocks, I have created a stock screen that screens and buys stocks based on the following 2 conditions.

1. Closing price of stock must be less than Book Value per share (quarterly)

2. Annual Free Cash flow > Total Annual Debt

Test date are from 2001-2012. Rebalancing quarterly. Stock universe is based on the Russell 1000 adjusted for survivor-ship bias and splits. My benchmark is the SP500. The results, assuming 100 dollar invested:

The simple strategy multiplied the initial capital by more than 8 times compared to the benchmark which barely moved in the past decade. Its true that no matter how nice a business or its fundamentals are, a rising tide lifts all boats. Simply running this stock screen, the investor would face drawdowns of 50%, a bit more than holding the SP500 which endured a 49% MaxDD. What risk management measures can be implemented to improve the performance?

In one of my earlier posts I mentioned about trading the equity curve. The modified strategy will be taking signals until the 4 quarter total equity value is less than its own SMA which then I will be favouring cash rather than invested in equity. The results:

From the above image, one can see that there indeed is a reduction in risk associated with the modified strategy. Although Sharpe improved by 2.8%, MAR improved by 74%. Further research I think may improve results is ranking each quarters signals by some measure of price, volume, or volatility.

This was really an eye opener as I would never have dreamt of actually testing my earlier methods in such a manner. I always thought that value investing would be more of an art compared to systematic trading. In the future I hope to start messing together my research in value and momentum to show that combining uncorrelated edges improves performance.


Implied Volatility as an Asset Class

When M.Faber published a model for asset allocation, there has been significant increase in interest in the area on the internet.

With this post, I hope I can add value to the existing allocation framework by introducing another asset class into the mix which I believe can help improve existing TAA models.

In one of the previous posts, I made the point that the VIX timed the market pretty well in the sense that it spiked whenever the S&P declined. Although it is fundamentally created to measured the implied market volatility, I believe it can be used to improved TAA models in time of stress.

A few ETF products has sprang up lately which offers investors the tool to take advantage of the movements in the VIX. They are…

VXX- iPath S&P 500 VIX Short-Term Futures ETN

VXZ- iPath S&P 500 VIX Mid-Term Futures ETN

Playing around with concepts in my head, I hypothesized that given its inverse relationship with the S&P, it may be a good candidate to incorporate in a momentum based TAA model.  The idea is summarized in the following short picture.

The picture is my way of visualizing the past 6 month return on the S&P 500(SPY, Red), Bonds (SHY, Orange), Gold(GLD, Green) and Implied Volatility (VXX, Blue). You can see that in the recent European crisis, we will mostly be in Gold and VXZ if assuming we are holding the top two funds.

In the following simple backtest, I attempt to quantify this with some evidence. In both backtests, I am allocating funds to the top 2 performing assets (50% capital for each). I am rebalancing weekly and I am using 6 Month ROC to calculate the return.  (Please go to bottom to see assumptions)

Notes: The test was done on the less than 9 years of data. The VXX history started in late 2009 so conclusions should be drawn carefully as past performance is not indicative of future returns.

Amibroker Code:

#include <>;
Filter =1;
SetOption("InitialEquity", 100000);
Maxposition = 2;
SetPositionSize( 100/Maxposition, spsPercentOfEquity);
SetOption("UsePrevBarEquityForPosSizing", True);
BuyPrice = C; 


rs3                     = ROC(Close,120); 

averagescore		= 1000+rs3;
PositionScore		= IIf(Year()>=2003 AND DayOfWeek()==5,averagescore, scoreNoRotate); //DayOfWeek()==5

Cross-Sectional and Time-Series Momentum

A lot of white papers explain momentum as a cross-sectional result. What this means is that future outperformance of a stock is predicated by its outperformance relative to its peers. (MCD vs GE) This is the standard way of doing it, ranking a universe of stocks based on ROC or some other measure.

The other one is time series momentum. This is not a new concept. The idea is that a securities past performance predicts its own future return. From this, auto-correlation is used. The main advantage is that time series momentum can measure and analyze all asset classes because it relies only on its own past price.

The reason I introduced these two different explanation for momentum is that both offer promising fundamental concepts that can be used to build robust strategies. I leave it to the reader to explore further.

Futher Reading:


Monthly Sector Rotation Part 3

Consistency is really important in trading. For this post, I finally was able to construct the rolling risk adjusted return of the strategy through excel. This may not mean a lot to you but for a backtest that stretched more 20 years, the equity curve really doesn’t reveal much. The graph below plots the rolling 1 year risk adjusted return of the strategy which was calculated by dividing rolling 1 yr return by the standard deviation of those return.

As you can see the strategy is pretty stable in its return during bull markets. During the crash/bear period of 87’, 90’, 00’ and 08’, the strategy performed well compared to the market index in the sense that it was able to get the investor to stay in cash preventing from large drawdowns. This is one of the most important aspect of the system as with the implementation of the moving average, anything that dips below it moves the investor back into cash until otherwise.

This strategy is by no way tradable. It is merely displayed to proof a point that relative strength rotational models works.


Monthly Sector Rotation Part 2

I posted a sector rotation system a couple of days ago. In this post I would like to check the parameter stability of the system just to see if the performance was due to “luck”.


From the above, I did a 3d optimization in Amibroker. I varied the top held rank and the cut of off rank from 1 to 9 to see visually the parameter performance of each combination. As you can see, anything to the left of the red lines are better. When we hold more than top 5 positions, we will no longer get the advantages of better performance through investing in high momentum sectors. On the other hand, if our entry and exit were the same (ie enter top 5 rank; exit when fund drops below top 5), there are going to be whipsaws as funds may change rank monthly. Therefore it smoothly return when they are different.

In a later post, I hope to display parameter consistency through displaying rolling performance metrics for this model. I believe that its pointless if we just use the above optimization technique to choose the parameter to trade. Rather I think its better to find a parameter set which offers consistency in return.


Monthly Sector Rotation


This system trades the monthly close ranked by the average ROC of 3, 6, and 12 months and divided that by average ATR of 1, 2, and 3 months (risk-adjusted measure). Hold the top 3 funds and drop off rank is 5. Also, an market timing aspect was included, (faber style), simple 10month SMA.


Amibroker  Code

#include <>;
SetOption("InitialEquity", 100000);
MaxPositions = 3;

SetOption("MaxOpenPositions", MaxPositions  );
SetPositionSize( 100 / MaxPositions, spsPercentOfEquity );
SetTradeDelays( 1, 1, 1, 1 );
BuyPrice 	        = Open;

rscore 			= ROC(Close, 3);
rscore1 		= ROC(Close, 6);
rscore2 		= ROC(Close, 12);
ATR1			= ATR(1);
ATR2			= ATR(2);
ATR3		        = ATR(3);


averagescore1		= (rscore + rscore1 + rscore2)/3;
averageatr		= (ATR1+ ATR2+ ATR3)/3;
averagescore 		= averagescore1 / averageatr;

Condition1		= IIf(C>MA(C,10), True,False);
PositionScore		= IIf(Condition1, 10000+averagescore, 0);