Showing posts with label trading. Show all posts
Showing posts with label 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.

Friday, April 11, 2014

Stock Trends Inference Model Select stocks

The new Stock Trends Inference Model (ST-IM) Select stocks report has been published for a few weeks now, and reports for previous weeks are also being populated gradually. Subscribers can monitor the current selections to see how they perform. The inference model is an application that translates the Stock Trends data into a unique actionable tool for investors. Let’s review the methodology again.

The ST-IM Select stocks report includes all stocks with a Stock Trends indicator combination that show statistical evidence of predicting future performance better than base period random returns (see The random outcome benchmark). For instance, last week’s ST-IM report for the New York Stock Exchange includes the SPDR Retail exchange traded fund (XRT). The current Stock Trends Report for XRT shows that the ETF has been in a Bullish category for 120 weeks and has sported a strong Bullish indicator for the past 7 weeks. It is under-performing the S&P 500 by 5% over the past 13-weeks (RSI 95), but out-performed the benchmark market index last week (RSI +/- shows a +). There is no unusual volume indicator.

This Stock Trends indicator combination is matched by 63 similar combinations in the 30+ year Stock Trends data history. When these groupings are applied stocks with a share price lower than $2 are not included with stocks with a share price $2 and higher. Also, indicator combinations with weekly volume of trading below 100,000 are grouped separately. The resultant sample that fits the current Stock Trends indicator combination of XRT is shown below:

     weekdate exchange symbol  X4wk  X13wk  X40wk
1  1983-05-20        N    CEG -6.41  -2.43  -1.55
2  1986-07-11        N     DF -4.26 -13.03  -8.78
3  1986-11-07        N    CNL  0.69   1.38  -1.50
4  1987-09-11        N    TIN  0.00 -29.41 -18.49
5  1992-12-25        N    PPL -1.36   7.60   7.17
6  1993-04-16        N    CCK -6.72 -11.54  -2.23
7  1993-05-21        N    DSM  1.16   3.56  -6.07
8  1994-01-21        N     SO -5.50  -8.09  -7.54
9  1995-05-26        N    SWY  6.26   5.93  58.72
10 1995-07-14        N    HMA 12.67   9.93  73.97
11 1995-07-21        Q   ABCW  6.18  28.96  27.30
12 1996-05-03        N    IVC -0.95  16.19  -1.90
13 1996-06-28        N    BDX -6.68   9.67  13.41
14 1997-04-04        N    RDN 12.51  43.51  67.53
15 1997-05-30        N    WBS  9.94  31.35  58.02
16 1997-05-30        T    NDN  9.54   3.49  22.02
17 1997-05-30        N    NWL  3.42   3.27  28.76
18 1997-06-06        N    BAC  7.49 -10.09   9.36
19 1997-06-06        N    MTB  2.69  10.45  43.28
20 1997-06-13        N    BBT  6.26  20.98  49.68
21 1997-06-27        N    PDE  9.53  51.13  12.37
22 1997-07-04        N     BA  6.00  -5.78   0.00
23 1997-07-18        N    CLI 11.30  17.01   9.82
24 1997-07-25        N    ESS -3.44   4.17   2.07
25 1997-08-15        N    UVV -1.39   4.52  -1.59
26 1997-10-17        N    BCE -2.41   9.22  36.60
27 1998-02-13        N    TJX 16.49  25.91  31.26
28 1999-07-30        N     GD -7.34 -17.65 -15.33
29 2002-12-06        N    BKT  0.13   3.17  -8.24
30 2003-05-23        Q   PVTB  4.91  40.30  94.47
31 2004-12-24        Q   PMTI  9.68  17.77  12.33
32 2005-03-25        Q   CHRW -8.19   8.19  42.42
33 2005-06-17        N    ATR  0.84  -2.41   9.36
34 2005-07-08        T    BXE 20.99  28.48  15.99
35 2005-07-08        N    MEE 12.93  17.83 -11.68
36 2005-07-22        Q   ESLR -9.35  25.80 109.35
37 2005-08-26        T    CNR -1.63  13.66  21.82
38 2005-12-02        Q   LUFK  7.04  15.45  26.05
39 2006-01-06        N    CVD 10.73  13.87  30.61
40 2006-01-06        N    FTO 11.58  43.94  42.36
41 2006-01-27        N     GD  2.87  10.75  19.04
42 2006-02-24        T FDG.UN -4.29 -17.25 -48.02
43 2006-09-29        N    KSU  8.68   6.11  42.11
44 2006-11-24        Q   GOLD -1.01   6.61   5.46
45 2007-02-23        N    EME -0.75   3.15 -13.42
46 2007-05-04        N    AFG  0.56 -21.43 -23.83
47 2011-03-11        N    TSI -0.18  -1.85  -4.07
48 2011-06-03        Q   AAPL -0.05   8.91  58.74
49 2011-11-18        N    KED  3.96  20.22  26.69
50 2012-01-13        N   PRGO -3.82   7.34  21.39
51 2012-02-03        N    WCN -4.10  -4.40  -4.49
52 2012-02-03        T     CU  9.45  14.68   5.26
53 2012-02-17        N    MJN  5.63   7.27 -10.74
54 2012-02-24        T    THI  1.65   4.11 -12.52
55 2014-01-03        N    STC -1.07   1.83     NA
56 2014-01-24        Q   CHTR -4.82     NA     NA
57 2014-02-07        T    RCH  8.38     NA     NA
58 2014-03-21        N    AIG    NA     NA     NA
59 2014-03-21        N    MMM    NA     NA     NA
60 2014-03-28        N    DDM    NA     NA     NA
61 2014-03-28        N   UDOW    NA     NA     NA
62 2014-03-28        T    MSI    NA     NA     NA
63 2014-04-04        N    XRT    NA     NA     NA
64 2014-04-04        Q   FELE    NA     NA     NA

