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.
Post a Comment