Showing posts with label quantitative trading. Show all posts
Showing posts with label quantitative trading. Show all posts

Saturday, June 27, 2015

Are you a systematic investor?

To be a successful trader one should be part data scientist. Although there are some highly successful traders that hinge their plan on subjective analysis artforms, the road to long-term profits in active trading should be grounded in the laboratory of data. The simple reason for this: failure, as much as success, must be measured and understood because market outcomes are often inherently volatile and unpredictable. Scientific method allows us to test trading hypothesis, learn from mistakes, and quantify risk. Systematic traders understand that without the integrity of data science, they are simply ticker tape cowboys.

Having an analysis framework is an important departure point for the systematic investor. That framework could be fundamental / value analysis - translating measures of intrinsic value into trading signals. An example of this would be the Dogs of the Dow trading strategy. For market technicians core intrinsic value relationships are too complex to model completely. Instead, a technical analyst focuses on patterns of supply and demand for an investment instrument. Those patterns of subjective market valuations are revealed in the price and volume of every stock.

“It’s not good enough to be anecdotal or doctrinaire when it comes to trading.”

Market technicians believe in the market’s message. They construct price and volume charts to read the tea leaves, so to speak, about the future direction of a market price. But here’s where this backward-looking artform often fails: how can a technical analyst place any faith in the reading of these charts? It’s not good enough to be anecdotal or doctrinaire when it comes to trading. It’s not good enough to show a tidy chart that reveals, for example, a head and shoulders pattern, and assert a projection for future price movement if there is no data from which to develop a measure of confidence in the prognostication.

There should be some standard of evidence to support a particular chart reading. If there is no evidence, there’s no foundation for acceptance. A technical trader should quantify the probabilities of future outcomes. Data science allows the diligent systematic investor to develop a level of confidence in a market environment that is fundamentally uncertain. Risk must be quantified!

How does Stock Trends help us turn stock market data into actionable quantitative measures of confidence? First, the Stock Trends indicators are by definition categorical - they translate market price and volume data into factor variables, or independent variables. In a data science setting we can use these independent variables as inputs and measure a relevant outcome, or output. The significant outcome for investors, of course, is the future return. If a dependent relationship is established between the inputs and the output, the trader can measure a confidence level for a desired trading outcome. Let’s now look at each of the Stock Trends indicators and how they fit our Stock Trends Inference Model.

The Stock Trends trend categories are the result of a method of translating market price data (quantitative variables) into categorical variables. For instance, last week’s closing price of Apple (AAPL) was $126.60. The Stock Trends trend indicator categorizes that price by applying a framework for qualification and putting the current price into a long-term price context. Using 13-week and 40-week average prices as guideposts, the trend indicator - now Stock Trends Bullish () - gives us a factor variable for the $126.60 market price.
 
 
 
 
 
A base test, then, would be to measure how a market price performs when it is in this trend category. However, we would want a more granular categorization because within each trend category there are many ancillary variable qualifications. For instance, a Bullish trend category can be relatively new, or it can be quite entrenched.

That is why Stock Trends publishes trend counters. They give us a better understanding of the time frame of the trend category. In our Apple example we can see that the current Bullish trend category has been in place for 92-weeks, about twice the average length of a typical Bullish trend, and that the current strong Bullish indicator has been in place for 22-weeks. So now we can ask the following question: how have stocks performed when they have been in a Bullish trend category for about 92-weeks, and also in a strong Bullish indicator for the most recent 22-weeks?

But our granularity can be improved even more. We also recognize that within any trend there are varying levels of price momentum. Stocks rally and retreat. The Stock Trends Relative Strength Indicators provide us with a method for translating price performance into factor inputs. The 13-week RSI values are discrete variables that can be cut into bins of specific ranges of values. By qualifying each stock’s trend by its relative price momentum to the broad market we can now be more specific about the characteristics we are sampling. In the case of our Apple example, its 13-week RSI is 100. This indicates the stock is only performing at par with the S&P 500 over the past 13-weeks. Now we can sample for Bullish stocks that also share this condition.

The RSI +/- indicator is a binary signal of whether a stock has outperformed or underperformed the broad market in the past week. Again, this indicator can be used as another factor input. Apple underperformed the S&P 500 index last week, and therefore has a (-) indicator.

Finally, another factor variable that Stock Trends creates is derived from the weekly volume of shares traded. Three different factor levels characterize the weekly volume, so that we can differentiate stocks further by which level the trading volume fits. Last week Apple had neither high nor low volume of trading, so its volume can be characterised as normal.

With these composite factor variables, published in each Stock Trends Report, the Stock Trends Profile presents the results of the Stock Trends Inference Model. In the case of Apple, shown below, we can see that the current Stock Trends indicators are relatively positive: the future 4-week return of Apple has a 57% probability being higher than the expected mean random return of a stock, which is 0%. Remember, that a randomly chosen stock has a 50% chance of having a 4-week return greater than 0% (see The random outcome benchmark). AAPL has a 62.2% chance of besting the base mean 13-week random return, which is 2.19%, and a 56% probability of besting the mean 40-week random return (6.45%) .
 
 
These probabilities might not strike you as significantly positive. However, they do indicate that the trend and momentum conditions for AAPL are sufficiently supportive of a continued bullish stance for Apple investors. The analysis also tells us that AAPL is more appealing than stocks with lower return expectations. You can compare the returns expectations of industry stocks in the associated heatmap that ranks the expected future returns.