The table shows the week of the matching combination with subsequent (post-observation) returns for 4-week, 13-week, and 40-week periods. Some of the records at the bottom of the table are too recent to have generated returns for the subsequent periods and are denoted with a “NA”.

The sample reveals that although there are similar records throughout the data history, they cluster around certain market environments or moments in time. These clusters are important aspects of the samples that we can evaluate in another model, but for the purposes of this inference model they are not significant. We are looking to define a population – all stocks that have a similar quality of trend and price momentum as defined by the Stock Trends indicator combination. From the sample above we can estimate the relevant parameters of this population.

The sample subsequent returns (4-week, 13-week, 40-week) are the statistics we measure. Here is the summary for the three periods:

For 4-week CLOSE*  returns distribution estimation, with 95 % confidence, the 4wk CLOSE mean return of the population of stocks with a similar Stock Trends indicator combination to XRT will be inside [ 1.206 %, 4.282 %]
[1] "With probability of 2.5 % we will have a mean return below 1.206"
Mean return 2.74% and standard deviation of 6.94
Normal Distribution
For 4wk CLOSE P(R> 0)=65.37% probability that the 4-week return will be above the base 4-week return (0%).

57.89% of 57 sample returns are >0%



For 13-week CLOSE returns distribution estimation, with 95 % confidence, the 13wk CLOSE mean return of the population of stocks with a similar Stock Trends indicator combination to XRT will be inside [ 5.044 %, 12.495 %]
[1] "With probability of 2.5 % we will have a mean return below 5.044"
Mean return 8.77% and standard deviation of 16.51
Normal Distribution
For 13wk CLOSE P(R> 2.19)=65.49%  probability that the 13-week return will be above the base 13-week return (2.19%).

72.73% of 55 sample returns are >2.19%



For 40-week CLOSE returns distribution estimation, with 95 % confidence, the 40wk CLOSE mean return of the population of stocks with a similar Stock Trends indicator combination to XRT will be inside [ 10.272 %, 24.276 %]
[1] "With probability of 2.5 % we will have a mean return below 10.272"
Mean return 17.27% and standard deviation of 30.73
Normal Distribution
For 40wk CLOSE P(R> 6.45)=63.76% prbability that the 40-week return will be above the base 40-week return (6.45%).

57.41% of 54 sample returns are >6.45%

* Note: The Stock Trends Inference Model uses end-of-period closing price returns. See Variability of returns
What does this tells us? First, it is understood that generally we cannot precisely know the true population. We can only estimate it’s characteristics from a given sample. Equipped with two sample statistics – the sample mean (average) return and sample standard deviation (a standardized measure of variance of the returns) – we can estimate the population mean return and standard deviation (both known in statistical parlance as parameters). This magical property you can investigate further in many statistical books that introduce concepts of statistical inference.

In this example we can see that the lowest value of the interval estimate of the population mean is above the mean return of random returns in each of the three periods. This implies that we are pretty certain that the mean return of this population is higher than the random return benchmarks. If we assume a normal distribution of returns for the population – which we do because our assumption is that returns are random – then we can use another statistical method to give the probabilities that XRT will return above the random mean return.

