0% found this document useful (0 votes)
112 views4 pages

Regularization

Uploaded by

Masa
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
112 views4 pages

Regularization

Uploaded by

Masa
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

Stocks & Commodities V. 21:7 (38-41): Regularization by Chris Satchwell, Ph.D.

TRADING TECHNIQUES

A Generic Tool For Technical Analysis

Regularization
In the lexicon of technical analysis, terms such as
moving averages and least-squares regressions
are commonly understood. But what about regu-
larization? Despite their potential, regularization
techniques are poorly understood and little used.

by Chris Satchwell, Ph.D.

ltimately, indicators exist to aid trad-

U ing decisions. Most indicators are


used in relation to price-related
tasks, and there is a crucial and
(usually) underresearched step in-
volved in interpreting their values to obtain trading
decisions. Such a step might be the crossover of
two moving averages, or an indicator penetrat-
ing a threshold value.
Often, the smoother the indicator, the easier
it is to make good decisions, and regulariza-
tion helps to smooth indicators. Specifically,
regularization aids decision-making logic
based on the gradient (that is, the rate of change
of a quantity over time) of indicators. It is a
generic tool, in that it can be applied whenever an average or turn produces wiggle!
regression is needed to find an indicator. Most trading indica- Frequently, developers of technical analysis tools find
tors can be reformulated with regularization to help smooth themselves caught in the position of wanting to see a more
them. rapid response to price changes, but without the associated
For this article, I have focused on exponential moving wiggle or lag. While regularization is not a total solution to
averages (EMAs) with regularization, but the principles can the problem, it can help resolve this dilemma.
be extended to introduce regularization into conventional
moving averages and regressions. I will introduce an indica- BACKGROUND
tor known as regularized momentum and compare it with Most economists and technical analysts have encountered the
moving average convergence/divergence (MACD). technique of fitting a line to a set of datapoints to minimize the
sum of the square of the errors. This is known as least-squares
WIGGLE AND LAG regression. The method ignores complexity optimization and
Wiggle describes high-frequency oscillations, typified by usually fits both signal and noise components of the data
those found on short-term moving averages of security prices. being modeled.
Lag describes a tendency of one series to trail another; an Regularization introduces an additional term penalizing
example would be a price moving average lagging actual curvature into this optimization process. Put simply, it pro-
prices. vides a knob to reduce the wiggle in an indicator; it offers
Often, indicators and similar tools of technical analysis alternative results to those obtained by averaging, and yields
face the dilemma of being either too slow to react to price
changes or wiggling too much to make useful conclusions.
Where those conclusions depend on the gradient of an indi- Often, the smoother the indicator, the
cator, wiggle is a particular problem. Adjusting an indicator easier it is to make good decisions, and
to combat wiggle causes other problems. Increasing the regularization helps to smooth indicators.
length of, say, a moving average results in lag. The answer to
lag is to reduce the length of the moving average, but that in
Copyright (c) Technical Analysis Inc.
Stocks & Commodities V. 21:7 (38-41): Regularization by Chris Satchwell, Ph.D.

FIGURE 1: REGULARIZED
EXPONENTIAL PRICE
MOVING AVERAGES. You
can apply a time perspec-
tive of market turning points
to an arbitrary trading style.

Price

Indicator
Volume

CHARTS COURTESY AUTHOR