This is the analysis framework of Stock Trends: translating the weekly trading statistics of an issue into factor input variables. It is how we interpret these variables and their significance in predicting future price performance that makes Stock Trends a unique and effective data science application. The Stock Trends Inference Model statistically measures the change in stock price that follows from each market condition defined by the composite of the inputs of each Stock Trends indicator combination.

Stock Trends covers the North American stock market - thousands of issues every week are categorized by the Stock Trends indicators. Each of these observations since 1980 - now numbering over 9.2-million records - can be used as input variables in models that measure the subsequent price change in the categorized stock. We can ask the question: what kind of returns did a stock have after it was categorized by the Stock Trends indicators? Do stocks that have a Bullish trend indicator and high price momentum perform better, on average, than other stocks? Is there any statistical evidence that momentum trading is profitable? Does a Bullish Crossover offer a good trade entry signal? More broadly, does the data support many of the doctrinaire positions of technical analysis? The Stock Trends Inference Model attempts to answer these type of questions.

"Every technical analyst who presents a price chart as evidence of a buy signal must also present a distribution graph of the expected returns. If they don't, take their advice with a grain of salt."

Stock Trends analysis framework is simple, but specific. It looks at certain important aspects of technical analysis - trend and price momentum. Another analysis framework might be centered on other algorithms of price and volume, and on a different time frame. Every investor has to choose what analysis framework fits their own assumptions about the dependent relationships in the market. However, each analysis framework must be measureable. The litmus test of this measurement should be the the presentation of data, the display of returns distributions. Indeed, in my opinion every technical analyst who presents a price chart as evidence of a buy signal must also present a distribution graph of the expected returns. If they don’t, take their advice with a grain of salt. Your success as a systematic investor will reflect your diligence in making data science integral to your trading strategies.

Wednesday, April 15, 2015

Introducing the 'Map of Stock Trends'

The Stock Trends Inference Model is a quantitative approach to interpreting the categorical data that is the core value-added analysis presented here. The Stock Trends indicators are derived from base tenets of the market technician’s encyclopedia - a toolset designed to reduce a complex market dynamic to a categorical, and hierarchical framework. By evaluating the statistical significance of this framework we can apply meaningful algorithmic trading methods.

However, the first step is to understand the data and interpret the Stock Trends Inference Model results. Every week we sample 30-years of data to assign a probability for future returns on over 7,000 North American stocks. Using combinations of categorical data and making assumptions about the distribution of returns, we apply statistical inference methods to differentiate stocks (ETFs and income trusts, too) by the estimated returns in the coming periods (4-weeks, 13-weeks, and 40-weeks). You can see the result of that analysis in the Profile section of each Stock Trends Report.

I’ve already introduced the Stock Trends Inference Model in previous editorials. Subscribers to Stock Trends Weekly Reporter can interpret this information weekly, as well as review the reports on issues with the best expected returns. The Stock Trends ‘Select’ report, as well as the Top 4-wk/13-wk/40-wk returns expectations reports give users a new way to make the Stock Trends reports actionable.

However, these reports can be augmented by data visualizations. Graphical presentations of data are always useful in translating vast data points into more accessible interpretations. A good graph saves us time and points us in the right direction.

The Stock Trends Profile reports include heatmaps which help us compare returns expectations among industry group member stocks. Another useful display method for this data, especially when we want to broaden the use of the data hierarchy, is a treemap. A treemap is specifically designed for hierarchical data and is commonly used. A popular example in our equity analysis space is the Map of the Market.

Today I am introducing a treemap of the Stock Trends Inference Model - the Map of Stock Trends. It takes the data results from the weekly analysis, sorting 4-week and 13-week returns expectations by trend category.

In the treemaps displayed below large capitalization stocks (U.S. stocks with a market cap greater than $1-billion, Canadian stocks with market cap greater than $500-million) are grouped by Stock Trends indicator (Bullish , Weak Bullish , Bearish , Weak Bearish , Bullish Crossover , Bearish Crossover ). Each stock within these groups are visually differentiated in two ways: spatially by their relative probability of a return greater than the base 13-week mean random return (2.19%) , with larger cells (higher probabilities) sorted and displayed from the upper left quadrant and moving down to the lower right corner for the lower value. Secondly, the 4-week returns expectations are differentiated visually by color gradation, with darker green hues representing stocks with higher probabilities of exceeding the base average 4-week random return (0%) and darker red hues representing the stocks with the poorest probabiltity of a positive return in 4-weeks.
 
 
Dark green cells in the upper left of each trend category are stocks with the best statistical trend characteristics. Dark red cells in the lower right quadrant of each trend category are stocks with the worst statistical trend characteristics.