The sample density distribution is filled in green. The assumed population distribution - a normal distribution - is outlined in blue. The vertical yellow line indicates the estimated population mean return. The vertical red line indicates the base return of a randomly selected stock.  
In the case of the 13-week period ahead, the Stock Trends inference model posits that there is a 65.5% chance that XRT will return above 2.19%. That is better than the 50% chance a random return will generate a 13-week return better than 2.19%, but we should always remember that unless a probability is 1 (100%) there is no certainty. You can always roll a negative outcome even if the probability of a positive outcome is 99%. However, a 65.5% chance is an edge a trader can use.

The ST-IM report gives us a weekly round-up of stocks that have at least a 55% probability of generating a 13-week return better than 2.19%. There are other indicator combinations that also share this property, but these are the ones that meet the criteria of having a confidence interval above the base mean return of each period (others may have lower estimates in the interval that fall below the base mean return). These are the ones that we are most certain will have a population mean return above the base return of every period.

Another important aspect of the Stock Trends Inference Model demands more attention. Each ST-IM report represents a sample of a new population, namely all stocks that fit the model criteria. The Central Limit Theorem states that the mean return of random samples from this population will be normally distributed (bell-shaped). We can also estimate that a portfolio of stocks randomly selected from the ST-IM reports will return above the base market return.

Let’s experiment. We can construct many randomly selected sample portfolios from the ST-IM Select stocks reports, with equal amounts invested in each stock or ETF. What kind of 13-week returns were generated?

There have been 5,905 ST-IM Select stocks in the past year that generated subsequent 13-week returns (ST-IM Select reports from April 4, 2013 to January 3, 2014). This sample can be summarized as follows:

The sample density distribution is filled in green. The vertical yellow line indicates the sample mean return. The vertical red line indicates the base return of a randomly selected stock.  


  vars    n mean    sd median trimmed  mad   min   max range skew kurtosis   se
1    1 5905 8.75 19.89    6.4    7.11 12.6 -59.5 336.8 396.3 2.67    22.65 0.26

The mean (average)13-week return of these ST-IM Select stocks is 8.8%. The maximum 13-week return was 396%, the biggest loss 60%. Our inference model directs us toward stocks that have a higher probability of returns greater than the mean 13-week return of randomly selected stocks – 2.19%. The results confirm that – 64% of ST-IM Select stocks had a return greater than 2.19%. But how did these ST-IM Select stocks do in comparison to the benchmark market indexes? The following gives a summary of the Stock Trends RSI values of the select stocks 13-weeks after the selections:

  vars    n   mean    sd median trimmed   mad min max range skew kurtosis   se
1    1 5905 104.06 18.91    101  102.49 11.86  37 417   380 2.72    23.44 0.25

The mean Stock Trends RSI is 104. This tells us that had we invested in all of these ST-IM Select stocks our performance would have exceeded the market outcomes – we would have done better than trading simultaneously in a benchmark exchange traded fund like the SPDR S&P 500 ETF (SPY).

Obviously, it is not practical to look at the total of these numerous selections. We would have had to trade a much smaller number of ST-IM Select stocks. It’s difficult to isolate which subset of ST-IM Select stocks would have generated the best returns in this distribution (although I will try to do this in the future using data mining analysis techniques), but we can estimate the average or likely return attainable by random sampling.

How would have investor done if he randomly selected small portfolios of stocks from the ST-IM reports? For example, what results would have been attainable if we randomly selected five (5) stocks from the ST-IM reports and measured subsequent 13-week returns of these portfolios? Does the ST-IM model deliver superior returns for a retail trader?

If we take 1,000 random portfolios of 5 stocks from our sample, the following distributions of portfolio returns and RSI values is evident after the 13-week period for each portfolio:

The sample portfolio returns density distribution is filled in green. The vertical yellow line indicates the portfolio mean return. The vertical red line indicates the base return of a randomly selected stock.  


  vars    n mean   sd median trimmed  mad    min   max range skew kurtosis   se
1    1 1000 8.53 7.72   7.72    8.11 7.03 -13.64 46.08 59.72 0.71     1.48 0.24
The mean 13-week return of these portfolios is 8.5%. That translates to an annualized return of 34%. Of these 1,000 random portfolios, 79% generated a 13-week return greater than the base period return of 2.19%.