a different harvest of trading signals. Some ideas based on exponential moving average can be derived by minimizing an
regularization have been developed into simple formulas associated function.
that can be applied by market technicians with a limited
background in mathematics. D(Fn+1 – Fn – α (Gn+1 – Fn ))2 / D(Fn+1) = 0
(2)
REGULARIZED EMA
Let me define a few terms before I introduce the formulas: A least-squares component of an error function (E) can be
derived from the argument of the numerator of equation 2 and
Fn+1 Regularized EMA at time n + 1 a penalty term for curvature introduced to achieve regulariza-
Fn Regularized exponential moving average at time n tion. The penalty term comes from the mathematics of finite
Fn–1 Regularized EMA at time n – 1 differences, where the second part of equation 3 is based on
Gn+1 Function value at time n + 1 the second derivative of Fn with respect to (presumed) unit
α Smoothing constant for exponential moving average time increments between adjacent price bars:
λ Regularization constant
E = (Fn+1 – Fn – α(Gn+1 – Fn))2 + λ(Fn+1 – 2Fn + Fn–1)2
The idea is to arrive at a formula for a regularized moving (3)
average (Fn+1) with a smoothing constant α and (curvature-
penalizing) regularization constant of λ. Simply, equation 1 Differentiating equation 3 with respect to Fn+1 and equating to
shows the formula for a conventional EMA, equation 5 is the zero gives:
formula for a regularized EMA, and equations 2 to 4 demon-
strate the process. 2(Fn+1 – Fn – α(Gn+1 – Fn)) + 2λ(Fn+1 – 2Fn + Fn-1) = 0
With these definitions, a conventional formula for an (4)
exponential moving average can be written as:
After canceling and rearranging, equation 4 becomes:
Fn+1 = Fn + α (Gn+1 – Fn)
(Equation 1) Fn+1 = [Fn(1 + 2λ) + α(Gn+1 – Fn) – λ Fn–1] / (1 + λ)
(5)
If the right-hand side of equation 1 is squared, and “D” used
to denote differentiation, then its minimum can be found by To summarize equation 5 (given smoothing constant α,
solving equation 2 (below), the solution to which coincides regularization constant λ, the last two values of regularized
with equation 1. This demonstrates that the formula for an exponential moving averages Fn and Fn–1, and the latest
Copyright (c) Technical Analysis Inc.
Stocks & Commodities V. 21:7 (38-41): Regularization by Chris Satchwell, Ph.D.

FIGURE 2: COMPARING
REGULARIZED MOMEN-
TUM AND MACD. Regular-
ized momentum can give you
an idea of the direction of the
market. Although regularized
momentum and MACD give
similar signals, combining the
two shows that regularized

Price

Indicator
momentum often provides an
earlier signal.
Volume

function value Gn+1), the formula gives the current (n+1) legacy of common trading logic (crossovers, threshold pen-
value of a regularized exponential moving average, Fn+1. This etrations, and so on) that for the most part ignore gradients.
is the key formula that converts an exponential moving Our expectations on how to use indicators tend to get in the
average (equation 1) into one that contains a curvature- way of appreciating that many trading decisions can be
smoothed regularization term (equation 5). Starting values reduced to whether a price gradient is positive or negative.
for F1 and F2 need to be estimated to begin the calculation. That is what regularization can do quite well. In Figure 1, the
Typically, F1 and F2 are obtained from moving averages. blue line has just four turning points in the space of a month.
Regularized EMAs are just like conventional ones in that the With less regularization this could be a shorter-term view,
time needed for values to stabilize depends on how good the and with more, a longer-term view. Through judicious choices
initial estimates are for F1 and F2. of α and λ, an arbitrary time perspective for market turning
Similar logic can be applied to find regularization formulas points, applicable to arbitrary trading styles, becomes pos-
for similar moving averages and other common mathematical sible. If Fn and Fn+1 are defined as the penultimate and final
techniques of technical analysis. I also developed formulas for values of regularized EMAs based on closing prices, then a
much of this peer group, but equation 5 remains my favorite, trading logic based on gradients can be built on regularized
since it can usually be made to perform effectively. momentum, defined as:

REGULARIZATION IN ACTION Regularized momentum = (Fn+1 – Fn)/Fn+1


Regularization has an advantage in that it enables the gradi- (6)
ents of regularized quantities to form part of the trading logic.
However, the position of a regularized indicator is dependent With this definition in place, Figure 2 picks up where the
on prior curvature; unlike conventional and exponential blue line of Figure 1 left off to show how regularized
moving averages, there is no guarantee it will never trespass momentum can indicate market direction (see the green line
beyond the maximum or minimum function values on which and read from the right-hand axis). With this logic, a change
it is based. This implies that conventional averages may be of direction is indicated whenever the green line passes
better for standard trading logic involving crossovers or though zero on the right-hand scale.
threshold penetrations. For comparison, a MACD (red) line offers an impression of
Regularization removes wiggle and associated gradient relative smoothness and speed of the two indicators. Once
oscillations, so to exploit it fully, the consequences of having again, when the MACD line passes through zero it indicates a
less-oscillatory gradients must be appreciated. This may not change of price direction. A visual inspection shows the two
be as easy as it sounds, since conventional averaging usually lines to be similarly smooth, but regularized momentum often
fails to provide sufficiently consistent gradients, leaving a indicates a change of price direction a few bars before MACD.
Copyright (c) Technical Analysis Inc.
Stocks & Commodities V. 21:7 (38-41): Regularization by Chris Satchwell, Ph.D.

The combination of the two indicators has the potential to offer ing, where smoothing a wiggly output has been achieved to
more useful trading strategies than either used alone. some degree. Regularization has allowed data modelers to
make certain assumptions about the form of possible data
POTENTIAL models, find an overly complex, least-squares model, and
I do not want to make extravagant claims for regularization then regularize (that is, get the model to produce a smoother
simply because it looks useful relative to MACD. I do, output) to maximize the probability of the regularized model
however, want to alert technicians to its potential. These being correct.
results provide an appetizer to what could be achieved if the Details of these concepts go deep into Bayesian statistics†
technique were seriously exploited. and lie outside the more practical spirit of this article, but the
For trading logic based on crossovers or thresholds, con- messages are clear. Regularization has a well-established
ventional averaging is likely to be superior, but for trading pedigree, there is more in it for those who care to pursue it at
logics based on gradients, regularization appears to have the an advanced level, and regularization is a potent tool that
edge. Such trading logic can be built around the idea of regular- deserves a place in our lexicon of technical analysis methods.
ized momentum (equation 6 and Figure 2), suggesting that
regularization can help resolve the dilemma of wiggle and lag. Chris Satchwell is a technology developer and the chief
Another attraction of regularization is that it offers a much scientist of Recognia, Inc. (of Ottawa, Canada). He is also
more direct link to the logic needed for trading. Instead of founder and director of UK-based Technical Forecasts Limited.
requiring crossovers, filters, or thresholds, regularization
offers a simple answer to the question of whether prices are RELATED READING
going up or down. Appel, Gerald [1985]. The Moving Average Convergence-
Divergence Trading Method, Advanced Version, Scien-
CONCLUSIONS tific Investment Systems.
Regularization is a well-established technique in data model- †See Traders’ Glossary for definition S&C

Copyright (c) Technical Analysis Inc.

You might also like