Below are the current Map of Stock Trends treemaps for the U.S. and Canadian stock markets. Each Stock Trends trend indicator category grouping is identified by the translucent indicators in the background of each box. In the future the treemap will be developed in an application that allows users to click on an individual cell and go directly to individual Stock Trends Reports, but for now the visualizations help direct us to the stocks with the most favourable current Stock Trends Reports.




















 

U.S. stock exchanges - big cap stocks

Map of Stock Trends



Toronto Stock Exchange - big cap stocks

Map of Stock Trends

Monday, September 15, 2014

The new Stock Trends Report Profile section

A much longer time in coming than originally planned, the new Stock Trends Report 'Profile' section is installed on the Stock Trends website. Available for most common stocks and exchange traded funds, the Profile report now features the Stock Trends Inference Model introduced in the past year. This analysis attempts to answer the very important question: what return expectations do the Stock Trends Reports imply? 

If you were lucky (?) enough to take statistics in your previous studies, you are probably reasonably versed in statistical inference methodology. You will know about measurements of central tendency and variability. You will know about the 'mean' and 'standard deviation' - both as descriptive statistics of a sample and estimated parameters of a population. And you will also know about sample spaces and probabilities. The Stock Trends Inference Model is an application of these basic statistical methods. 
 
If you were lucky enough to have avoided a statistics course in school, be assured this model can be explained in very simple and clear language. I've tried to do that in the editorials I have already written about this analysis, but let's summarize here. First, though, a description of methodology  should always be preceded by a statement of the research question and the biases of that question. 
 
Because the departure point for any model is the assumptions that underlie it, it's important to fully understand the fundamental premises of the Stock Trends Inference Model. The primary assumption is a core tenet of technical analysis - that price patterns repeat themselves. In order to illustrate this and display empirical observations of patterns market technicians must assert that these market price and volume patterns are homogeneous across markets.
  
What does that mean? It means that a price pattern observed in one market can be meaningfully applied to another market. A moving average crossover, for example, carries significance as much in AAPL as it does in ZNGA. A head-and-shoulders pattern found in the chart of IBM in 1980 a template for one in BAC in 2010 (please note: not factual dates for this example). 
 
If the application of technical patterns depends upon the premise that these patterns repeat themselves, what use is the observation of an historical pattern if it does not offer some predicative accuracy? It is not enough to be doctrinaire in our answer and provide anecdotal evidence of positive outcomes. We must provide a larger number of outcomes as evidence. 
 
Of course, no matter how large the sample size of the outcomes we present, the evidence will always be just a portion of the total number of possible outcomes across markets and across time. When we look at possible outcomes we must understand that these outcomes are not based on the market conditions of a particular moment. That would be unsatisfactory and biased. Because we cannot possibly know what will happen in any particular market, we must instead look at the estimating the character of all markets in a given condition. 
 
In the Stock Trends Inference Model the given condition is represented by the Stock Trends indicator combination. That combination is the aggregate of the Stock Trends trend indicator, the length of time the current trend category (BULLISH or BEARISH), the length of time of the current trend indicator, the 13-week Relative Strength (RSI) indicator value, the 1-week RSI +/- indicator, and the volume indicator. These indicators quantify and categorize market condition in terms of trend and price momentum. Distinct combinations of these indicators qualify particular trends by price momentum and volume characteristics. 
 
If we look at the current Stock Trends indicator combination of AAPL, for example, we can see that this stock is in the 31st week of being labeled with a (strong) Bullish indicator and that it has been in a BULLISH trend category for 52-weeks. Its 13-week Relative Strength indicator (RSI) value is 109, indicating AAPL has outperformed the S&P 500 index by approximately 9% over the past 13-week period. The current RSI +/- indicator is (+) , indicating the stock outperformed the benchmark market index in the past week. Finally, there is no Unusual Volume indicator, indicating that last week's trading volume was not high or low enough to be assigned either a high or low volume indicator. 
 
 
 
 
Taken as a composite, these indicators tell us that AAPL is in a relatively solid long-term trend. Given these characteristics of a stock's trend and its length of trend, as well as its price momentum, what does this particular categorization imply about future price movement? 
 
Of course, we cannot precisely know what is to happen in the future. All we can do is look upon what has happened in the past and make some kind of estimation of what will happen in the future. Using statistical methods we can translate past observations of what has happened into a probability statement about what will happen in the future. The Stock Trends Inference Model attempts to do this. 
 
Below is the current Stock Trends Inference Model report found under the Profile tab of AAPL-Q. 
 
The first section shows the Sample distribution plot and estimated returns distribution for three different periods - 4-week, 13-week, and 40-week. In this case the sample - derived from the 30-year history of Stock Trends data - is 616 records of stocks which sported similar Stock Trends Report indicator combinations to the current indicator combination of AAPL. From this sample we are measuring the subsequent price performance over the three different periods. 
 
 
Return(%) expectations for Apple $AAPL
 
 
 
 
Here we ask of this sample: what kind of returns (%) did other stocks have which previously exhibited similar trend and momentum characteristics as defined by the Stock Trends indicator combination? 
 