Below is a summary of how these portfolios did relative to the benchmark indexes over these 13-week periods.

The sample portfolio post-trade 13-week RSI density distribution is filled in green. The vertical yellow line indicates the portfolio mean post-trade RSI. The vertical red line indicates the base benchmark index.


  vars    n   mean   sd median trimmed  mad  min   max range skew kurtosis   se
1    1 1000 103.83 7.49  103.2  103.44 6.82 82.4 140.2  57.8 0.66     1.31 0.24

The mean 13-week RSI is 104. This tells us that the random portfolios are outperforming the market, on average, by about 4% in these13-week trades. Take note that although transaction costs are not discounted here, we are comparing against an active trading of a market index, not a buy-and-hold strategy. A buy-and-hold strategy can be compared against the ST-IM portfolio annualized mean return of 34%. The S&P 500 index is up 20% in the past 12-months; the S&P/TSX Composite Index is up 17%. In this comparison the ST-IM annualized return should be discounted for transaction costs.

Subscribers to Stock Trends Weekly Reporter should feel quite confident in actively trading the highlighted stocks in the weekly ST-IM Select stocks report.

Learn more about the Stock Trends Inference Model at www.stocktrends.com

Wednesday, February 27, 2013

First steps toward quantitative trading


Finding the right combination of indicators is an important launching point for technical traders. Fine tuning different charting constructs, different momentum and trend indicators and back-testing results - that's the life of many market timers. Indeed, optimizing indicators and trading systems is a growing part of the investment business, as much with wealth management institutions as among the many retail traders who live by the success of their algorithms. In its own way, Stock Trends is part of this movement toward quantitative trading.

Most quantitative trading runs through finely tuned statistical models that guide both trading systems and portfolio management. The Stock Trends analysis is more static in terms of the indicators used, but seeks to optimize applied trading systems within the given parameters. The toolset used here is basic: a moving average study, a momentum indicator, and a volume trigger. But together these elements provide a powerful - and simple - means of engaging the market on a quantitative level. Each report Stock Trends publishes can be used within the framework of a trading system.

Optimizing results through statistical modelling is a multi-step process. The first thing that must be achieved is to understand your data. It is important to be able to describe its characteristics and to determine the independent and dependent variables. I have started that process in recent editorials by generating some statistical output of the Stock Trends data. The next step is to break down those descriptive statistics by category. Each subset of data that is pulled from the data history can be grouped and assessed for differences in results of the output variable - namely, the post-observation performance of individual stocks or ETFs, or the probable outcomes based on statistical predictive models.

With a given combination of Stock Trends variables, for instance, are there sub-groups that have different characteristics. We can seek to ask questions like: what are the differences in central tendencies and the distribution of results for low priced stocks compared to high priced stocks? Does price momentum propel small cap stocks higher compared to large cap stocks? Do certain sectors perform better for the momentum trader? There are many of similar questions we can evaluate, and all would be important ones to answer when developing a trading model.

Building on last week's editorial, let's take another sample of the Stock Trends data and see what it can tell us about different categories of stocks. Of particular interest is whether we can identify any divergence of performance statistics between stocks based on their share price and the Relative Strength indicator. The Stock Trends Picks of the Week report (available to subscribers of Stock Trends Weekly Reporter) provides an interesting sample of the data for discovery of important relationships between the variables. Last week we looked at statistics of the entire sample; here we group the data and compare results.

Again taking a sample of Picks of the Week selections since the beginning of 2012 until February 8,2013 we can create new categories for the share price and Relative Strength indicator and group by ranges.

Share price ranges
$2.00 - $4.99
$5.00 - $9.99
$10.00 - $19.99
$20.00 - $49.99
$50 - max($800)

Relative Strength Indicator (RSI) ranges:100-104
105-109
110-119
120-149
150-max(800)

These groupings are arbitrary, and not based on any statistical method to create bins (groups). Nevertheless, they help us categorize the data in terms or ranges that are easy to understand.
So how do the statistics for the percentage change in price (to the current end date, February 22, 2013) break out for these groupings?

Below is a table, ranked by median percentage change of the groups (median represents the middle value of observations). It gives us a breakdown of the number of observations, as well as some important metrics of central tendency and distribution of results.

