System Trading - Part 2: Consideration Set & System Definition

In Part 2 of my notes on System Trading I wanted to outline two high level but very important areas of a trading system.

Disclosure: I will be mentioning stock names for examples. I have traded in all of them and hold a few as trading positions. This is in no way an advisory. This is for theoretical purposes only.

In summary:

  • System Definition: These are the underlying principles of the system
  • Consideration Set: What instruments are considered to be traded

System Definition

There are many ways to make money. A fundamental pure value based approach can be called a system. A momentum based strategy of picking up stocks which are in top 25 of a list of 100 stocks in a time frame can be considered a system or picking stocks basis modified Sharpe ratios. There could be mean reverting strategies or breakout ones. And so on and so forth.

But in the example which I will build on we will consider the following simple properties.
  1. Long Only - In this system we will be only going long in the securities we chose. We avoid shorting owing to multiple issues in operations but that can also be built
  2. Asset Class - Equities traded within Nifty 100. Dividends & bonus are not considered
  3. Trend Following - Expectation is to enter a security whose price rises for the longest stretch of time, followed by maximum possible rise. The key words are 'longest stretch' and 'maximum rise in a give time period'
  4. Time frame - We work on weekly levels but zoom in and zoom out to daily and monthly trends also
  5. Indicator - A single simple moving average coupled with closing price on the weekly charts. We chose a quarter based number i.e. a 63 period simple moving average (252 trading days)
So we have set the basic definitions in place and now let us get into some actual system making.

Consideration Set

One thing I want to call out. Many of the terms I have mentioned are made up by me. I am unsure as to whether such terms exist in the literature on this subject. This has so far been only for my personal use. That out of the way.

By Consideration Set I mean that we cannot have all the 100 stocks in Nifty 100 Index in our portfolio when they are all up trending. We have to be selective. If hypothetically if all were up trending how would we allocate funds to each trade? That is the genesis of the concept of Consideration Set. We will come to what a trend is in a while. But first our objective is to dispassionately look for stocks in this universal set of 100 and rank them in a way that we know that the top ranker will give us a more bang for the buck. Once we have a ranked list it makes it easy to know which stocks to bet a larger sum on and which ones to bet smaller. The principle is to see which stocks tend to be in uptrend for the longest periods of time and in those periods of up trend generate maximum returns.

A short note on Trends. There are 3 types of trends - up trend, down trend, and no trend (also called sideways). In this system we convert the 3 trends into 2 - up trend and no up trend. An up trend will be when the closing price of the security will be above the moving average as defined above. Please note for defining the consideration set I have oversimplified the calculations. Because we do not use this calculation for trade management (entry, hold and exit). 

We define a term called Trend Factor for each of the 100 stocks in our Universal Set. And then sort them basis that within individual sets. When I get to the examples it will become clear. 

The end goal is a framework of prioritizing the fastest up trending stocks for the longest periods

We will make a universal set of 10 stocks for our study. I have traded in all 10 of them at some point of time. And hold a few currently too. Please note I use nuances of this system in my actual investing methods. But this is not the way I invest. 

The 10 stocks are:
  1. RIL - Reliance Industries
  2. HDFC Bank
  3. HPCL - Hindustan Petroleum
  4. Tata Motors
  5. HUL - Hindustan Unilever
  6. L&T - Larsen & Toubro
  7. SBI - State Bank of India
  8. Tata Steel
  9. Maruti
  10. YES Bank
We want to give a score to each of these companies. What we look at is the weekly chart with the moving average. Any sustained period of long is noted in terms of how many times did it stay in up trend and how many times did it stay in no trend (down and side trend). Again I reiterate this is not for trade management as we are looking at historical data to sort our stocks. So whipsaws will have no effect in this historical analysis. But when we actually enter a trade and hold it whipsaws is very very critical. In fact 50% or more work is around whipsaws only. 

So we have number of times in a time frame the stock has remained in an up trend. We further simplify this to something called 'Long Switch'. It is like going from an up trend to no trend and back to up trend. One cycle as this is considered a numerical value of 1. I will give an example now. Let us take Maruti. Chart below. If you notice it has 3 long switches and currently the long switch is off (given a numerical value of 0 for long off or 1 for current state of long on). This is a simplified version.


The green horizontal lines are the long up trends. The red horizontal lines are the no trend zones.

Once we have this we look at how much the price rose in an up trending zone (the green line zone) divided by time spent in that zone. Let us take another example HDFC Bank. Again a simplified graph below.

If you see there are 3 Up Trend Periods I have called them Trade Period A, B & C. For each of these individual periods we calculate the price difference between the blue lines in terms of percentages. This percentage is divided by the horizontal line which is the time spent in days. We rationalize this number by a factor and get it up to a scale (simply multiply by 10000 to get a 2 digit number or whatever suits you). This number for each period is trend speed for each up trend period. For example in HDFC Bank's case in Trend Period A the stock gained 105% in 930 days, in Trend Period B it gained 173% in 1500 days and in Trend Period C it gained 250% in 2200 days. If we calculate the Trend Speeds we get after rationalizing 11 for Period A, again 11 for Period B and 12 for Period C. So ideally we got fastest gain in period C also it happened to be the longest. So if we were trading only 1 stock system here that is HDFC Bank the Period C would be our rank 1 period. 

Now we calculate the Trend Factor by simply summing up all Trend Speeds for HDFC Bank (11+11+12) that is 34 and dividing it by the number of Long Switches which is only 1 in this case. So Trend Factor for HDFC is 34 and the Current State of the Switch is 0 as it is not in up long trend. 

Let us look at some more examples.

SBI

By the look of SBI you know this is not a great stock to have from a system perspective. There is frequent switching and even the trend speed looks poor. Such stocks will never turn out to be great wealth creators in my humble opinion.

Now a series of few more examples. I suggest as an exercise you calculate 
  • Long Switches
  • Trend Speed
  • Trend Factor
  • and Assign the Current Switch State
Tata Steel
YES Bank

HUL

Tata Motors
RIL
HPCL

L&T

So these are the 10 stocks. For each I hope you have calculated the Trend Factors. The answers should look something like below maybe not exact. If you can code it in Python do so.

So we have that RIL and HDFC Bank are the most long trending stocks in terms of states. L&T, SBI, Tata Steel, Maruti & YES Bank keep flipping between up trend and no trends.

When in an uptrend the ones which stay for a shorter time gallop like horses and ones which stay for longer times sail smoothly.

From an overall Trend Factor perspective we prioritize the list in the above order and as I type this there are only 2 stocks which are 'investible' as per this system - RIL & HUL.

Please note in the subsequent part I will refer to something called 'Warming Up' of a system. Basically it means the day you start using a system it does not mean that it will yield results as good as the back test. In this case do not jump into RIL and HUL. Also I use trending system as just one factor in my personal investment methodology. 

A simple trend following system if dispassionately followed yields exceptional results when mixed with fundamentals

It does not sound intelligent as there is neither a story or a macro angle to it. But at the end performance is measured from the bottom line of a portfolio which derives its value from the stock price.

In the next parts of System Trading I will delve into Entry Signals. In that we will use Trend Factor as an input to prioritize capital allocation.

All the  best.

Comments

Popular posts from this blog

Pied Pipers of Dalal Street

Price Earnings Multiple: An exception to Occam's razor?

Can we time SIPs?