The green density plot for each of the three periods is displayed. Each shows how the returns were distributed. This plot shows where most of the returns tended toward (central tendency) as well as the variability of the returns (variance). We are interested in measuring central tendency and variance of the sample because with those statistics we can estimate the average return and variance of the population of all returns associated with this Stock Trends indicator combination. Remember, the population of all returns is much large than this sample size - it includes returns not in this database. It includes future returns - the returns investors are most interested in! 
 
Using statistical inference methods we can estimate the mean of a population within a certain range, or interval, and we can be certain of that interval to a defined degree. Here our model is 95% certain of the mean intervals. Since we are most concerned about the lowest estimate of the interval, we know that there is only a 2.5% chance that the mean of the population is less than the low end of the interval. 
 
For the investor it is more meaningful to interpret the mean interval of the population as the estimated return of a portfolio of stocks that have the same Stock Trends indicator combination.  From this theoretical portfolio we can make another important assumption: that returns of randomly chosen samples, when estimated as the portfolio population, will have a normal, bell-shaped distribution. This assumption is an extension of a well-understood probability theory rule: the central limit theorem. 
 
This assumption - and evidence - of randomness in market returns provides us with a very useful framework for making probability statements about the expected return of a stock. With an estimated population mean, an estimated standard deviation of the distributions we can derive probability statements about observing a return above specific values from a normally distributed sample space. 
 
In short, the Stock Trends Inference Model translates our samples into an estimated return and gives us the probability that a return will better a given, benchmark return. 
 
What should that benchmark return be? It's not difficult to see that the base return we should measure against is the return of a randomly selected stock. If we are measuring returns based on the randomness of outcomes of a categorized sample (our Stock Trends indicator combinations), the base return should be the return we would expect if we randomly picked a stock across the broad market. Indeed, any trading system results should be measured against the results of a randomly selected portfolio.  If you can't beat the monkey, why bother? 
 
The base period random return benchmarks are as follows: 4-week (0%), 13-week (2.19%), and 40-week (6.45%). Each of these returns are the return means of over 500,000 samples taken at random over a 30-year period. Not surprisingly, the annualized return of randomly selected stocks is basically equivalent to long-term market returns - 8%. This sobering fact should remind market timing traders that no matter what analytical framework used, the returns generated by a buy-and-hold approach must be discounted, regardless of what the market actually provided during a particular period. 
 
 
I'll be looking at Stock Trends Inference Model analysis in the future, and pointing out ways to turn this analysis into profitable managed trades. Also, I'll be introducing an additional new analysis under the Profile section. It is a pattern recognition analysis that also employs statistical inference. Expect this content addition very soon.  
 
Another recent content addition to the Stock Trends Reports on the website is the charting application. This is a third-party application provided by Tradingview. For subscribers interested in marking up a chart of a given stock, Try it out! It also provides additional content including current intra-day pricing (15-minute delay), recent news headlines, social media comments from StockTwits, as well as technical and fundamental data. 
 
 

Friday, March 07, 2014

Understanding our assumptions

The Stock Trends inference model is built around two central premises: (1) market conditions are non-specific to a particular security, and (2) market responses to market conditions are specific. These assumptions are crucial legs on which technical analysis stands. They state that price and volume patterns are homogeneous across markets – that a bull trend in one instrument is comparable to a bull trend in another, for instance – and that future price movements can be inferred or extrapolated from these patterns. Let’s better understand this analysis departure point.
The first premise might strike you as more of a theoretical foundation than an empirical one. How can we really say that market conditions – however defined – are structurally consistent among all stocks? How can the market conditions, at one point in time, of a highly liquid financial stock like Bank of America (BAC-N), for instance, compare to that of a technology stock like EchoStar Corp. (SATS-Q) or an industrial stock like Illinois Tool Works (ITW-N) at other points in time?
 
Average daily trading volume of BAC is over 100 million shares, while average daily trading volume of ITW is about 2.1-million shares and SATS only trades about 250,000 shares a day. The market cap of BAC is $175-billion. The market cap of ITW and SATS is $35-billion and $4.5-billion, respectively. There are significant differences in the size of the market for these stocks, and even bigger differences if we looked at small cap stocks that could be grouped with BAC based on our definition of equivalent market conditions – that is, similar Stock Trends indicator combinations. And certainly these stocks are different beasts in terms of their industry categories. Are price trends and price momentum in these various markets comparable?
 
When we say that market conditions are non-specific to a particular security we mean that the price mechanism balancing demand and supply is analogous, even if the range and scope of factors influencing that balance differs. Technical analysis places priority on price and volume change factors as inputs influencing a market equilibrium. Investors respond to the market through various signals of price, market breadth, and trading intensity. These market conditions are dynamic, constantly shifting the balance of supply and demand to a new equilibrium.
 