price group($)RSI groupnumbermeanstandard deviationmediantrimmed meanminmaxrangeskewkurtosis
(20,50](150,800]2915.5740.6814.7014.50-69.60117.10186.700.27-0.22
(50,800](99,105]3808.4014.558.258.24-71.80102.20174.000.398.74
(20,50](110,120]6988.7022.407.408.05-70.10172.40242.500.976.46
(10,20](120,150]4049.4631.837.308.03-75.90138.20214.100.651.43
(50,800](105,110]2646.9916.826.907.51-49.6058.00107.60-0.290.69
(20,50](105,110]5617.8817.686.807.53-57.00110.30167.300.604.30
(20,50](99,105]7018.4015.956.507.59-50.00101.00151.000.673.85
(50,800](110,120]3117.9519.356.307.54-44.70106.80151.500.492.09
(10,20](110,120]4207.1526.356.106.55-98.30156.80255.100.593.68
(5,10](105,110]1186.3730.665.754.66-91.20150.00241.201.265.40
(50,800](120,150]1107.5325.555.757.38-55.9062.50118.400.00-0.07
(10,20](105,110]2876.9621.315.206.57-64.00104.10168.100.362.43
(10,20](99,105]3236.6520.784.805.97-98.3096.40194.700.144.63
(5,10](110,120]2699.2334.144.307.39-92.00127.10219.100.611.08
(5,10](99,105]1235.4118.464.104.83-58.0089.40147.400.844.67
(20,50](120,150]3906.6830.643.754.49-71.00168.10239.101.304.43
(5,10](120,150]3363.4633.311.201.38-89.40142.60232.001.022.96
(1.99,5](105,110]596.9634.590.003.97-65.10114.70179.801.011.21
(1.99,5](99,105]595.8532.02-1.101.87-41.70120.20161.901.603.13
(1.99,5](110,120]1474.3144.33-1.800.84-85.60277.70363.302.059.51
(5,10](150,800]775.6566.87-2.00-3.09-79.90352.40432.302.388.75
(1.99,5](120,150]2897.8953.54-3.001.69-88.80228.10316.901.332.46
(10,20](150,800]540.3161.09-4.50-3.51-95.10176.40271.500.680.30
(1.99,5](150,800]1706.1262.25-4.70-1.92-84.90501.80586.703.4322.18
(50,800](150,800]814.7558.73-14.0514.75-38.60109.20147.800.59-1.58

See full table and article at www.stocktrends.com

As with most tables, the first thing that jumps out is the extreme values. In particular, at the bottom half of the rankings are stock picks that had share prices between $2 and $5, across RSI values. The Picks of the Week report during the period was least populated by stocks in this price range. It is clearly the most variable price group, and also the poorest performing as shown by the low values for the median and trimmed mean (trimmed mean here excludes the top and bottom 10% of observations).

However, with variability also come the outliers - those observations we trim in statistical analysis. In the statistical world outliers are problematic. For some traders, it's their holy grail. It's the grand slam home run they celebrate. Here it would include the 500% gain on the November pick of Novogen Ltd. (NVGN), or the 277% gain of the January 2012 Santarus Inc. (SNTS) pick - among a number of other very profitable trades.

Nevertheless, when modeling a trading system it is always most important to understand the risk-reward balance. Attempting to capture higher returns on individual trades can be self-defeating. It is far better to model a system that keys on more predictable results, with low variability and a distribution that offers the best chance of long-term profits. The groupings in the top half of the table presented here would represent the more controlled parameters.

Below is a plot that compares the mean (average) percentage change in price for Picks of the Week in the sample (with a 95% confidence interval represented by the vertical bar). Also presented are Box Plots that give a visual representation of the distributions of the percentage change in price by Stock Trends RSI category range for each share price grouping.




Based on this sample of data we could focus on certain price and RSI ranges when evaluating the Picks of the Week report. For instance, we notice that relatively higher priced shares with high price momentum (high RSI values) performed better. More generally, though, it seems that stock picks with a share price above $20 provide the most consistent results. If we take a subset of the Picks of the Week sample with share price >= 20, we find the following distribution:

If we limit our analysis to Picks of the Week with a share price of $20 or greater, what kind of performance could we expect? Assuming that an investor could randomly select 5 different Picks of the Week over the period, the statistical breakdown is as follows:

This distribution is for 1000 random samples of 5 Picks of the Week, share price >= $20. Here we can see that the distribution is closer to a normal, bell-shaped distribution.




Minimum1st QuartileMedianMean3rd QuartileMaximum
-19.55.84512.7713.5220.7658.70



