For those who like to use statistics in developing their trading models, the moving skewness indicator can be used as a filter to find the stocks that are just getting into a breaking trend. Here's the math behind the tool.
Traders always are trying to discover when a trend in a market
The moving skewness indicator is based on the behavior of the moving deviation, which is a random variable equal to the difference between the closing price of a stock and the moving mean of that closing price. In this usage, the moving mean must be developed using double exponential smoothing. The moving deviation developed in this manner is a random variable with a probability density function, or frequency distribution, that is nearly normal, and moreover, the mean value of the moving deviation is close to zero.
Because of these two properties of the moving deviation, a sample histogram for the moving deviation at any time is quite close to normal in shape, with a sample mean value that is near zero. However, when a brisk short-term trend in the closing price is starting, the moving deviation sample histogram exhibits an abrupt, short-term transient shew. This skew results in a rapid change in the value of a standard sample statistic called the coefficient of skewness.
In statistical theory, the coefficient of skewness is an "expected value" or, in practical terms, an average value. Therefore, we can define a usefid moving version of this coefficient using exponential smoothing. The equations for the moving coefficient of skewness, or "moving skewness," developed using exponential smoothing are given in "Equation list" (right).
GRAPHIC EXAMPLES
Two examples based on actual stock closing price time series demonstrate the graphic form of the moving skewness. (See top traces in "UK's rapid rise" and "Cat's slower rise," left). These examples show the moving skewness increases rapidly in value when a sharp short-term positive trend starts, thus generating the moving skewness "pulse" waveforms (top lines). Each of the top traces shows a raw moving skewness pulse, calculated using the equations through Equation 5 in "Equation list."
The rapid rise time for the Union Carbide (UK) moving skewness pulse identifies the beginning of a sharp short-term trend upward in UK's closing price. By contrast, the slower, longer-lasting rise for Caterpillar Inc.'s (CAT) moving skewness pulse identifies a slower but longer-lasting upward trend in this stock.
The trailing edge of both moving skewness pulses decays slowly. This difference in the leading and trailing edge occurs, first, because the leading edge responds directly to the rapid upward movement in the closing price that marks the start of a sharp short-term trend. Second, the slow decay in the trailing edge occurs when the rapid initial rise in the closing price gives way to a slower-moving trend. The moving mean lags the closing price during the closing price's initial rise but catches up during the subsequent slower-moving trend period.
RIDING THE WAVEFORMS
Next, we move to the waveform shaping operations that develop the shaped moving skewness waveforms shown in the bottom traces of the two charts. Here we're considering only positive trends. In fact, negative excursions of the moving skewness, as well as the slow fall time of the moving skewness pulse trailing edge, hinder the clarity of display and the use of the moving skewness pulse in the filter for short-term positive trend detection.
Therefore, we'll "clamp" the moving skewness pulse to the zero baseline and remove any negative excursions, and we'll also "clip" the long trailing edge off the moving skewness pulse. Both of these waveform-shaping operations are simple to perform. The shaping operations are performed by Equations 6 and 7. If you examine these equations with the lower trace waveforms in the figures, their operation should be self-evident.
An example will show how an output sample of moving skewness pulses, called the "trade candidate sample," can be filtered from a much larger input of moving skewness pulses. The filter output trade candidate sample includes moving skewness pulses with a high probability of correctly detecting an oncoming short-term trend. In this connection, the term "probability" should be interpreted in the empirical, relative frequency sense. Therefore, the phrase "high probability" means that a high proportion of the moving skewness pulses in the output trade candidate sample correctly identifies stocks entering sharp upward short-term trends.
FILTER INPUT
Consider a filter input sample that contains the actual closing price-time series for 26 of the 30 stocks in the Dow Jones Industrial Average (DJIA) for 136 consecutive trading days, from April 7,1999, to Oct. 18, 1999, providing a total of 3,536 stock-day sample points. Assume that all of the equations through Equation 7 in "Equation list" have been calculated day by day through the 136 trading days in each of the 26 stock closing price-time series in the filter input sample. Furthermore, assume that each of the recursion formulas was properly initialized at the start of the 136 trading days.
As a result of these calculations through each of the 26 stock time series, many moving skewness pulses will occur. However, not all of these moving skewness pulses will coincide with the start of a brisk upward trend in the closing price. In fact, only the highest pulses, such as the UK pulse or the CAT pulse shown in the accompanying charts coincide with the onset of a sharp, short-term uptrend. Therefore, we will base a simple form of a trade candidate detector for our filter on a selection procedure that will select just the high peak value moving skewness pulses from the filter input data.
TRADING CANDIDATES
To pick an output trade candidate sample, we'll select pulses with a leading edge that crosses above a horizontal line, called the selection line (SL), that is defined in Equation 8. The selection line is placed at 4.4 above the time axis (see "Selecting a stock," right). We use the 4.4 value because we want only the highest peak value moving skewness pulses to cross the SL. In our input raw data sample, the moving skewness pulse has a mean value close to zero and a standard deviation of 2.2. Placing the line at two standard deviations should eliminate all but the most extreme values; thus, we get 4.4.
To select the output trade candidate sample, Equation 9 in "Equation list" is calculated for each moving skewness pulse in the input raw data sample, and the sample point switch (SPS) is set to 1 for each moving skewness pulse for which the moving skewness pulse leading edge crosses the selection line. The UK and CAT charts both illustrate how the leading edge of a stock moving skew-ness pulse may cross the SL, causing the sample point switch to set to 1 when the SL crossing occurs.
As the figures show, the crossover point is designated P2, and the trading day on which the crossover point P2 occurs is called Day 0. To make trade candidate selections, each moving skewness pulse with an SPS at 1 is output in a trade candidate sample. This selection procedure outputs 35 moving skewness pulses as trade candidates for our data sample used here.
With these 35 potential trades (each with an associated DJIA stock) now in hand, we'll apply a simple, hypothetical two-day trading rule to each sample point and calculate summary sample statistics. These summary statistics will permit us to evaluate the potential use of the moving skewness as a detector of a potential swift short-term uptrend.
TWO-DAY TRADING RULE
To produce the summary sample statistics for the two-day trading rule, assume that we are able to follow these trade entry and trade exit rules for each of 35 hypothetical trades for the stocks in our 35 sample points:
Trade entry: Buy at the market for $25,000 of the stock's shares at the opening price on Day 1. We assume that fractional shares are possible and that exactly $25,000 worth of the stock in every sample point of the trade candidate sample is purchased at the market open on Day 1 of each sample point.
Trade exit: Exit from the trade at the market on the close of Day 1 if a profit exists at that point. If a loss exists at the close on Day 1, do not exit on Day 1 but hold on for another day and exit the trade at the close on Day 2.
"Summary sample statistics" (above) shows the results of using these two trading rules for the sample of 35 hypothetical trades and helps us evaluate the potential use of the moving skewness indicator as a detector of a short-term upward trend. Key features of the table that support the potential value for the moving skewness indicator as a trend detector include:
* The high odds-in-favor-of-a-win (ODDS) ratio suggests that trading systems may make advantageous stock selections for trade entry using the moving skewness indicator.
* The high profit ratio (PROFRAT) suggests that the trade exit can be managed with excellent profit potential.
* The high system figure of merit (SFM), with balance between the ODDS and PROFRAT factors, suggests that a strong, well-balanced trading systern can be designed around the moving skewness indicator. An additional practical interpretation of the SFM is that the two-day trading rule will average $3.60 gained on winning trades for each $1.00 lost on losing trades.
The conclusion from these statistics is that the moving skewness indicator has considerable potential value as a short-term trend detector.
[GRAPH OMITTED]
[GRAPH OMITTED]
[GRAPH OMITTED]
RELATED ARTICLE: Equation list
The moving mean of the closing price time series:
[alpha] = 0.1
[S.sub.t] = [alpha] [CLOSE.sub.t] + (1 - [alpha]) [S.sub.t-1]
[D.sub.t] = [alpha] [S.sub.t] + (1 - [alpha]) [D.sub.t-1]
[M.sub.t] = ((2 - [alpha]) [S.sub.t] - [D.sub.t])/(1 - [alpha]) (1)
where [M.sub.t] is the moving mean of the closing price, [CLOSE.sub.t], t = 1,2,...
The moving deviation:
[DEV.sub.t] = [CLOSE.sub.t] - [M.sub.t] (2)
where t = 1,2,...
The moving standard deviation:
[beta] = 0.05
[SMD.sub.t] = [beta] \ [DEV.sub.t] \ + (1 - [beta]) [SMD.sub.t-1]
[DMD.sub.t] = [beta] [SMD.sub.t] + (1 - [beta]) [DMD.sub.t-1]
[MD.sub.t] = ((2 - [beta]) [SMD.sub.t] - [DMD].sub.t)/(1 - [beta])
[STD.sub.t] = 1.25 [MD.sub.t] (3)
where [STD.sub.t] is the standard deviation of the moving deviation, t = 1,2,...
The moving skewness:
[M3.sub.t] = Y [([DEV.sub.t]).sup.3]) + (1 - Y) [M3.sub.t-1] (4)
G[1.sub.t] = M[3.sub.t]/[([STD.sub.t]).sup.3] (5)
Where M[3.sub.t] is the third central moment, G[1.sub.t] is the moving skewness, Y is the smoothing constant (0.33), [DEV.sub.t] is the moving deviation, of the moving deviation, t= 1,2,...
Shaping the moving skewness pulse waveform:
[CLAMP.sub.t] = G[1.sub.t], G[1.sub.t] > = 0 (6)
= 0, G[1.sub.t] < 0
[CLIP.sub.t] = [CLAMP.sub.t], [CLAMP.sub.t] > [CLAMP.sub.t-1] (7)
= 0, [CLAMP.sub.t] <= [CLAMP.sub.t-1]
Set pulse selection level:
SL = 4.4 (8)
Set pulse sample point switch:
[SPS.sub.t] = 1, [CLIP.sub.t-1] < SL <= [CLIP.sub.t] (9)
= 0, otherwise
Summary sample statistics
Number of trades (NT): 35
Number of winning trades (NW): 25
Number of losing trades (NL): 10
Probability of a win (PW): PW = NW/NT (0.71)
Odds in favor of a win (ODDS): ODDS = NW/NL (2.50)
Average winning dollars on just the 25 winning trades (WINAVG): $787.58
Average losing dollars on just the 10 losing trades (LOSEAVG): $548.76
Profit ratio (PROFRAT): PROFAT = WINAVG/LOSEVG (1.44)
System figure of merit (SFM): SFM = ODDS *PROFRAT (3.60)
Average single-trade return over the 35 hypothetical trades: 1.623%
In the library
Lederman, VV. (1984), Handbook of Applicable Mathematics, Vol VI, Part A, Statistics. John Wiley & Sons, New York. (This book contains a complete treatment of moments and the skewness coefficient.)
McNicholl, D. (2002), Taming Complexity in Trading: Beating the Dow by 3:l (See www.traderspress.com.) (This book includes background equations, theory of operation, accuracy. transient response and how to initialize for all basic moving parameters such as the moving mean and moving standard deviation.)
Dennis McNicholl has been applying statistical models for progressive learning from data for trade stock selection and trend detection for nearly 20 years. He can be reached via e-mail at mcnicholl@mindspring.com.