So, if the shares of Bank of America have been trending positively for two years but the relative price momentum over the most recent three month period is market-neutral – as the current BAC Stock Trends Report infers - we can say something qualitative about the return expectations of investors in BAC. Investors key on past returns - their stability as well as trajectory. As the character of returns change – increased volatility and trading volume, or diminished price momentum, for example – the relative demand for and supply of a security changes. It matters less that the market for the security is the size of BAC or the size of SATS – the same relative responses determine the change in price. Shareowners who want to capture returns or limit losses sell. Investors who see more value buy.
 
Because the Stock Trends indicator combinations codify a market condition (by categorizing trend, quantifying the length of trend and relative price momentum) we can apply our assumption about the non-specificity of market conditions and group indicator combinations. It is from these samples of ‘like’ indicator combinations that we can apply statistical inference methods.
 
However, we are applying these inference methods on a statistic of the sample – that is, subsequent returns (changes in price).  Here we are invoking our second premise – that market responses to market conditions are specific. The qualitative conditions of a market are assumed to be an input variable. The subsequent change in price is said to be a response variable. The measurement of that response is the key component of the Stock Trends inference model. We want to know which market conditions result in the best response – the best probabilities of higher returns.
 
This approach is quite different from the typical technical analysis you will find. Much of technical analysis has to do with time series analysis. In its most generic, simplest form you will recognise this as classical charting techniques. Indeed, trend and price support lines are tools used to extrapolate price trajectory. This is the form of technical analysis that presents opinions about price objectives. It is the technical analysis that prognosticates about where the market is headed.
 
The Stock Trends inference model departs from this kind of conjecture. Instead, it is a quantitative apparatus that suggests responses to market conditions are random, but centered around categorized populations. The model employs the trend categories and market metrics (RSI, volume indicators, etc.) as inputs, but its output is a probability statement. Elements of charting go in…but what comes out is a probability distribution. A stock is ranked highly not because its chart characteristics suggest it will rally. It is ranked highly because its probabilities of beating the market are favourable.
 
Previous editorials have emphasized the randomness of results. Also highlighted is the generalized assumption of a normal distribution of returns, which is the inherent distribution of random data. Evidence of randomness seems to challenge our second premise. How can we infer future price movements with such evidence? Much of technical analysis does not address this question. Indeed, the answer to it has to come from a quantitative science. The Stock Trends model attempts to reconcile with randomness by assuming it implicitly. It does that by inferring a normal population distribution. From this distribution we can calculate statements of probability.
 
Ultimately, the goal of this analysis is to provide a new ranking system. The system will allow us to evaluate existing Stock Trends reports like the Picks of the Week, or the Newly Weak Bearish reports. New reports can also be generated. These will highlight select stocks and ETFs with the highest probability of generating returns that are better than those expected for randomly chosen stocks.
 
Below is a heatmap and associated table of the current top 30 ‘select’ stocks based on this ranking system. The colour coding shows us which have higher mean returns relative to the expected returns of randomly selected stocks for 4-week, 13-week, and 40-week periods. The scale of green intensifies as the mean return exceeds the period base return (4-week: 0%, 13-week: 2.19%, 40-week: 6.45%). Mean returns in the immediate area around the period base return are yellow, while mean returns below the period base returns intensify in redness as they sub-perform (this group is comprised of superior performers, so red codes will be largely absent).
 
To qualify for this select list the lower band of the 95% confidence interval of the population mean must exceed the mean returns of randomly selected stocks. Statistically this tells us that we are confident that there is only a 2.5% chance that the mean return of the inferred population is below the period base return. From this group we derive the normal probability distribution using the population mean and standard deviation, and then calculate the probability that a return will exceed the period base return. Stocks are ranked in descending order of the probability they will out-perform the 13-week base period return.
 
 

Stock Trends Inference Model

Current Select stocks

 
 
 

Trend

Issue

Price($)

% chg

Vol(00s)

 

Computer Modelling Group (CMG)
30.04
2.0
2111
 
Caesar Stone Sdot Yam (CSTE)
59.12
9.9
13290
 
GAMCO Global Gold, Nat. Res. (GGN)
10.11
0.3
25165
 
Energy Transfer Partners LP (ETP)
55.53
3.3
52522
 
KapStone Paper and Packaging (KS)
31.79
2.5
30209
 
Lydall Inc. (LDL)
20.26
1.2
2441
 
Tahoe Resources (THO)
25.98
5.7
8695
 
ITC Holdings (ITC)
102.60
-1.2
17922
 
ECA Marcellus Trust I (ECT)
8.85
-2.4
4351
 
Aluminum Corporation of China (ACH)
8.93
-5.7
4646
 
iShares MSCI Canada E.T.F. (EWC)
29.18
0.7
48455
 
HomeAway, Inc. (AWAY)
45.87
-3.9
116454
 
Discovery Laboratories (DSCO)
2.64
3.5
45282
 
Universal Electronics (UEIC)
41.79
4.2
6093
 
CVS Caremark (CVS)
73.14
2.7
276007
 
Resolute Forest Products (RFP)
22.78
-4.6
103
REX American Resources (REX)
47.68
13.2
2776
 
Guggenheim 500 Pure Growth ETF (RPG)
74.91
1.5
9223
 
Investors Bancorp (ISBC)
26.52
3.8
13827
 