numbermeanstandard deviationmediantrimmed meanminimummaximumrangeskewkurtosis
100013.5212.0112.7713.11-19.5058.7078.200.390.75

 See full table and article at www.stocktrends.com


These descriptive statistics of categories are just a starting point. We should also take other samples of the Picks of the Week data. This simple analysis is presented to show that the RSI indicator can be modeled in different ways to optimize on specific variables. In order to develop a trading model we need to delve deeper into the variance and correlation of the Stock Trends indicators as well as other market data variables like trading volume.

This particular exercise, though, helps us look at the Picks of the Week report (which is a specific sample of stocks that exhibited a particular combination of Stock Trends indicators) more constructively in terms of quantitative trading. Although there are levels of charting analysis that help pinpoint technically attractive trades within the Picks of the Week report, systematic traders should understand the importance of discovering the variable constraints that correlate with minimizing variance in trading results. In particular, we can learn how the Stock Trends indicators can guide us toward developing effective trading systems.

Wednesday, February 20, 2013

Stock Trends Picks of the Week: a statistical look


The primary action matrix published here is the Stock Trends Picks of the Week report. These reports are groups of stocks, organized by exchange, that match a defined criteria or combination of variables. Each of these observations are results (roughly stated here) of the following query: select stocks and ETFs, valued over $2, that have a Stock Trends Weak Bearish () or Bullish Crossover () trend indicator, a minimum level of trading volume, and a Relative Strength indicator of at least 100. Those that are Weak Bearish must also have a high probability of being a Bullish Crossover within three weeks.

This weekly screen focuses on Weak Bearish and Bullish Crossover stocks and ETFs for a simple reason: this is the transitional trend moment where issues are theoretically primed to begin a new bullish trend. Although the parameters of Stock Trends are by definition lagging, the assumption is that the long-term trend has or will change category. Sometimes arriving late to the party, these selections still arrive in time to have the forces of trend work for the trade. That is the modus operandi for the Picks of the Week report.

However, the report does not filter down to deeper levels of categorizing observations, and as a result the list is too extensive to use without additional filtering. It is really up to the investor to match the trend qualities that are presented and the technical merit of each potential trade. That is an important question: how do you isolate the best trading opportunities from the Picks of the Week report?
 
The answer to that question does not come easy, and I won’t attempt to answer it in this editorial. Instead, let us just say for now that one way is to draw at random from the Picks of the Week report. Before we assign value to the report itself – never mind finding the optimal trade within the report – it is important to know how outcomes of the report stack up against random outcomes more generally. Will random selections from the Picks of the Week report yield better results than random selections from the broader population – namely, all stocks and ETFs? Surely, there should be a statistically significant difference in the two probable outcomes, otherwise the Picks of the Week report lacks credibility.
 
Before we look at comparisons between random sample performance of the Stock Trends Picks of the Week and from a broad sample of the data population, we can get an understanding of the central tendencies and distribution of random samples of the Picks of the Week report. For instance, if an investor simply bought 5 different random Picks of the Week selections – what would be the statistical representation of those choices? This kind of mean analysis of random samples is a common statistical method in probability models.
 
Let’s take a sample of the Picks of the Week report: all selections, across all exchanges, since the beginning of 2012. The sum of the weekly picks during this period is 6,599. That’s a big grouping and includes all picks right up to February 8, 2013. The inclusion of very recent Picks of the Week (those in the last month, for instance) is problematic in that it does affect central tendency and distribution of the positive returns, but not in a more significant fashion than the use of “end-of-period” returns.
 
There are obvious problems in measuring results for a given period. For instance, stocks may reach a high and subsequently retreat, thereby under-reporting possible results if a simple end-of-period statistic (based on the most recent closing price) is used. Also, in practical terms, stocks that have hit stop levels may have been sold before the end period, thereby reducing the amount lost on the trade. Nevertheless, we’ll simplify this analysis to make the evaluation on a very crude level. We are asking: if an investor blindly picked 5 different stocks/ETFs from the Picks of the Week reports at any point during the time frame and held them to the end-point (February 15, 2013), what is the mean return and what would the distribution of those average returns look like?
 
First, here is a summary table and histogram of these Picks of the Week returns (% change since selection):
 
 
 
 
Minimum value (PSN-T)1st QuartileMedianMean3rd QuartileMaximum value (SNTS-Q)
-98.3-4.06.48.67820.0274.3
 
 
 
 
 
numberstandard deviationmedian absolute deviationrangeskewkurtosis
659928.7517.64372.61.337.51
 
 
When we present the Stock Trends Picks of the Week, though, our expectation is not that every trade will be successful. However, we would like to see that the distribution of results is favourable. In practical terms, an appealing distribution will be asymmetrical, skewed positively with a fat tail to the right. While we can describe data with mathematical determinants that tell us of likely results, including simple measures of central tendency such as the mean and the median, in the end each pick represents a random sample of this subset of the larger population. We would want to see how these descriptive terms compare to the population itself.
 
We won’t make an attempt to calculate the population distribution now, but we can estimate that it would be close to a normal distribution, which would be symmetrical and possibly centered at the zero value, depending on the market’s overall direction. However, we can see that the distribution of the Picks of the Week sample is asymmetrical, that it is skewed positively – a long tail to the right. Half of the results fall with the 1st and 3rdquartile (the interquartile range)– between -4% and 20%. If an investor were to buy just one of the many selections in the Picks of the Week report since the beginning of 2011 their trade would have a greater than 95% chance of resulting in a return between -29 and 42%, which represents all those picks within 2 median absolute deviations (remember that the actual results obtained may be different in a real world scenario – profits booked at higher prices, losses capped at higher prices when a stock holding begins to retreat).
 
But putting all your eggs in one trade is not a trading plan sensible investors would endure. It is presumed that an investor would spread risk across trades. We should then be more interested in the distribution of average returns on samples of several picks. Let’s again assume that the investor makes a handful of trades in the period based on random selections from the reports (again, across all exchanges), and holds them until the end period. These mini-portfolio results should tell us something about the effectiveness of the Picks of the Week report.
 
A basic statistical method often used is sampling. By taking a random sample multiple times – actually many, many times over – we can estimate probable outcomes. Generally, this kind of resampling tends to prove a basic statistical truth: regardless of whether a statistic shows a non-normal distribution, as the sample sizes increase the statistic will tend toward a normal distribution. This is called the central limit theorem. However, let us take a first step and keep the sample size consistent with money management constraints and estimate that an investor’s portfolio would consist of at least 5 positions.
 
Bootstrapping 1,000 random samples (with replacement, since each of these samples is an independent portfolio) of those 5 selections from the Picks of the Week report generates the following histogram representation of the sample mean (average return of the 5 selected picks) distribution, as well as a summary table:
 
 
 
Minimum Value1st QuartileMedianMean3rd QuartileMaximum Value
-25.088.1117.7718.928.0690.4
 
 
 
 
 
numberstandard deviationmedian absolute deviationrangeskewkurtosis
100015.9114.83115.480.580.84
 
 
Now we see that the measures of central tendency have moved up – the mean (of the sample means) is 19% - and the distribution is closer to a normal distribution. More importantly, most of the sample means are above 3% (one absolute deviation below the median). The following box plots of the sample returns and the sample means returns give us a good graphical representation of the data.
 
 
Differences in the kernel density plots are also represented by the horizontal shape of the violin plots.
 
 
Overall, this analysis indicates the Picks of the Week reports have a good record of delivering trades with above average performance. This analysis does not go deeply enough in the data to indicate optimization and does not accurately compare against random sampling of the broad population of stocks. Nevertheless, it gives us an idea of the statistical metrics behind the performance of this particular subset of Picks of the Week selections.
 
I’ll be digging further into the Picks of the Week report and try to isolate various combinations of the Stock Trends variables and trading stats that change the returns distribution significantly from the sample’s distribution. There are some things we can learn about price momentum and how it delivers different results based on the sector, market capitalization or the price of the stock, and other variables. Applying more rigorous statistical analysis of the Stock Trends indicators will be the primary goal of editorials. Also, while there may be room for a return to market commentaries, I am the first to recognize there are many, many sources of “opinions” about the market direction. I’ll try to stick to quantitative trading analysis, and statistical meat here. In the end, the decision about trading is up to the investor. The best any information service can do is provide a framework for understanding the risk and rewards at hand. There is no certainty - but it’s a lot better to know your odds.

Sunday, April 05, 2009

Stock Trends TSX Portfolio out of hibernation

A sign of the improving trend picture for the TSX is renewed activity in the Stock Trends TSX Portfolio. There are two new buys currently, the first since February. The bear market put the lid on trades for this trend following system. There have only been 20 trades from the summer of 2007 until these most recent buys.

Thursday, April 02, 2009

Money management trading application