j2 Global (JCOM)
51.40
5.0
18158
 
Credit Suisse Group (CS)
31.37
-0.3
49564
 
Old National Bancorp (ONB)
14.03
4.7
36613
 
Covance Inc. (CVD)
103.56
0.8
15274
 
Goodyear Tire (GT)
26.87
1.2
201723
 
Noble Energy Inc. (NBL)
68.76
2.8
129630
 
EPAM Systems (EPAM)
41.93
0.1
14279
 
NTS Realty Holdings LP (NLP)
8.43
0.6
564
 
Guidewire Software (GWRE)
53.61
4.2
15058
 
Targa Resources Corp. (TRGP)
96.76
0.8
13167
 
Synergy Resources (SYRG)
10.59
5.2
30837
 



Below is the distribution curve of 13-week returns of stocks with similar Stock Trends indicator combinations to the current Stock Trends Report on Computer Modeling Group (CMG-T), the top stock in this select list.  We can see how favourable the probabilities are for CMG to return above the base 13-week random return of 2.19%, represented by the red vertical line. 

 


For 13-week returns distribution estimation, with 95 % confidence, the 13-wk mean return of the population of stocks with a similar Stock Trends indicator combination to CMG-T will be inside [ 5.59 %, 11.492 %].

Mean return 8.54% and standard deviation of 12.58

Assumed Normal Distribution:

For 13wk CLOSE P(Return > 2.19%)= 69.32% chance CMG will outperform the base return of a randomly selected stock. In the estimated population distribution (blue normal curve), all values to the right of the vertical red line at 2.19% are positve outcomes.

68.63% of sample returns are > 2.19%

Wednesday, February 12, 2014

The random outcome benchmark

Behind all of the statistical modeling Stock Trends is gradually unveiling there is an attempt to break down the weekly data reports into probability distributions that give the trader an estimate of the odds of success. Success is measured in terms of relative performance against the expected returns of a randomly selected stock. This benchmark needs elaboration.

The Stock Trends inference model defines the randomness of the market in a universal way - returns are not time specific. That means that we are referring to outcomes across all time frames, all markets, and all events. We are referring to a true population of returns.

This differs from the subjectively influenced range of outcomes that we see at any moment in time. For instance, at this moment in time the market might appear to present a certain bullish trend and typical analysis approaches build in expectations of price movement associated with aspects of the analysis (chart patterns, fundamental ratios, etc.). Those subjective evaluations of potential outcomes (whether the analysis reveals a highly bearish or highly bearish scenario) generally present only a subset of universal returns. These potential outcomes are rooted in expectations of the moment.

The Stock Trends inference model's random benchmark looks at all returns possible. Those returns are derived from every market type, including markets of ‘irrational exuberance’ as well as the gravest financial meltdown. Universal returns are market agnostic – they are not framed by the boundaries of the moment. That is true randomness. We do not know what to expect. Anything is possible.

When we look at large samples random returns match the long-term market expectations – basically 8 percent annually. Actually, the expected mean annual return of a randomly selected stock, across time, is about 8.6%. Taking period returns of approximately 500,000 random stocks from the Stock Trends 30-year weekly data, the estimated population parameters for the following periods are derived:

4-week mean return: -0.05%, standard deviation: 33.15
13-week mean return: 2.19%, standard deviation: 44.11
40-week mean return:  6.45%, standard deviation: 76.81
      
Obviously, the dispersion of results is quite wide. A random trade is as likely to be a double bagger as a money pit. Even more moderate ‘aggressive’ trading expectations are constrained by the same rules of the assumed normal distribution. Looking at the 40-week period for example, a random trade has a 48.1% chance of a return greater than 10%, but also has a 41.5% chance of a return less than -10%.

Assuming a normal distribution of returns for the population, we should be reminded that a binary implication of this is humbling for the trader. A trader’s odds of beating the mean return for any period are 1:2, or 50%. This is the situation most investors are in – they are at risk of entering the market at the worst of times or best of times depending on their investment life cycle, but will average out toward these mean values as we sample more and more trades over generations or multiple market cycles.

Most traders probably don’t think this way. Typically, they expect to be right and are trading because they believe they can do better than the market or that they are entering the market at an opportune time. After all, why trade if you can’t do better than an index fund or, alternatively, by not exposing to equity risk at all?

The Stock Trends inference model looks at trading as a kind of binary random outcome – heads to beat the market expected return, tails to do worse. Anyone who has experience in flipping coins knows that even a ‘fair’ coin can deliver an outcome – even lengthy series of outcomes - that seemingly defies the probabilities. A fair coin can deliver 10 consecutive heads (or tails) in the first 10 flips, for instance, 0.0977% of the time. More relevantly, over the span of 50 flips the probability of 10 consecutive heads (or tails) is 2% - certainly not impossible. This is known as a ‘run’, and every active trader has experience with both winning runs and losing runs. Every trading system will produce them.

Let’s look at our own Stock Trends trading systems. This is a distribution of loss runs of the Stock Trends NYSE Portfolio #1 trading record:

In this trading record of 583 trades there are 4 loss runs of 10 or more (maximum loss run is 13). That would be our string of ‘tails’ on the flip of the coin. In the real world of trading that is also called a drawdown. It’s an ugly thing; and a painful one. But we can see how loss runs factor into every trading system - every active trader must try to limit them.

Limiting the extent of losses is the primary function of a money management system. Stock Trends model portfolio trading systems have a few elements of loss protection that are inherent. First, they use a method of position sizing. All trades are made with a specific dollar value. This is a topic of discussion on its own, and I have written about it in previous editorials, comparing fixed dollar trades against variable or random amounts. Another aspect of loss protection is in the exit strategies – the stop loss triggers and the indicator triggers. However, over-all trading results will markedly improve if loss runs can be minimized. That means improving your success ratio: the win/loss ratio.

The Stock Trends inference model is a quantitative method to improve an investor’s trade expectations in a world of randomness. We look for Stock Trends indicator combinations that represent our best chance of being on the right side of a coin toss.

Here is a heatmap showing the current top ranked stocks of the S&P 100 index according to the Stock Trends inference model:

see Stock Trends editorial, Ranking expectations for explanation of the ranking.
Devon Energy (DVN-N), Nike (NKE-N), and Fedex (FDX-N) top the list of these big cap stocks.

Monday, February 03, 2014

Looking for an edge

The quantitative analysis presented here is an attempt to confront randomness in the stock market. Too often technical analysis is presented in a manner that misrepresents the nature of the market. In focusing on pattern recognition it is easy to make the assumption that patterns direct the market. It is a natural human condition to look for patterns and assign meaning to the chaotic world around us. However, there is danger in assuming that randomness is an unfortunate by-product of the dynamics of order. To the contrary, there are aspects of order in randomness, but we should never assume that outcomes are assured beyond the bounds of random probabilities.

That’s a tough statement to make in the investment business. There’s a lot of money staked on the idea that we can understand the market. Investors pay handsomely for that notion: management fees, time and money invested on analysis and guidance, among many costly investment expenses. Nothing is more costly, however, than the investment losses that occur because investors put capital at risk beyond the limits of random probabilities. We lose more money because we think the market has order when in fact it does not. Of course, financial institutions cannot present themselves as purveyors of randomness. That’s a business that goes by another name.

Stock Trends was designed based on the idea that we could categorize order in the stock market. Trend analysis is about assigning order to price movement. Reversion to the mean aspects of price momentum analysis has some application toward randomness, but the type of momentum analysis Stock Trends emphasizes is more aligned with harnessing forces of order evident in mass psychology. Exposing market randomness, at first glance, makes Stock Trends look like another snake oil gimmick – one of many peddled in the business of guiding investors. Is it possible to reconcile our trend analysis with the randomness of market outcomes?

The truthful answer to that question is… perhaps not. We can assume that many stakeholders with immense resources in the investment business are grappling with the same problem. There’s a big demand for quantitative analysts in the financial sector for a reason. It’s a battle with randomness that has forced the investment business toward a data science solution.
My solution for Stock Trends is to reframe our analysis question. It’s a solution that shifts our focus away from the traditional trend analysis framework – one that is based on notions illustrated by select samples of pattern evidence – to a framework that is data driven and presents all outcomes, supporting and non-supporting. Every technical analyst – honest ones, anyway – can show you ten contradicting charts for every tidy chart that illustrates a particular pattern. Our analysis question is now: what does the data really tell us? From that answer we can propose a trading strategy.

In previous editorials I’ve introduced a statistical inference model that attempts to translate sample observations into estimations of population means based on the indicator combinations presented in the Stock Trends Reports. The primary premise: that the Stock Trends indicator combinations represent distinct characteristics of a market condition. That condition is defined by the trend indicator, the length of trend category (major trend counter) and indicator (minor trend counter), the relative intermediate price momentum (Relative Strength Indicator) and weekly price performance (+/- indicator), as well as the evidence of unusual trading volume (volume indicator).

Here we are labelling across markets. The conditions of supply and demand represented in these indicator combinations are homogeneous – grouping the current market trend characteristics of iconic Apple’s big cap stock (AAPL-Q), for instance, with that of little-known W.R. Grace & Co. (GRA-N) on May 18, 2012.



The purpose of the inference model is to give us an estimated population mean and standard deviation from which to build a probability distribution – this on an assumption of randomness in the population of possible outcomes given the market condition (as defined by the indicator combination). Basically, we are trying to come to terms with randomness by assuming it, and looking for estimated indicator combination probability distributions that have a leg up on the expected random outcomes that include the universe of stocks.

Let’s again have a look at an example. It’s best that we look at the most easily defined Stock Trends event – the Crossover. We call this an event, but it is in reality a non-event. Strictly speaking it is a mathematical event defined by the crossing of a shorter-term (13-week) moving average trend line and a longer-term (40-week) moving average trend line – or more properly when the 13-week average share price moves either higher or lower than the 40-week average share price. This is not the kind of event that necessarily feeds back on a market for a stock, although in some circles it is promoted as such. However, it is an important event in our analysis that isolates changes in major trend category. It pinpoints when the Stock Trends parameters move between BULLISH and BEARISH.

Because in our inference model indicator combinations are supplemented with trend length qualifiers when querying the data for ‘like’ combinations, and the Crossovers by definition start a new trend, the Stock Trends trend counter for Crossover stocks is not much use for comparison. All Crossovers have trend counters 1/1. The way I have chosen to deal with this is to ascribe the length of the previous trend category (major trend counter) when looking for similar instances of Crossover stocks. This maintains an influence of time on the grouping of trend category changes as well. This is an important note to make about the Crossover stocks analysed.

Ford Motor Co. (F-N) is currently a Bearish Crossover (). It had a Bullish trend for 60 weeks, but the stock has faded off its resistance level at $18. Its Bullish trend did reward the Stock Trends S&P 100 Bullish Crossover Portfolio with a respectable 28% return. The assumed implication of a Bearish Crossovers is that it is a trade exit signal. Conversely, a Bullish Crossover is our typical trade entry signal. Accordingly, Ford was sold on the Bearish Crossover.



But what does our inference analysis really say about Crossovers? We’ve looked at some statistical analysis of that previously, but let’s evaluate how our probability guidance would have turned out for Ford’s stock over the past 30-years.

The first thing to note in the following data is that not all Ford stock's Crossovers are represented. Some of the Crossovers indicator combinations did not have a large enough sample size to complete the analysis. As such there are only 37 of the total 56 Crossovers that have occurred since 1980. A notable Crossover missing is that of May 8, 2009, a Bullish Crossover () that introduced a major Bullish trend.

 


Both sets of results - Bullish and Bearish Crossovers - are sorted by the average probability that the stock will return better than the expected mean random outcome - our inference model. We discover the following:


For Bullish Crossover events where the mean probability of Ford's stock (F) besting the expected return of randomly selected stocks was greater than 52%, the stock beat the expected random return 17 out of 21 period-returns (81%) [green cells represent returns that outperformed the expected random return]. This compares to 15 out of 36 (42%) when the mean probability is less <= 52%.

For Bearish Crossover events where the mean probability of Ford's stock (F) besting the expected return of randomly selected stocks was less than 48%, the stock underperformed the expected random return 8 out of 9 returns (89%) [red cells represent returns that underperformed the expected random return]. This compares to 29 out of 42 (69%) when the mean probability is >= 48%.


This example tells us that our chances for a successful trade - that is, doing better than the return we can expect on a randomly selected stock - are enhanced by the inference model. As the average probability (across time periods) is outside some deviation (here above 52% and below 48%) of the probability of random stocks, the chances of a trade meeting our goals improve.

This explanation may seem complicated at this time, and future editorials will provide more examples to help us grasp the meaningfulness of the inference model. In the end, investors are looking for a slight edge, even in a game of chance.

Another important result of this analysis is that sometimes the inference analysis contradicts our expectations as far as the trade implications for the Stock Trends indicator. Sometimes a Bullish Crossover, based on the specific indicator combinations, presents an estimated return below the expected return of randomly selected stocks. Sometimes a Bearish Crossover, based on specific indicator combinations, presents an estimated return above the expected return of randomly selected stocks.

An example of this is found in the analysis of the current Stock Trends indicator combination of Ford's stock (F). Here are the estimated probability distributions over the 4-week, 13-week, and 40-week periods.




For 4-week returns distribution estimation, with 95% confidence, the 4-week mean return of the population of stocks with a smilar Stock Trends indicator combination to F will be inside [0.006%, 1.692%].

 Mean return  0.85 and standard deviation of 9.63

 For a Normal Distribution:
 For 4wk CLOSE P(R>0)=53.51
 For 4wk CLOSE P(R> 0)=46.49

For the 4-week period the probability of F returning better than the expected return of a randomly selected stock is 54%.


For  13-week returns distribution estimation, with  95 % confidence, the  13-week mean return of the population of stocks with a similar Stock Trends indicator combination to  F will be inside [ 2.531 %, 5.434 %]

Mean return  3.98 and standard deviation of 16.42

For a Normal Distribution
 For 13wk CLOSE P(R> 2.19)=54.35
 For 13wk CLOSE P(R>2.19)=45.65
52.3% of sample returns are >2.19%

For the 13-week period the probability of F returning better than the expected return of a randomly selected stock is 54%.



For  40-week returns distribution estimation, with  95 % confidence, the  40-week mean return of the population of stocks with a similar Stock Trends indicator combination to  F will be inside [ 5.9 %, 11.844 %]

Mean return  8.87 and standard deviation of 32.48

Normal Distribution

 For 40wk CLOSE P(R> 6.45)=52.97
 For 40wk CLOSE P(R>6.45)=47.03

50.77% of sample returns are > 6.45%

For the 40-week period the probability of F returning better than the expected return of a randomly selected stock is 53%.

The inference analysis is contradicting the trading implication of Ford's Bearish Crossover (). This is the kind of information I hope to make more readily available on the Stock Trends website.