Too often investors come to the market table without proper money management training. They are keen to score, in hockey parlance, but not willing to backcheck. They are anxious to prove how smart they are, to bask in winning trades.  Not surprisingly, these unrealistic expectations set investors up for a rude awakening. How many times have investors misunderstood the probabilities that are stacked against them. Good traders know these odds and manage their trades to minimize losses. Always.

There is no shame in acknowledging the truth: no trader will be right all the time. In fact, even the best traders will be wrong more than they are right. More sobering is another truth: every active trader will have extended periods of crippling losses. These drawdowns on capital are the true test of a trading plan. How does your trading deal with inevitable drawdowns? Would your capital be wiped out if you suffered 10 consecutive losses? Would your trading tendencies change? What does your trading plan direct to minimize the dangers of extended drawdowns?

These questions should be on the mind of every self-directed investor. Before entering a trade know your probabilities – probability of success, probability of meeting profit targets, and the probability of variable losses. Indeed, if a trader learns how to work with these probabilities and devises a money management plan, trading can become a manageable business. And a successful one.

A good starting point is your own trading record. Keep track of your trades. Learn about the basic metrics of your trading strategy and find tools to help turn these metrics into a systematic trading plan. Stock Trends followers should be versed in this kind of systematic trading, but an even more rigorous methodology will be advanced by Stock Trends colleague Brian Ault, whose Fulcrum Shift Trading venture will lend a powerful introduction to his M3 Money Management Modeler – a powerful application the guides traders through the risk/reward analysis of position sizing.

Visit the Stock Trends Traders Network and follow some of Brian’s informative tutorials on the M3 Money Management Modeler. Stock Trends would like to direct our trading audience to this extremely helpful and powerful money management tool.

Tuesday, January 06, 2009

15-year Trading stats

The Stock Trends TSX Portfolio has been active for 15-years now. Last year was a losing year, with losses totaling about 20% on average investment. Trading activity was low, reflecting the bearish market conditions, and helped avoid the market downturn to some extent. By comparison the S&P/TSX Composite Index dropped 35%. The lifetime annualized return on investment of ST Portfolio, though, remains at 40%.

The following table provides some pertinent trading statistics for the trading strategy:


ST TSX Portfolio Trading Startegy Trade Analysis

Total Gain: $ 240,164 607%
# of weeks: 788
Total # of trades: 419
Winning Trades: 169
Losing Trades: 250
Winning %: 40%
Average # of weeks each position held: 7.5
Average # of positions held each week: 4.0
Average Gain: $ 2,922 29%
Average Loss: $ (1,015) -10%
Average Investment: $ 39,566
Average trade: $ 10,000
Maximum Drawdown (%): -34.2
Largest Gain $: 40,880 409%
Largest Loss $: (3,542) -35%
Maximum losing trades in Succession: 12

Losing Runs Frequency

2 losers in a row: 22
3 losers in a row: 11
4 losers in a row: 9
5 losers in a row: 4
6 losers in a row: 1
7 losers in a row: 2
8 losers in a row: 1
9 losers in a row: 0
10 losers in a row: 3
11 losers in a row: 1
12 losers in a row: 1


Sharpe Ratio: 5.2

Martin Ratio:4.2

Ulcer Index: 9.2

Profit factor: 1.95

Pessimistic Return Ratio: 1.92








Friday, October 24, 2008

Gratuitous income redistribution

A story making the rounds as found on Donald Luskin's blog:

Today on my way to lunch I passed a homeless guy with a sign that read "Vote Obama, I need the money." I laughed.
Once in the restaurant my server had on an "Obama 08" tie, again I laughed as he had given away his political preference--just imagine the coincidence.

When the bill came I decided not to tip the server and explained to him that I was exploring the Obama redistribution of wealth concept. He stood there in disbelief while I told him that I was going to redistribute his tip to someone who I deemed more in need--the homeless guy outside. The server angrily stormed from my sight.

I went outside, gave the homeless guy $10 and told him to thank the server inside as I've decided he could use the money more. The homeless guy was grateful.

At the end of my rather unscientific redistribution experiment I realized the homeless guy was grateful for the money he did not earn, but the waiter was pretty angry that I gave away the money he did earn, even though the actual recipient deserved money more.

I guess redistribution of wealth is an easier thing to swallow in concept than in practical application.


Somebody wants to spread our wealth, traders. In the markets profits are NOT a dirty word. It is the result of hard work - something that is especially true in a tough bear market.