Autoregressive short-term prediction of turning points
using support vector regression

arXiv:1209.0127v2 [cs.LG] 24 Sep 2012

Ran El-Yaniv, Alexandra Faynburd∗
Computer Science Department, Technion - Israel Institute of Technology

Abstract
This work is concerned with autoregressive prediction of turning points in financial price sequences. Such turning points are critical local extrema points
along a series, which mark the start of new swings. Predicting the future time
of such turning points or even their early or late identification slightly before
or after the fact has useful applications in economics and finance. Building
on recently proposed neural network model for turning point prediction, we
propose and study a new autoregressive model for predicting turning points
of small swings. Our method relies on a known turning point indicator, a
Fourier enriched representation of price histories, and support vector regression. We empirically examine the performance of the proposed method over
a long history of the Dow Jones Industrial average. Our study shows that the
proposed method is superior to the previous neural network model, in terms
of trading performance of a simple trading application and also exhibits a
quantifiable advantage over the buy-and-hold benchmark.
Keywords: Artificial Neural Networks, SVR, financial prediction, turning
points
1. Introduction
We focus on the difficult task of predicting turning points in financial
price sequences. Such turning points are special in the sense, that they reflect
instantaneous equilibrium of demand and supply, after which a reversal in
∗

Corresponding author
Email addresses: rani@cs.technion.ac.il (Ran El-Yaniv),
alexaf@cs.technion.ac.il (Alexandra Faynburd)
September 25, 2012

the intensity of these quantities takes place. These reversals can often result
from random events, in which case they cannot be predicted. The basis
for the current work is the hypothesis that numerous reversal instances are
caused by partially predictable dynamics generated by market participants.
We are not concerned here in deciphering this dynamics and extracting its
mathematical laws, but merely focus on the question of how well such turning
points can be predicted in an autoregressive manner.
Turning points can be categorized according to their “size”, which is
reflected by the duration and magnitude of the trends before and after the
reversal. Long term reversals are often termed business cycles. A well known
type of a long term reversal is the Kondratiev wave (also called supercycle),
whose duration is between 40 to 60 years [1]. Such waves, as well as shorter
term business cycles, are extensively studied in the economics literature.
However, our focus here is on much shorter trend reversals whose magnitude
is of order of a few percents and their cycle period is measured in days. One
reason to study and predict such “mini reversals” is to support traders and
investors in their analysis and decision making. In particular, the knowledge
of future reversal times can help financial decision makers in designing safer
and more effective trading strategies and can be used as a tactical aid in
implementing specific trades which are motivated by other considerations.1
Our anchor to the state-of-the-art in predicting turning points is the paper
by Li et al. [2] upon which we improve and expand. Hypothesizing that
the underlying price formation process is governed by non linear chaotic
dynamics, the Li et al. paper proposes a model for short term prediction using
neural networks. They reported on prediction performance that gives rise to
outstanding financial returns through a simple trading strategy that utilizes
predictions of turning points. Li et al. casted the turning point prediction
problem as an inductive regression problem whose feature vectors consist of
small windows of the most recent prices. The regression problem was defined
through a novel oscillator for turning points that quantifies how close in
hindsight a given price is to being a peak or a trough. Using feed-forward back
propagation, they regressed the features to corresponding oscillator values
and learned an ensemble of networks. Prediction of the oscillator values
was extracted from this ensemble as a weighted decision over all ensemble
1

Notice also, that the inverse of an (accurate) turning point predictor is, in fact, a trend
continuation predictor.

2

members.
Our contribution is two-fold. First, we replicate the Li et al. method and
provide an in-depth study of their approach. Our study invalidates some
of their conclusions and confirms some others. Unfortunately, we find that
their numerical conclusions, obtained for a relatively small test set (spanning
60 days), are too optimistic. We then consider a different learning scheme
that in some sense simplifies the Li et al. approach. Instead of ensemble
of neural networks we apply Vapnik’s support vector regression (SVR). This
construction is simpler in various ways and already improves the Li et al.
results by itself. An additional improvement is achieved by considering more
elaborate feature vectors, which in addition to price data also include the
Fourier coefficients (amplitude and phase) of price. The overall new model
exhibits more robust predictions that outperform the Li et al. model. While
the resulting model does exceed the buy-and-hold benchmark in terms of
overall average return, this difference is not statistically significant. However,
the model’s average Sharpe ratio is substantially better than the buy-andhold benchmark.
2. Related work
Turning points have long been considered in various disciplines such as
finance and economics, where they are mainly used for early identification of
business cycles, trends and price swings. Among the first to study turning
points were Burns and Mitchell [3], who defined a turning point in terms of
business cycles with multiple stages. Bry and Boshan [4] proposed a procedure for automatic detection of turning points in a time series in hindsight.
Many of their successors refined this scheme, e.g., Pagan and Sossounov [5].
Such methods for turning points detection (in hindsight) facilitated the
foundation of the study of turning points as events to which empirical probability can be assigned and statistical analysis can be performed. Wecker
[6] developed a statistical model for turning points prediction while utilizing
some of the ideas of Bry and Boshan. Another approach was proposed by
Hamilton [7], where he modeled turning points as switches between regimes
(trends) that are governed by a two-state Markov switching model. The
model was extended in [8] to include duration-dependent probabilities.
There are few works that specifically discuss turning points in stock prices.
Lunde and Timmerman [9] applied a Markov Switching model with duration
dependence for equities. Bao and Yang [10] applied a probabilistic model
3

using technical indicators as features and turning points as events of interest.
Azzini, et al. [11] used a fuzzy-evolutionary model and a neuro-evolutionary
model to predict turning points. The present paper is closest to the work
of Li et al. [2], who proposed to use chaotic analysis and neural networks
ensembles to forecast turning points.
3. Preliminaries
Let X = x1 , x2 , . . . , xt , . . . be a real sequence, xt ∈ R. In this paper
the elements xt are economic quantities and typically are prices of financial
instruments or indices; throughout the paper we call xt prices and the index t
represents time measured in some time frame. Our focus is on daily sequences
in which case t is an index of a business day; our results can in principle be
applied to other time frames such as weeks, hours or minutes. Given a price
sequence X, we denote by Xii+N = xi , . . . , xi+N a consecutive subsequence of
N prices that starts at the ith day.
Throughout the paper we will consider autoregressive prediction mechanisms defined for price sequences X. For each day t we consider a recent
t−1
window of m prices, Wt = Xt−m
called the backward window of day t. The
prices in the backward window may be transformed to a feature space of
cardinality n via some encoding transformation.
3.1. Turning points and their properties
Let X be a price sequence. A turning point (TP) or a pivot in X is a time
index t where a local extremum (either minimum or maximum) is obtained.
A turning point is called a peak if it is a local maximum, and a trough if it is
a local minimum. Examples for peaks and troughs are shown in Figure 1.
Ignoring commissions and other trading “friction,”a trader who is able to
buy at troughs and sell at peaks, i.e., to enter/exit the market precisely at
the turning points, would gain the maximum possible profit. For this reason,
successful identification and forecasting of turning points is extremely lucrative. However, even if all troughs and peaks were known in hindsight, due
to friction factors including commissions, bid/ask spreads, trading liquidity
and latency, attempting to exploit all fluctuations including the smallest ones
may result in a loss. Therefore, one of the first obstacles when attempting to
exploit turning points is to define the target fluctuations we are after, so as to
ignore the smaller sized ones. To this end, we now consider three definitions,
each of which can quantify the “size” of turning points.
4

Figure 1: Examples for peaks and troughs

Definition 1 (Pivot of degree K). The time index t in a time series is
an upper pivot or a peak of degree K, if for all j = 1, 2, ..., K, xt > xt−j
and xt > xi+j . Similarly, t is a lower pivot or a trough of degree K, if for
j = 1, 2, ..., K, xt < xt−j and xt < xt+j .
A trough of degree 10 is depicted schematically in Figure 2a. A turning
point is any pivot of degree at least 1. By definition, at time t one has
to know the future evolution of the sequence for the following K days in
order to determine if t is a pivot of degree K. Typically, pivots of higher
degree correspond to larger price swings. Therefore, such pivots are harder
to identify in real time.
The following two definitions consider two other properties of pivots that
reflect their “importance”. These properties will be used in our applications.
Definition 2 is novel and Definition 3 is due to [2].

5

Definition 2 (Impact of a turning point). The upward impact of a trough
t is the ratio max{xt , . . . , xn }/xt , where n is the first index, greater than t,
such that xn < xt . That is, if the sequence increases after the trough t to
some maximal value, xmax , and then decreases below xt ; the impact is the
ratio xmax /xt . If xt is the global minimum of the sequence, then the numerator is taken as the global maximum appearing after time t. The downward
impact of a peak is defined conversely.
Definition 3 (Momentum of a turning point [2]). The upward momentum of a trough t with respect to a lookahead window of length w is the
t+w
percentage increase from xt to the maximal value in the window Xt+1
=
xt+1 , . . . , xt+w . That is the upward momentum is max{xt+1 , . . . , xt+w }/xt .
The downward momentum of a peak is defined conversely.

(a) Pivot point (trough) of(b) Turning point of im-(c) Turning point with modegree ≥ 10
pact γ
mentum γ with respect
to a lookahead window of
length w
Figure 2: Turning points schematic examples

In Figure 2 we schematically depict these three characteristics (i.e., pivot
degree, impact and momentum). Then, in Figure 3 we show examples on a
real price sequence. Notice, that these definition give rise to quite different
turning points identification.
3.2. Alternating pivots sequence
Given a time series X and required characteristics of turning points (e.g.,
pivots of degree 10, or pivots with impact γ, etc.) we would like to extract
from X an alternating sequence A(X) of turning points. The sequence A(X)
is then used to construct a turning point oscillator (in Section 3.3). Following
6

(a) Turning points (pivots) of degree K=10

(b) Turning points with impact γ =
10%

(c) Turning points with momentum γ=
10% with respect to a lookahead window
of length w=6 days
Figure 3: Examples of turning point types over the DJIA, 5/2008-5/2009

7

[4], we require that the alternating sequence A(X) will satisfy the following
requirements:
1. Only pivots with the required characteristics will be included in A(X).
2. The pivot sequence will alternate between peaks and troughs.
3. With the exception of first and last elements, every trough will correspond to a global minimum in the time interval defined by the pair of
peaks surrounding it, and vice versa – every peak is a global maximum
in the time interval defined by the troughs surrounding it.
In Appendix A we present an algorithm that extracts an alternating pivot
sequence that satisfies the above conditions. In Figure 4 an example is given,
showing three steps of this algorithm corresponding to the above three requirements. The proposed algorithm is by no means the only way to compute
a proper alternating sequence. We note, however, that any algorithm that extracts an alternating pivot sequence as defined above must rely on hindsight.
Therefore, in real time applications the use of the algorithm is restricted to
training purposes.
When extracting alternating pivot sequences, different requirements will,
of course, result in different pivot sequence. Figure 5 depicts the resulting
alternating pivot sequences for three different pivot requirements, when the
input sequence X consists of 100 days the Dow Jones Industrial Average
(DJIA) index from 05/11/2004 to 1/4/2005.
3.3. A turning points oscillator
Unlike typical regression problems, where one is interested in predicting
prices themselves, when considering turning points, it is not clear at the outset what should be the target function. Here we adapt the solution proposed
by Li et al. model [2]. Fixing a class of pivot points (satisfying any desired
characteristic), the idea is to construct an “oscillator,” whose swings correspond to price swings and its extrema points corresponds to our turning
points in focus. The oscillator essentially normalizes the prices so as to assign the same numerical value (0) to all troughs and the same value (1) to
all peaks. This oscillator provides the target function to be predicted in our
regression problem. The construction of the oscillator is based on alternating
pivot sequences as discussed in Section 3.2. Throughout the paper, whenever we consider a pivot sequence, the meaning is that we refer to pivots of
a certain type without mentioning this type. In the empirical studies that
follow, this type will always be specified.
8

(a) Find all the turning points of momentum
γ = 0.05, w = 6

(b) Ensure alternation of peaks and troughs.
Points 2,5,6,7 are eliminated

(c) A peak should represent the highest
point between the troughs. Point 4 is replaced with point 5 as a maximal TP with
the defined properties between the troughs
3 and 8
Figure 4: Turning points selection example for momentum turning points

9

(a) Turning points of impact γ = 0.03

(b) Pivot turning points of degree 10

(c) Turning points of momentum γ = 0.03,
lookahead p = 6
Figure 5: Examples of turning points for different pivot requirements. The turning points
that satisfy a requirement are denoted with circles

Definition 4 (Turning point oscillator (TP Oscillator)). Let X be a
price sequence and let A(X) be its alternating pivots sequence (that is, A(x)
is the list of turning point times in X). The TP Oscillator is a mapping

10

Γ : N → [0, 1],



0, if t is a trough,
Γ(t) = 1, if t is a peak,

 xt −P (t)
,
otherwise,
P (t)−T (t)

(1)

where P(t) and T(t) are the values of the time series at the nearest peak and
trough located in opposite sides of time t.
Notice, that for each time index t, the TP Oscillator represents the degree
of proximity of the price xt to the price at the nearest peak or trough. Prices
that are closer to troughs will have lower values and prices that are closer to
peaks will have higher values. The TP Oscillator is clearly bounded in the
interval [0, 1] and attain the boundary values at troughs and peaks.
The structure of the TP oscillator strongly depends on the type of turning
points used in its construction. For instance, in Figure 6 we see examples
of the TP Oscillator computed for turning points with impact γ = 1% (6a),
and impact γ = 5% (6b). As should be expected, there are more peaks and
troughs in Figure (6a) than in Figure (6b) because the number of pivot points
of smaller impact is larger, so the TP oscillator attains its extreme values
more frequently.

(a) γ = 0.01

(b) γ = 0.05

Figure 6: TP oscillator for impact turning points

11

4. On the choice of features for turning points prediction
In many prediction problems the choice of features is a crucial issue with
tremendous impact on performance. From a learning theoretic perspective
this choice should be done in conjunction with the choice of the model class.
The overall representation (features plus model class) determines learnability
and predictability. Since we focus in this paper on autoregressive models, the
features we consider are limited to multivariate functions of past data.
In the Li et al. paper [2], on which we build, it was advocated that price
evolution is the outcome of a nonlinear chaotic dynamics and therefore, they
used tools from chaos theory to determine the length of the backward window
of prices from which to generate the features. The features themselves where
simply normalized prices. Specifically, based on Takens theorem [12], the
length of this backward window was derived as the minimum embedding
dimension of the training price sequence. The TP Oscillator used by Li et
al. was defined in terms of momentum turning point. Recalling Definition 3,
momentum pivots are characterized via two parameters: the ‘importance’
parameter γ, and the lookahead window length. Li et al. focused on short
term oscillations, and the choice of the corresponding lookahead window
length was based on the Lyapunov exponent.2 It is perhaps surprising that
their chaotic dynamic analysis resulted in a conclusion that the past eight
prices are sufficient for predicting the turning points.
We decided not to take the Li et al. choice of representation for granted
and performed an initial study where we considered several types of features
and backward window lengths. In our study we employed a ‘wrapper’ approach [13] where we quantified the performance of the features within the
entire system (so that trading performance determined the quality of the
features).
The conclusion of our study was that the better performing features
(among those we considered) are normalized prices within a backward window as well as the Fourier coefficients of those prices. The Fourier coefficients
were simply the phase and amplitude coefficients resulting from a standard
application of the discrete Fourier transform over the backward window. Our
initial study confirmed that the better performing backward window length
2

In chaotic dynamical systems, the horizon of predictability, which is directly affected
sensitivity to initial conditions, is inversely proportional to the maximal Lyapunov exponent.

12

is eight, exactly as the Li et al. conclusion.
5. Predicting turning points with Support Vector Regression
In this section we describe our application of Support Vector Regression
(SVR) to predict the TP oscillator (presented in Section 3.3). We refer the
unfamiliar reader to [14] and [15] for comprehensive expositions of SVR.
The SVR application is as follows. We train an SVR to predict the
TP Oscillator Γ(t) as a function of the features, which are extracted from
price information contained in the most recent backward window. Denote
by F : Rm → Rd the feature generating transformation from prices in the
t−1
backward window Wt = Xt−m
to the feature space. Thus, F (Wt ) is a ddimensional feature vector. The specific transformation F we used, consisted
of normalized prices combined with normalized Fourier coefficients as described in Section 4. The label corresponding to the feature vector F (Wt ) of
the tth backward window, is set to Γ(t), the TP Oscillator at time t. This way
we consider a training set Sn = (F (Wt ), Γ(t)), t1 ≤ t ≤ t2 , of n = t2 − t1 + 1
consecutive pairs of features with their labels.
Using Sn we train a support vector regression model. To this end we use
an ǫ-SVR model (and a training algorithm) [16] using a radial basis function
(RBF) kernel, K(xi , xj ) = exp(− σ12 kxi − xj k2 ). The model is controlled
by three hyper-parameters C, the error cost, ǫ the tube width, and σ, the
kernel resolution. The reader is referred to [15] for a discussion on the role
of these parameters. The output of the SVR training process is a function
Γ̂(t) : Rd → R, from feature vectors to the reals. In our case, the function Γ̂
is the SVR functional approximation to the TP oscillator, induced from the
training set. Thus, larger values of Γ̂ reflect closer proximity to peaks, and
smaller values, closer proximity to troughs.
Since Γ̂(t) is only an approximation of Γ(t) reflecting relative proximity to
extrema points, we cannot expect that its own extrema points will explicitly
identify the peaks and troughs themselves. Therefore, in order to decide
what are the magnitudes of the predicted values that should be considered
as peaks or troughs, we introduce thresholds Tlow , Thigh so that indices t such
that Γ̂(t) < Tlow , are all treated as troughs, and conversely, indices t for
which Γ̂(t) > Thigh , are all considered as peaks. The thresholds Tlow and
Thigh are hyper-parameters that are part of our model and should be fitted
using labeled training data.

13

5.1. Problem specific error function and optimization
Various error functions are used in regression analysis. The most common
ones are the root mean square error (RMSE) and the mean absolute error
(MAE). For example, the RMSE of the prediction Γ̂(t) over the subsequence
Xtt12 = xt1 , . . . , xt2 of n = t2 − t1 + 1 inputs, is given by,
t

RMSE =

RMSE(Γ̂(t), Γ(t), Xtt12 )

2
1
1X
=
(Γ̂(t) − Γ(t))2 2 .
n t=t
1

Instead of directly using the RMSE, Li et al. [2] suggested to use a problem
specific variant of the RMSE. This specialized error function is defined in
terms of the following trimmed reference function,


Thigh , if Γ(t) = 1 and Γ̂(t) < Thigh (high false negative)





Thigh , if Γ(t) 6= 1 and Γ̂(t) > Thigh (high false positive)
′
Γ (t) , Tlow , if Γ(t) = 0 and Γ̂(t) > Tlow
(low false negative)



Tlow , if Γ(t) 6= 0 and Γ̂(t) < Tlow
(low false positive)



Γ̂(t), otherwise.

The final specialized error function, denoted T pRMSE, is then defined
in terms of the reference function as,
t

2
1
1X
′
(Γ̂ (t) − Γ̂(t))2 2 .
T pRMSE , T pRMSE(Γ(t), Γ̂(t), Tlow , Thigh ) ,
n t=t
1

′

We observe that Γ (t) − Γ̂(t) has non-zero values at values t corresponding to
wrong predictions, thus allowing to form an error function that penalizes such
deviations according to their magnitude. An example shown the TpRMSE
error function is given in Figure 7.
Remark 5. Li et al. [2] proposed to use the following refinement of the
T pRMSE error function, which assigns larger weights to errors occurring
precisely at true turning points, and smaller weights for other errors,
t

2
1
1X
′
βt (Γ̂ (t) − Γ̂(t))2 2 ,
T pRMSE ,
n t=t
1

14

Figure 7: Calculation of TpRMSE. The upper graph shows the values of the actual TP
Oscillator Γ(t) and the predicted TP Oscillator Γ̂(t). The lower graph identifies regions
that actually influence the error magnitude, expressed at each point as (Γ′ (t) − Γ̂(t))2 .

15

The exact choice of the β coefficients can be found in [2]. In our experiments,
whenever we applied the Li et al. model we used this refined T pRMSE error
function. However, we did not find any significant advantage to this refined
error function and our SVR model was applied with the simpler T pRMSE
error function.
Given a fixed SVR regression estimate Γ̂(t), we need to optimize the thresholds Thigh and Tlow , so as to minimize the T pRMSE error. The optimal
thresholds are thus given by,
′

′

[Tlow , Thigh ] = argmin T pRMSE(Γ(t), Γ̂(t), Tlow , Thigh ).
′

(2)

′

Tlow ,Thigh

Our overall turning point SVR model is specified by the following hyperparameters. The SVR hyper-parameters are C, ǫ and σ, and the turning point identification hyper-parameters are Tlow and Thigh . These hyperparameters need to be optimized over the training sequence. To this end,
we split the training sequence X into two segments, one for optimizing the
SVR parameters and the other, for optimizing the thresholds (in the sequel
we call this second segment of the training sequence the validation segment).
Due to the complexity of the error functional we resorted to the exhaustive grid search. Specifically, both sets of hyper-parameters were selected
exhaustively over appropriate set of values (a grid), so as to minimize the
error functional. The SVR grid is denoted Θ(C, σ, ǫ) and the thresholds grid
is denoted Θ(Tlow , Thigh ). In Section 9.5 we discuss the particular choices of
these grids. The overall model selection strategy is summarized in Algorithm
1.
Algorithm 1 SVR TPP model
for all (C, σ, ǫ) ∈ Θ(C, σ, ǫ) do
Train an SVR model on the training data segment
Optimize (Tlow , Thigh ) ∈ Θ(Tlow , Thigh ) on the validation segment using
(2)
Store T pRMSE and (Tlow , Thigh ) for the given triple (C, σ, ǫ)
end for
Select the (C, σ, ǫ) obtaining the minimal TpRMSE score on the validation
sequence with their corresponding optimal thresholds (Tlow , Thigh ).
We note that Li et al. [2] applied a genetic algorithm to optimize the
corresponding thresholds (Tlow , Thigh ) in their model. However, we found
16

that the exhaustive search over a grid performs the same or better than a genetic algorithm, with tolerable computational penalty. The main advantage
in using our deterministic approach, rather than the randomized genetic algorithm, is the increase of reproducibility (our optimization is deterministic
and always has the same outcome).
6. A trading application
Prediction algorithms can be evaluated through any meaningful error
function. For example, we could evaluate our methods using the TpRMSE
function defined above. However, the degree of meaningfulness of an error
function depends on an application. Perhaps the most obvious application of
turning points predictions is trading. We now describe a very simple trading
strategy implementing the infamous buy low sell high adage. This strategy
will be used to assess performance of our method, including comparisons to
a natural benchmark and to the state-of-the-art model of [2].
The idea is to use predictions from our already constructed regressor, Γ̂, of
the TP Oscillator, Γ, to issue buy and sell signals. Given the prediction Γ̂(t)
and the thresholds Tlow and Thigh , trading operations are triggered according
to the following rule.
(
Buy, if Γ̂(t) < Tlow and not in position
T rigger(t) =
Sell, if Γ̂(t) > Thigh and in position
The strategy thus works as follows. If today we are not in position (i.e., we
are out of the market) and a buy signal is triggered at the market close, we
enter a long position first thing tomorrow, on the opening price. We start
this trade by buying the stock using our entire wealth. As long as we are in
the trade, we wait for a sell signal, and as soon as it is triggered, we clear
our position on the opening of the following day. (i.e., clearing the position
means that we sell our entire holding of the stock).
To evaluate trading performance we will use cumulative return, maximum
drawdown, success rate and the Sharpe ratio measures. These are standard
quantities that are often used to evaluate trading performance. To define
these measures formally, let xt+n
be a price sequence of length n, and let
t
{(bi , si ), bi , si ∈ [t, t + n], i = 1, . . . , L}, be L pairs of times corresponding to
matching buy and sell “triggers” generated by a trading strategy S. This
pairs correspond to L buy/sell trades. Thus, for any i, we bought the stock
at price xbi and sold it at price xsi .
17

The Cumulative return, retS (xt+n
), of a trading strategy S with respect
t
t+n
to the price sequence xt , is the total wealth accumulated at the end of a
test period, assuming full reinvestment of our current wealth in each trade,
and starting the test with one dollar,
Y xs
i
retS (xt+n
)
=
.
(3)
t
xbi
The corresponding annualized cumulative return, RETS (xt+n
) is,3
t
RETS (xt+n
) = [retS (xt+n
)]252/n .
t
t

(4)

It is often informative to consider also the rolling cumulative return,
ROCS (t), which is the curve of cumulative return through time,
(
S
1, if t ∈
/ ([bi , si ])
, t = t + 1, . . . , t + n
(5)
ROCS (t) =
S
xt /xt−1 , if t ∈ ([bi , si ])

The maximum drawdown (MDD), MDDS (xt+n
), is a measure of risk,
t
defined with respect to the rolling cumulative return curve. Consider Figure
8, depicting a hypothetical (rolling) cumulative return curve. The MDD of
this curve is defined to be the maximum cumulative loss from a peak to the
following minimal trough during a trading period. The MDD is emphasized
in the Figure 8 by the measured height. Formally, if ROCS (k) is a the
cumulative return sequence, its MDD in the time interval [t, t + n] is,
MDDS (xt+n
) = max { max [ROCS (k) − ROCS (τ )]}.
t
τ ∈[t,t+n] k∈(t,τ )

(6)

The Sharpe ratio(SR), sharpeS (xt+n
), is a risk-adjusted return measure
t
[17]. Intuitively it characterizes how smooth and steep the rolling cumulative
return curve is,
retS (xt+n
)−1
t
sharpeS (xt+n
)
=
.
(7)
t
std(ROCS (xt+n
))
t
It is common to annualize SR in order to be able to compare SR for
different time periods. Thus, for daily data, the annualized Sharpe Ratio
(ASR) is,
RETS (xt+n
)−1
t
√
.
(8)
SHARP ES (xt+n
)
=
t
std(ROCS (xt+n
)) · 252
t
3

There 252 business days in a year.

18

Figure 8: Maximum drawdown (MDD) example

The last metric we introduce is the rate of success, RAT ES S (xt+n
), which
t
is simply proportion of successful trades,
P
I(xsi > xbi )
t+n
RAT ES S (xt ) =
.
(9)
L
As a natural benchmark for trading performance we take the buy-and-hold
(BAH) strategy, which simply buys the stock at the beginning of the period
and then sells it in the end of the period. While this strategy is very simple
(and perhaps naive), it makes much sense in the stock market.4 Calculations
of the above performance metrics for the BAH strategy are straightforward,
according to the above formulas ((3)) - ((9)) by assigning b1 = t, s1 = t + n,
and L = 1.
6.1. Example: predicting turning points with SVR
In Figure 9a we demonstrate predictions obtained by our SVR model over
an out-of-sample (i.e., test) data. In this example we restricted attention
to turning points with impact γ = 0.01, and trained the model over one
year of the DJIA index from 07-Sep-2004 to 09-Nov-2005. The SVR hyperparameters and the thresholds were selected over a validation segment from
11-Nov-2005 to 30-Jan-2006, and predictions were performed for an out-ofsample test period from 08-Feb-2006 to 25-Apr-2006 (this period is shown in
the figure). In this example feature vectors consisted of the past eight prices
normalized to reside in [0, 1]. The SVR hyper-parameters were optimized
4

In fact, many economists believe that BAH is the only strategy that makes sense [18].

19

over the grid Θ(C, σ, ǫ) = [2−10 , 2−9...210 ] × [2−10 , 2−9 ...210 ] × [0.01, 0.05, 0.1].
The best model parameters that were found in this grid were C = 32, γ =
0.0625, ǫ = 0.05. The turning points identified by this model are marked
in the figure. We note that the prediction problem (data and train/test
periods) in this demonstration is precisely the same as the one used in [2] for
evaluation.
7. Predicting turning points with neural networks
In this section we briefly describe the original turning points prediction
model of Li et al. [2], which relies on neural networks. In their methods, the
feature vector consists of normalized prices within a recent backward window. The size of this window is determined by calculating the embedding
dimension over the training sequence. The target function to be regressed
and predicted is the TP Oscillator restricted to turning points with momentum γ and lookeahead window length which is calculated using the Largest
Lyapunov exponent of the training sequence (see details in [2]). The training
set is constructed as described in Section 9.1. The model trains a number of
neural networks, which differ in the number of neurons in their single hidden layer. These networks form an ensemble whose prediction is generated
by aggregating individual networks outputs using their weighted sum. These
ensemble weights, as well as the prediction thresholds, are optimized to minimize the T pRMSE function (see Section 5.1) over a validation sequence. For
further details on how the backward window size is determined, the reader
is referred to [2]. We only note that the empirical studies conducted in [2]
considered two price sequences, DJIA including 411 points, and TESCO consisting of 492 points. In both cases the backward window length was taken
to be eight days.
8. Comparison between the SVR and the ANN methods
Having described the SVR and the ANN models in Sections 5 and 7,
respectively, we would like to emphasize the resemblance and differences
between these two methods. Both methods are focused on predicting turning
points and in general, we were motivated by the Li et all. paper [2], followed
their general outline, and drew on a number of their ideas, including the
utilization of their TP oscillator and their loss function. Our variant differs in
several aspects. Aside from the different regression algorithm (their ensemble
20

(a) TP Oscillator and its prediction

(b) Applying TP Oscillator and thresholds for TP prediction. The upper
chart depicts prices, circles mark the actual turning points and squares
mark predicted turning points. The lower chart depicts the TP Oscillator
prediction, the horizontal lines are the thresholds.
Figure 9: Demonstration of SVR model predictions over an out-of-sample DJIA data

21

of neural networks vs. our support vector regression), our model relies on a
different feature set and utilizes a different target function. Specifically, the
feature set in [2] is a window of the past prices. In our case, the features are
both prices and the Fourier coefficients of the prices. The target function
used in [2] is the TP Oscillator restricted to momentum turning points of
particular magnitude (and lookahead window length). In our case it is the
TP Oscillator of defined with impact turning points of particular magnitude.
The differences between our approach and theirs are summarized in Table 1.

Feature vector length
Turning point property
Regression algorithm
Input representation

[2]

Our work

Chaotic embedding dimension
Momentum
Ensemble of neural networks
Raw prices

Optimized length (hyper-parameter)
Impact
Support Vector Regression (SVR)
Raw prices and Fourier coefficients

Table 1: Summary of differences between ANN and SVR models

9. Experimental design
We conducted an extensive set of experiments to evaluate the SVR and
ANN turning points prediction models discussed in Sections 5 and 7, respectively. Our evaluation is performed in terms of the simple trading application
introduced in Section 7. We evaluated the models over historical price segments of the Dow Jones Industrial Average (DJIA). Since financial sequences
such as the DJIA exhibit great many behaviors and are extremely noisy, we
considered in our experiments many predicting tasks, corresponding to many
sequence segments along the DJIA history. To facilitate the discussion we
first define and discuss in the following subsections the essential technical
aspects in our experimental design.
9.1. Train, validation and test splits
Each instance of a prediction task is a triplet of price subsequences of
the financial sequence in question (DJIA) consisting of training, validation
and test segments, as depicted in Figure 10. Thus, the prices in each of
the segments are contiguous and the segments follow each other chronologically. The training segment is used to fit model parameters (for the SVR
or ANN models). The validation segment is used for model selection via
hyper-parameter tuning, and the test segment is utilized to evaluate performance. Each such triplet is called a prediction task. We denote the lengths
22

of the three segments by Ntrain , Nvalid and Ntest , respectively, and the choice
of these parameters in our experiments will be discussed later.

Figure 10: Splitting data into train, validation and test segments

9.2. Statistical validity
Our tests consider multiple methods and multiple prediction tasks. To ensure statistical validity of our conclusions, we utilize the following statistical
tests.
9.2.1. Tests for pairwise comparisons
When comparing the performance of two algorithms, or two instances of
an algorithm (i.e., the same algorithm applied with different parameters) over
multiple tasks, we use the Wilcoxon Signed-Rank test, as recommended and
described in [19] Section 3.1.3. For a pair of algorithms of interest, we conduct
the test and calculate the p-value. If the the performance difference can be
accepted at 5% level, we conclude that one of the algorithms is significantly
better than the other (at 5% significance level); otherwise, we conclude that
the algorithms are statistically indistinguishable.
9.2.2. Tests for multiple comparisons
When comparing a group of algorithms (more than two) over multiple
tasks we use the Friedman test to determine the rank of each of algorithm.
In this case the p-value indicates whether differences between the algorithms
are significant. If significant differences are observed, we proceed with a
post-hoc test using the Bonferonni-Dunn test for pairwise rank comparisons
in order to find out the best performing algorithm in the group. The precise
procedure we follow is described in [19] Section 3.2.2.

23

9.3. Software
All experiments were conducted under Matlab. For training the ANN
models we used the Matlab Neural Network toolbox. The SVR models were
computed using the SVMLib toolbox [16].
9.4. Dataset
Following [2] our data set consisted of close prices of the DJIA index.5
We analyzed a large DJIA segment from 1/1/1960 to 1/1/2010. Spanning 50
years, this sequence contains 12585 prices. In this time range we selected 300
prediction (and trading) problem tasks uniformly at random. This quite large
number of problem instances was chosen to ensure statistical significance.
In particular, the statistics reported are typically averaged over these 300
instances. As discussed in Section 9.1, each of the 300 tasks is a triplet
consisting of consecutive train, validation and test segments. The lengths of
these segments are Ntrain = 504 days (two years), Nvalidate = 60 days, and
Ntest = 60 days. Finally, we note that the 300 test periods in our prediction
tasks sometimes overlap, but in general they are uniformly spread along the
50 year period.6
9.5. Details of the SVR model and its hyper-parameters
Our SVR model is described in Section 5. To actually apply this model,
we need to make some choices regarding representation. Specifically, we need
to choose the type of turning points to focus on, either pivot (of a certain
degree), impact or momentum, and in each case select desired resolution,
controlled by the pivot degree or the parameter γ (see Section 3.1). The
SVR model itself is controlled by three hyper-parameters: C, σ and ǫ. The
role of these parameters is described in [15]. Turning point identification is
achieved using two additional hyper-parameters, Tlow and Thigh , as described
in Section 6. The SVR model selection is performed using a straightforward grid search for the best triplet of SVR hyper-parameters. This SVR
parameter space (grid), denoted Θ(C, σ, ǫ), was chosen to be
Θ(C, σ, ǫ) = {0.1, 1, 100} × {0.1, 1, 100} × {0.01, 0.05, 0.1}.
5

We downloaded the prices from Yahoo! Finance, http://finance.yahoo.com.
The precise periods selected for these 300 tasks were recorded and can be obtained
from the authors.
6

24

Similarly, the parameter space (grid) for the thresholds was taken to be
Θ(Tlow , Thigh ) = [0 1] × [0 1],

with step 0.01.

These choices were made based on a preliminary rough study on other price
sequences before conducting the experiments and were not optimized thereafter.
9.6. Details of the ANN model and its hyper-parameters
The ANN model of Li et al. [2] is briefly introduced in Section 7. In
order to replicate their model as accurately as possible we followed all their
choices. The parameters for the backpropagation learning algorithm were:
• Transfer function: hyperbolic tangent;
• Output function: linear function.
• Backpropagation learning function: gradient descent with learning rate
0.01.
The chaotic characteristics of the time series were used for selecting some of
the parameters as follows:
• The embedding dimension m of the training segment was used to determine the backward window length. Embedding dimension calculations
were performed using Cao’s method [20] as implemented by Merkwirth
et al. in their Matlab toolbox [21].
• The time delay τ was used to determine the sampling rate of the input
data. The time delay was calculated in accordance with the mutual information method described in [22], and implemented in the Merkwirth
et al. Matlab toolbox as well [21].
• The largest Lyapunov exponent λ was used to determine the lookahead
window length (required to define the impact turning points), and was
set to 1/λ, as was done in [2]. This Lyapunov exponent was calculated
using Rosenstein et al’s method [23] as implemented by Hegger et al. in
their TISEAN tool [24]. All these chaotic parameters were calculated
over the training data segment.

25

Since the neural network training algorithm starts with random initial
network weights, we performed standard ‘random restarts’ to initialize these
weights. We used 10 random restarts for the training of each prediction
task as is common in practice. Thus, we obtained 10 sets of results for each
instance and selected the best performing one over the validation segment.
With these methods for parameter selection we were able to reproduce the
results of [2] for the particular prediction task (i.e., a particular training/test
segment) used in their paper for evaluation. (this prediction task is used
in our example of Section 6.1). Since Li et al. used only one DJIA task
for evaluation, one of our contributions is a more through analysis of their
method using multiple tasks.
9.7. Results
In this section we present the results of our experiments. Throughout
the presentation, SVR refers to the proposed model and ANN refers to the
original method of [2].
9.7.1. Experiment 1: SVR vs. ANN vs. BAH
The first set of results is a comparative study of SVR and ANN. For both
methods, we experimented with two types of target functions. The functions
we considered in this study were generated using either momentum pivots
(as originally proposed in [2]) of varying degrees, or impact pivots of varying
degrees. The other parameters of these experiments are summarized in Table
2.

Features
Input length
Time delay
Look-ahead
Ntrain (training segment length)
Nvalidate (validation segment length)
Ntest test segment length

ANN

SVR

Raw prices
Chaotic
Chaotic
Chaotic
2 years
60 days
60 days

Raw prices and Fourier coefficients
8
1
2 years
60 days
60 days

Table 2: Experiment 1: Parameters of the SVR and ANN models. The specification
‘Chaotic’ in the ANN column means that the parameters were selected based on chaotic
dynamics analysis as described in Section 9.6.

The results of the experiments are presented in Table B.12. The table
summarizes the performance obtained with the two types of pivot points
26

(momentum and impact). For each pivot type we show the performance for
a number of γ values (recall that γ specifies the resolution or “importance”
of the pivot). At the lower part of the table the performance of buy-andhold (BAH) is specified. It is evident that both methods suffer from greater
values of γ (5% and 10%) and very small values of γ(0.1%). Specifically, for
these γ values the mean returns are lower than the corresponding return of
BAH, and the Sharpe ratios do not exceed by much the Sharpe ratio of BAH.
With lower values of γ (1% and 2%) ANN still fails to beat the BAH mean
return, while SVR is better than the BAH in average, but this advantage
is not statistically significant according to Wilcoxon signed rank test whose
results are summarized in Table B.8 in the appendix.
With impact pivot points both ANN and SVR achieved good Sharpe
ratios that are better than the BAH Sharpe ratio. This advantage is statistically significant. In addition, SVR is superior to ANN in terms of both mean
return and the mean Sharpe ratio. When considering the MDD measure, we
observe that both SVR and ANN achieved better (smaller) MDD than the
BAH. The best performing γ in terms of Sharpe ratio is γ = 2% (for both
types of pivot types). This emphasizes that the proposed models are more
useful for shorter term prediction of smaller sized fluctuations.
Remark: The p-values corresponding of the Wilcoxon signed-rank test of
this experiment appear in Table B.8 in the Appendix.
9.7.2. Experiment 2: SVR Backward window size
We tested the SVR performance for short (4), medium (8) and large
(50) backward windows lengths. Table 4 presents the results of these tests
for three types of turning points (2%-momentum, 2%-impact and pivots of
degree 10). Table B.9 in the appendix shows a comparison of the SVR
return, success rate, maximum drawdown and Sharpe ratio, for the three
backward window length, with the corresponding metrics of BAH. that table
also includes the Friedman ranks statistics of these tests. From this comparative analysis we can conclude that the small and medium backward window
lengths allow SVR to perform significantly better than BAH in terms of
Sharpe ratio. However, according to the Friedman ranks analysis, small and
medium ASR belong to the same performance group. this means that no
statistically significant difference between them was detected in the post-hoc
test.

27

7

Success Rate

Mean MDD

Mean ASR

1.28% ± 0.30%
1.10% ± 0.25%

68.02% ± 1.66%
61.08% ± 0.97%

2.17% ± 0.20%
1.75% ± 0.12%

0.94 ± 0.13
0.91 ± 0.12

1.81% ± 0.28%(*)
1.06% ± 0.22%

69.89% ± 1.83%
62.76% ± 1.27%

1.92%±0.18%
1.98%±13.00%

1.34±0.12(*)
1.14 ± 0.11

1.77% ± 0.22%(*)
1.02% ± 0.18%

73.82% ± 1.87%
66.17% ± 1.39%

1.73%±0.18%
1.91%±0.15%

1.67±0.13(*)
1.13±0.10

0.59% ± 0.20%
0.65% ± 0.13%

64.58% ± 2.31%
63.47% ± 1.79%

1.37%±0.18%
1.27%±0.12%

1.26±0.13
1.04 ± 0.11

0.54% ± 0.16%
0.37% ± 0.09%

76.10% ± 2.31%
61.27% ± 2.04%

0.63%±0.13%
0.57%±0.07%

1.79 ± 0.12
0.81 ± 0.11

Mean Return
Turning points of impact γ
γ=0.1%
SVR
ANN
γ=1%
SVR
ANN
γ=2%
SVR
ANN
γ=5%
SVR
ANN
γ=10%
SVR
ANN

Turning points of momentum γ with respect to lookahead window w = 6
γ =0.1%
SVR
1.11% ± 0.28% 67.11% ± 1.65%
ANN
0.98% ± 0.24% 61.21% ± 0.98%
γ =1%
SVR 1.46% ± 0.28%(*) 67.81% ± 2.01%
ANN
1.07% ± 0.22% 62.26% ± 1.27%
γ =2%
SVR 1.43% ± 0.26%(*)
69.97 ± 2.26%
ANN
0.97% ± 0.18% 65.82% ± 1.39%
γ =5%
SVR
0.82% ± 0.15% 75.47% ± 2.20%
ANN
0.48% ± 0.13% 58.51% ± 1.79%
γ =10%
SVR
0.23% ± 0.06% 77.59% ± 2.35%
ANN
0.37% ± 0.09% 55.55% ± 2.04%
BAH mean return:1.44 ± 0.44%
BAH mean MDD:8.2 ± 0.41%
BAH mean ASR:1.01 ± 0.15%

2.22% ± 0.20%
1.71% ± 0.12%

0.82 ± 0.12
0.72 ± 0.11

1.65%±0.18%
1.90%±13.00%

1.26 ± 0.13(*)
1.03 ± 0.11

1.64%±0.17%
1.67%±0.15%

1.4±0.13(*)
1.09 ± 0.10

0.65%±0.11%
1.09%±0.12%

1.63 ± 0.13
0.51 ± 0.11

0.23%±0.07%
0.61%±0.07%

1.44 ± 0.09
0.69 ± 0.11

Table 3: Performance comparison between the SVR and ANN models for turning points
with impact and momentum characteristics. Whenever a result of one of the methods is
better at 5% level, according to Wilcoxon signed-rank test, we mark it with (*). Boldface
numbers mark results that exceed the corresponding BAH metric at 5% level.

28

Backward window

Mean return

Success Rate

Mean MDD

Mean ASR

Turning points with
4
8
50

impact γ = 2%
1.95% ± 0.28%
1.77% ± 0.22%
1.36% ± 0.22%

65.84% ± 1.74%
73.82% ± 1.87%
70.44% ± 2.27%

2.09%±0.22%
1.73%±0.18%
0.95%±0.14%

1.36±0.12
1.67±0.12
1.36 ± 0.13

Turning points with
4
8
50

momentum γ = 2%, lookahead window 6 days
1.59% ± 0.27% 66.41% ± 1.71% 1.99%±0.17%
1.43% ± 0.26%
69.97 ± 2.26% 1.64%±0.17%
1.39% ± 0.22% 69.90% ± 2.32% 0.93%±0.14%

Pivot turning points of degree 10
4
1.21 ± 0.28%
8
1.23 ± 0.20%
50
0.35 ± 0.31%

64.76 ± 1.92%
69.97 ± 2.26%
53.87 ± 2.59%

0.11±0.00
0.26±0.12
0.09±0.00

1.21±0.13
1.4±0.13
1.77 ± 0.13
2.32±0.22%
1.33±0.15%
1.50±0.25%

BAH mean return:1.44 ± 0.44%
BAH mean MDD:8.2 ± 0.41%
BAH mean ASR:1.01 ± 0.15%
Table 4: Performance dependence on backward window length. Boldface numbers are
significantly better than the corresponding BAH metrics. The p-values of the pairwise
tests with BAH and Friedman ranks are summarized in Table B.9.

29

9.7.3. Experiment 3: SVR training segment length
The goal of this experiment was to see how performance is influenced
by the training segment length. To this end, we considered three lengths:
short (0.5 year), medium (1 and 2 years) and long (5 years). The results are
presented in the Table 5. Based on the statistical analysis of these results
(summarized in Table B.10 in the appendix), we conclude that the algorithm exhibits similar performance for these four training segment lengths,
and this holds for the three types of pivot points (pivot degree, momentum
and impact). While the average Sharpe ratios and returns are higher for
longer training segments, the Friedman rank analysis cannot designate these
differences statistically significant.
Training set length

Mean return

Success Rate

Mean MDD

Mean ASR

Impact turning points
0.5 year 1.77% ± 0.25%
1 year 1.47% ± 0.22%
2 years 1.77% ± 0.22%
5 years 2.12% ± 0.26%

66.84%±2.19%
70.95%±2.05%
73.82%±1.87%
73.92%±1.97%

1.86%±0.18%
1.79%±0.18%
1.73%±0.18%
1.90%±0.19%

1.36±0.13
1.38±0.12
1.67±0.12
1.67±0.12

68.00% ± 1.90%
68.52% ± 1.80%
69.97 ± 2.26%
65.44% ± 2.13%

1.66%±0.18%
1.66%±0.17%
1.64%±0.17%
1.63%±0.19%

1.23±0.13
1.25±0.13
1.4±0.13
1.15±0.13

63.63% ± 2.38%
65.97% ± 2.42%
69.97% ± 2.26%
70.18% ± 2.32%

1.63%±0.20%
1.72%±0.20%
1.33%±0.15%
1.44%±0.18%

0.96±0.12
1.23±0.13
1.45±0.12
1.35±0.14

Momentum turning
0.5 year
1 year
2 years
5 years

points
1.07% ± 0.27%
1.42% ± 0.27%
1.43% ± 0.26%
1.36% ± 0.28%

Pivot degree turning
0.5 year
1 year
2 years
5 years

points
0.63% ± 0.20%
1.07% ± 0.24%
1.23% ± 0.20%
1.08% ± 0.23%

BAH mean return:1.44 ± 0.44%
BAH mean MDD:8.2 ± 0.41%
BAH mean ASR:1.01 ± 0.15%
Table 5: Performance dependence on training segment length

30

9.7.4. Experiment 4: reproduction of the Li et al. results in [2]
In this experiment the goal was to reproduce the results presented in [2]
for the original ANN model with respect to the DJIA and TESCO price sequences. Due to the use of randomization in the backpropagation training
algorithm (used for random assignment of initial weights), we ran each experiment 20 times in order to receive a robust estimation of the result. The results
are presented In Table 9.7.4 (containing sub-tables (a) for DJIA, and (b) for
TESCO). All these experiments consider the same training/validation/test
partition.8
As expected, due to this randomized ANN training, the 20 the returns
obtained (for each dataset) vary considerably. The results reported in [2] are
quite close to the best return among the 20. Specifically, Li et al. report on
6.21 return for DJIA (vs. our 5.97), and 11.63 return for TESCO (vs. our
10.94).
The average returns we obtained in both experiments are, unfortunately,
not as optimistic as reported in [2] and, in particular, in our experiments the
ANN model could not outperform BAH. Using the SVR model over these test
segments we obtained a return of 2.31% for DJIA and 7.83% for TESCO.
These results are robust since no random selections are made in our SVR
training and prediction.
9.7.5. Experiment 5: ANN ensemble size
The goals of this experiment were to test how the ANN performance is
influenced by the ensemble size. In particular, we were also interested to see
if a single network can perform as well as an ensemble. In the first experiment
we ran the ANN model with a single network, with varying number of neurons
in the hidden layer. In the second experiment we ran the ANN model with
different ensemble sizes. In this case, the number of neurons in the hidden
layer of each ensemble member was taken from the interval [m, m + n] where
m is the backward window length and n is the ensemble size.9
Table 7 summarizes the performance of these settings. These results con8

For the DJIA sequence, the training period is 7/9/2005-10/11/2005, the validation
period is 11/11/2005-29/1/2006, and the test period is 30/1/2006-25/4/2006; for TESCO
sequence the training period is 18/11/2004-31/-5/2006, the validation period is 1/06/200626/07/3006, and the test period is 27/7/2006-9/10/2006.
9
This choice was not explicitly mentioned in [2] but was obtained from Li et al. by
personal communication.

31

Return(%)
Success Rate
1.05
66.67%
3.85
100.00%
3.05
100.00%
2.91
100.00%
4.68
75.00%
3.26
75.00%
5.57
100.00%
3.82
66.67%
2.56
66.67%
4.50
100.00%
5.97
100.00%
2.80
100.00%
2.35
100.00%
5.42
100.00%
1.91
66.67%
3.90
100.00%
2.96
75.00%
0.81
66.67%
4.14
100.00%
3.85
75.00%
Average TPP return:1.39% ± 0.31%
BAH: 3.91%

Return(%)
Success Rate
0.00
NaN
6.86
100.00%
8.86
100.00%
0.00
NaN
7.96
100.00%
3.53
100.00%
9.42
100.00%
0.00
NaN
0.00
NaN
3.46
100.00%
7.62
100.00%
0.00
NaN
0.00
NaN
0.00
NaN
7.06
100.00%
1.59
100.00%
5.82
75.00%
10.94
100.00%
7.89
100.00%
1.73
100.00%
Average TPP return:4.14% ± 0.85%
BAH: 6.37%

(a) DJIA dataset

(b) TESCO dataset

Table 6: Attempting to replicate the [2] results: 20 iterations of the ANN model on the
DJIA and TESCO datasets

firm that an ensemble, containing multiple networks outperforms a model
with a single network. As for the ensemble size, in a direct comparison,
no statistically significant difference between ensembles of sizes 2, 5, 10 or
50 members was observed. Nevertheless, the ensemble of size 10 excelled,
compared to the other three ensembles, in that it was the only one which
outperformed BAH in terms of Sharpe ratio in a statistically significant manner (ensembles with 5,10 and 50 members obtained better Sharpe ratio than
BAH).
9.7.6. Some caveats regarding performance calculation
Here we discuss caveats that should be accounted for in examining the
above results. Our experimental protocol examined the trading performance
during numerous test segments each of which fixed in length (60 days). Each
trade is completed only when both entry and exit signals are generated. The
first problematic situation occurred in instances where an entry signal was
generated during the test segment but no matching exit signal was obtained
during the same test segment. We could treat such instances in various ways
(e.g., discard the trade, end it prematurely, or follow it till it end in another
32

Mean return

Success Rate

Mean MDD

Mean ASR

64.58%±6.29%
58.90%±5.11%
64.46%±3.42%
53.13%±1.50%

0.15%±0.05%
0.43%±0.12%
1.00%±0.15%
1.59%±0.21%

1.21±0.28
1.00±0.24
0.83±0.23
0.59±0.23

0.58%±0.10%
0.95%±0.14%
1.22%±0.19%
1.25%±0.14%

1.15±0.22
1.27±0.23
1.38±0.23
1.11±0.22

Single network
Neurons number
2 0.09%±0.07%
5 0.30%±0.12%
10 0.68%±0.31%
50 0.88%±0.42%

Ensemble of networks
Members
2 0.57%±0.20% 62.18%±4.02%
5 1.33%±0.27% 63.60%±3.56%
10 1.32%±0.33% 69.35%±3.01%
50 1.35%±0.37% 63.68%±2.15%
BAH mean return:1.18 ± 0.87%
BAH mean MDD: 6.59 ± 0.55%
BAH mean ASR: 0.78 ± 0.3

Table 7: Performance of the ANN model with a single network constructed with various
hidden layer sizes; performance of the ANN model with various ensemble sizes

33

segment). For simplicity of implementation, in our statistics we ignored such
trades. after observing that the results with or without them are very close.
The second problematic situation is when no signals were generated at
all during a test segment. In such instances the return of the strategy and
the maximum drawdown are zero, while the Sharpe ratio is not well defined,
because the standard deviation of the cumulative return (i.e., risk) is zero
as well. Hence, we omitted such instances when calculating and averaging
Sharpe ratios. The same consideration and treatment was applied to the success rate metric. Here, when no trades are performed during a test segment,
the success rate is 100% but is vacuous. Therefore, to be fair, we discarded
these periods as well when averaging the success rate. An alternative treatment in the case of the Sharpe ratio could be to define the Sharpe ratio of
such periods as zero and include it in the statistics. Similarly, we could define
the success rate of empty segments as zero as well. However, this treatment
does not make much sense.10
To quantify the extent of test periods with undefined Sharpe ratios, consider two settings of SVR prediction defined with impact turning points of
resolutions γ = 0.01 and γ = 0.02 (see Table B.12). For 0.01-impact turning
points there are 23 test segments without trades (8% of all segments). The
average BAH return and Sharpe ratio over these segments only are 0.9% and
1.19, respectively. If we discard these segments when calculating the SVR
mean Sharpe ratio we obtain 1.34. However, if we account these undefined
Sharpe ratio as zeros, the result is 0.8. The BAH Sharpe ratio for all test segments is 1.01. When considering the setting with 0.02-impact turning points,
there are 67 segments (22%) without trades (we have more such segments
in this setting because turning points occur less frequently so there are less
trades). The average BAH return and Sharpe ratio for these empty segments
are 1.2%, and 1.12, respectively. When we substitute zero for these undefined
Sharpe ratios the resulting mean Sharpe ratio for SVR in all periods is 1.02,
as opposed to 1.67 when ignoring these empty segments.
For ANN prediction with impact turning points the analogous results
are as follows. For γ = 0.01, there are (on average) 26.4 test segments
without any trades. The average BAH return and Sharpe ratio over these
10

If we do count the Sharpe ratio of such test periods as zero, the resulting average
Sharpe ratio of SVR and ANN do not perform significantly better than the average BAH
Sharpe.

34

segments are 2.68% and 1.48, respectively. If we discard these segments, the
Sharpe ratio obtained is 1.14. However, if we consider these Sharpe ratios
as zeros, the result is 0.6. When considering the setting with 0.02 impact
turning points, there are 51.4 segments without trades on average. For these
segments the average BAH return is 2.32%, the average Sharpe ratio is 1.36.
When takeing these Sharpe ratios as zeros, the resulting ratio is 0.67. When
ignoring these segments the average Sharpe ration is 1.13.
10. Concluding remarks
Drawing on, and extending useful ideas of Li et al. [2], we proposed and
studied a prediction model for turning points that relies on support vector
regression (SVR). Extensive empirical examination of the proposed model
showed that it outperforms the Li et al. neural network model for the same
prediction problem. This advantage is statistically significant. While our
SVR model achieves higher average return than the buy-and-hold benchmark,
the difference between the two is not statistically significant. However, the
SVR model suffers from significantly lower drawdowns and exhibits higher
risk adjust return (Sharpe ratio) than the buy-and-hold. This significantly
lesser risk may give rise to substantially larger return as well using leverage.
Our studies included a complete reproduction and a thorough analysis
of the ANN prediction model of Li et al. [2]. This model is considered the
state-of-the-art in turning point prediction. Our tests included an empirical
valuation of that model over multiple periods (as opposed to a single period in
the original paper).11 Our conclusions differ than those of Li et al. in regards
to the performance of their model, and in particular, are less optimistic than
their conclusions. Nevertheless, their ANN model contains interesting and
useful ideas that have been utilized here and laid the foundations of the
present work.
Our work can be extended and modified in various interesting ways. First,
it would be interesting to see if better representation can be constructed
that utilizes other price sequences and economical indicators. Such intermarket models are considered be more powerful than autoregressive models.
It would also be very interesting to examine lower time-frames such as hourly
prices. While intraday data is considered to be more noisy, it contain more
11

More precisely, the Li et al. empirical evaluation was confined to two price sequences
(DJIA and TESCO) and for each sequence a single test period was considered.

35

fluctuations that could be identified by our model. Finally, it would be
interesting to include rejection mechanisms in the spirit of Chow (see, e.g.,
[25, 26] that can increase prediction accuracy by avoiding prediction in cases
of uncertainty.
References
[1] N. D. Kondratieff, W. F. Stolper, The long waves in economic life, The
Review of Economics and Statistics 17 (6) (1935) pp. 105–115.
[2] X. Li, Z. Deng, J. Luo, Trading strategy design in financial investment
through a turning points prediction scheme, Expert Systems with Applications 36 (4) (2009) 7818 – 7826.
[3] A. F. Burns, W. C. Mitchell, Measuring Business Cycles, NBER, 1946.
[4] G. Bry, C. Boschan, Cyclical Analysis of Time Series Selected Procedures and Computer Programs, National Bureau of Economic Research,
Inc, 1971.
[5] A. R. Pagan, K. A. Sossounov, A simple framework for analyzing bull
and bear markets (Nov. 16 2001).
[6] W. E. Wecker, Predicting the turning points of a time series, The Journal
of Business 52 (1) (1979) pp. 35–50.
[7] J. D. Hamilton, A new approach to the economic analysis of nonstationary time series and the business cycle, Econometrica 57 (2) (1989) pp.
357–384.
[8] J. M. Maheu, T. H. McCurdy, Identifying bull and bear markets in stock
returns, Journal of Business and Economic Statistics 18 (1) (2000) pp.
100–112.
[9] A. Lunde, A. Timmermann, Duration dependence in stock prices, Journal of Business and Economic Statistics 22 (3) (2004) 253–273.
[10] D. Bao, Z. Yang, Intelligent stock trading system by turning point confirming and probabilistic reasoning, Expert Systems with Applications
34 (1) (2008) 620 – 627.

36

[11] A. Azzini, C. da Costa Pereira, A. Tettamanzi, Predicting turning points
in financial markets with fuzzy-evolutionary and neuro-evolutionary
modeling, in: M. Giacobini, A. Brabazon, S. Cagnoni, G. Di Caro,
A. Ekrt, A. Esparcia-Alczar, M. Farooq, A. Fink, P. Machado (Eds.),
Applications of Evolutionary Computing, Vol. 5484 of Lecture Notes in
Computer Science, Springer Berlin / Heidelberg, 2009, pp. 213–222.
[12] F. Takens, Detecting strange attractors in turbulence, in: D. Rand, L.S. Young (Eds.), Dynamical Systems and Turbulence, Warwick 1980,
Vol. 898 of Lecture Notes in Mathematics, Springer Berlin / Heidelberg,
1981, pp. 366–381.
[13] R. Kohavi, G. John, Wrappers for feature subset selection, Artificial
Intelligence 97 (1-2) (1997) 273–324.
[14] V. N. Vapnik, The nature of statistical learning theory, Springer-Verlag
New York, Inc., New York, NY, USA, 1995.
[15] A. J. Smola, B. Schölkopf, A tutorial on support vector regression,
Statistics and Computing 14 (2004) 199–222.
[16] C.-C. Chang, C.-J. Lin, LIBSVM: a library for support vector machines,
software available at http://www.csie.ntu.edu.tw/ cjlin/libsvm (2001).
[17] W. F. Sharpe, The sharpe ratio, Journal OF Portfolio Management
21 (1) (1994) 49–58.
[18] B. G. Malkiel, A random walk down Wall Street / Burton G. Malkiel,
[1st ed.] Edition, Norton, New York :, 1973.
[19] J. Demsar, Statistical comparisons of classifiers over multiple data sets,
Journal of Machine Learning Research 7 (2006) 1–30.
[20] L. Cao, Practical method for determining the minimum embedding dimension of a scalar time series, Phys. D 110 (1997) 43–50.
[21] C. Merkwirth, U. Parlitz, I. Wedekind, W. Lauterborn,
Open-tstool. matlab toolbox, Attractors, Signals, and Synergetics.
URL Accessedathttp://www.phsik3.gwdg.de/tstool/

37

[22] A. M. Fraser, H. L. Swinney, Independent coordinates for strange attractors from mutual information, Phys. Rev. A 33 (2) (1986) 1134–1140.
[23] M. T. Rosenstein, J. J. Collins, C. J. De Luca, A practical method for
calculating largest lyapunov exponents from small data sets, Phys. D 65
(1993) 117–134.
[24] R. Hegger, H. Kantz, T. Schreiber, Practical implementation of nonlinear time series methods: The TISEAN package, Chaos 9 (1999) 413.
[25] C. Chow, On optimum recognition error and reject tradeoff, IEEE Transactions on Information Theory 16 (1970) 41–46.
[26] R. El-Yaniv, Y. Wiener, On the foundations of noise-free selective classification, J. Mach. Learn. Res. 11 (2010) 1605–1641.

38

Appendix A. An algorithm for extracting alternating pivots
We are given a time series and would like to extract an alternating sequence of peaks and troughs that satisfy a given property. Throughout the
description of the algorithm we only consider pivots that satisfy the given
property. The first phase of this procedure extracts an alternating sequence
of peaks/troughs. The second phase improves the outcome by considering
better (higher or lower) alternatives for each pivot.
Extract initial alternating sequence of peaks and troughs.
1. Identify the first pivot in the sequence and assume w.l.o.g. that it is a
trough T1 .
2. Find the subsequent peak P1 .
3. Discard all troughs appearing between the trough T1 and the peak P1 .
Denote by D the set of all discarded peaks and troughs.
4. Let T2 be the subsequent trough. Discard all peaks between P1 and T2 .
5. Repeat these steps steps until there are no more peaks and troughs.
Peaks/Troughs improvement. Consider the alternating sequence of peaks
and troughs computing as described above. For each pair of subsequent
troughs Ti and Tj there exists a unique peak Pk appearing between the Ti
and Tj (due to alternation). Replace Pk by Pk′ if Pk < Pk′ (i.e. Pk′ is a higher
peak) and Pk′ ∈ D (i.e., it was discarded in step (3) of the first phase). Apply
the analogous procedure to improve troughs.

39

Appendix B. Additional experimental details
Here we provide complimentary details for the experiments described in
sections 9.7.1, 9.7.2, and 9.7.3.
Experiment 1: SVR vs. ANN vs. BAH.. In Experiment 1(Section 9.7.1)
we compared the performance of the SVR model to the performance of the
ANN model. In addition, we compared each of these algorithms to the BAH
benchmark. In Table B.8 the p-values for the Wilcoxon signed rank test are
presented for each of the three comparisons (ANN vs. SVR, BAH vs. ANN,
and BAH vs. SVR), and for each of the performance metrics (Mean Return,
Mean MDD, Mean ASR). Whenever the p-value obtained in the test is less
than 0.05, we can conclude that the performance of two compared algorithms
is significantly different (such p-values appear in boldface font), otherwise
we conclude that the performance is statistically indistinguishable at 95%
confidence level.
Experiment 2: SVR Backward window size.. In Experiment 2(Section 9.7.2)
we examined the performance of the SVR prediction model as a function
of the backward window length. This examination was repeated for different pivot point types. Statistical analysis was performed separately for each
pivot point type. Two statistical tests were conducted: the Wilcoxon signedrank test to compare the performance of SVR and BAH (each one of the
performance metrics was compared to the corresponding BAH metric), and
the Friedman test to compare the SVR performance for each pivot point
type. The Friedman test has two stages. In the first stage, the null hypothesis is that “all algorithms have the same performance and the results differ
due to a chance.” If the null hypothesis is not rejected at 95% confidence
level, we conclude that all the algorithms in the group are statistically indistinguishable. Otherwise, if the hypothesis is rejected, a post-hoc test is
performed that divides the group into two or more subgroups such that in
each subgroup the performance is indistinguishable at 95% level. In case that
such a subgroup exist, we denote the best subgroup members with boldface
in Table B.9.

40

pValues

Return

MDD

ASR

ANN vs SVR
0.1%
1%
2%
5%
10%

0.6684
0.0101
0.029
0.522
0.0192

0.03
0.019
0.013
0.162
0.21

0.4798
0.035
0.044
0.0464
0.51

BAH vs ANN
0.1%
1%
2%
5%
10%

0.595
0.947783
0.865876
0.909438
0.722563

2.27E-15
4.25E-16
8.00E-17
7.55E-17
3.17E-16

0.5073
0.055
0.0135
0.0954
0.8875

BAH vs SVR
0.1%
0.375
2.09E-9
0.8899
1% 0.564861 3.30E-17
0.0028
2%
0.7482 5.31E-17 2.20E-05
5% 0.501418 7.98E-17
0.0918
10%
0.0277 4.98E-21
0.265
Table B.8: Experiment 1: p-values of the Wilcoxon signed-rank test comparing pairwise
performance of ANN, SVR and the BAH benchmark.

41

Wilcoxon Signed-Rank Test
Backward window

Return

Friedman ranks

MDD

ASR

Return

MDD

ASR

0.5348 2.15E-48
0.8814 9.65E-43
0.3776 3.67E-38

0.0164
0.0001
0.128

2.09
2.04
1.87

2.2 2.05
2.07 2.09
1.73 1.86

0.469 2.12E-40
0.0855 2.13E-34
0.0723 1.12E-22

0.02
0.0118
0.1717

2.09
1.95
1.96

2.27
2.04
1.69

2.14
1.98
1.88

0.3921 7.84E-39
0.0672 5.73E-31
0.0513 2.30E-21

0.0289
0.0046
0.6463

2.05
2.02
1.93

2.24
2.03
1.74

2.09
2.01
1.9

Impact
4
8
50
Momentum
4
8
50
Pivot
4
8
50

Table B.9: Experiment 2: Performance dependence on backward window length. p-values
of the BAH comparison, and the Friedman rank test. The values representing statistical
significance p < 0.05 for the Wilcoxon and Friedman post-hoc tests are marked with
boldface.

42

Experiment 3: SVR training segment length. Experiment 3(Section 9.7.3)
results presentation is similar to presentation of the results for Experiment 2
in Table B.9. The results of Wilcoxon test and Friedman test are summarized
in Table B.10.
Wilcoxon Signed-Rank Test
Train set length

Friedman ranks

Return

MDD

ASR

Return

MDD ASR

0.9101
0.7206
0.8814
0.2713

6.33E-44
1.37E-46
9.65E-43
8.13E-44

0.0077
0.0045
0.0001
0.0001

2.62
2.46
2.36
2.56

2.51
2.49
2.54
2.46

2.53
2.43
2.44
2.6

0.2074
0.1389
0.0855
0.5036

5.02E-33
2.66E-35
2.13E-34
2.48E-33

0.0488
0.004
0.0118
0.003

2.45
2.52
2.4
2.63

2.63
2.42
2.55
2.4

2.4
2.55
2.4
2.64

0.1771
0.2106
0.0672
0.0529

2.94E-29
2.78E-31
5.73E-31
7.57E-27

0.009
0.002
0.0046
0.0557

2.53
2.59
2.44
2.44

2.49
2.53
2.51
2.47

2.42
2.59
2.50
2.49

Impact
0.5 year
1 year
2 years
5 years
Momentum
0.5 year
1 year
2 years
5 years
Pivot
0.5 year
1 year
2 years
5 years

Table B.10: Experiment 3: Performance dependence on training segment length. Left part
contains p-values for BAH comparison, right part contains the Friedman ranks. Whenever
statistical significant difference is achieved, the results are marked with boldface.

43

Experiment 5: ANN ensemble size. Table Appendix B contains the data
segments along with their chaotic properties that were used in the experiment
described in Section 9.7.5.
Training start

Test start

EmbeddingDimension

Delay

LLE

Look-ahead

23-Sep-1958
01-Sep-1960
25-Jul-1961
22-Jul-1963
26-Jul-1963
20-Aug-1964
31-Jan-1966
03-Jul-1967
13-Dec-1967
20-Feb-1970
13-Jan-1971
15-Jan-1971
18-Mar-1971
23-Aug-1972
22-Nov-1972
12-Apr-1973
16-May-1974
22-Jul-1974
10-Feb-1975
04-Mar-1975
11-Nov-1975
27-Dec-1976
27-Mar-1978
24-Apr-1978
05-Feb-1979
28-Sep-1979
19-Feb-1982
31-Aug-1982
02-Sep-1983
12-Nov-1984
19-Dec-1986
20-Jan-1988
27-Feb-1989
22-Dec-1989
27-Aug-1990
30-Dec-1991
05-Aug-1993
06-Sep-1994
11-May-1995
05-May-1997
13-Oct-1998
28-Jun-2000
01-Apr-2002
23-Aug-2002
29-Apr-2003
22-Apr-2004
24-Jun-2004
25-Oct-2004
25-May-2005
01-Sep-2005

29-Feb-1960
08-Feb-1962
28-Dec-1962
24-Dec-1964
31-Dec-1964
25-Jan-1966
06-Jul-1967
15-Jan-1969
30-Jun-1969
26-Jul-1971
14-Jun-1972
16-Jun-1972
17-Aug-1972
30-Jan-1974
01-May-1974
16-Sep-1974
17-Oct-1975
22-Dec-1975
14-Jul-1976
04-Aug-1976
15-Apr-1977
31-May-1978
27-Aug-1979
25-Sep-1979
09-Jul-1980
04-Mar-1981
22-Jul-1983
01-Feb-1984
05-Feb-1985
18-Apr-1986
24-May-1988
22-Jun-1989
31-Jul-1990
29-May-1991
29-Jan-1992
02-Jun-1993
09-Jan-1995
07-Feb-1996
11-Oct-1996
07-Oct-1998
17-Mar-2000
06-Dec-2001
03-Sep-2003
29-Jan-2004
01-Oct-2004
26-Sep-2005
25-Nov-2005
30-Mar-2006
27-Oct-2006
08-Feb-2007

7
6
7
6
6
5
6
5
6
7
5
5
6
6
7
6
7
7
7
5
5
5
5
5
5
7
6
6
5
6
6
6
5
6
5
7
5
5
6
5
7
6
6
5
7
7
7
7
7
6

3
3
5
5
3
2
3
3
2
2
4
4
4
4
3
5
2
2
3
3
2
6
2
2
2
3
3
2
2
3
1
4
2
3
1
3
4
3
2
3
4
3
1
4
5
2
1
1
2
2

0.17
0.16
0.19
0.15
0.14
0.19
0.18
0.22
0.19
0.16
0.21
0.21
0.21
0.21
0.2
0.21
0.18
0.19
0.18
0.17
0.18
0.17
0.22
0.22
0.2
0.18
0.16
0.16
0.2
0.16
0.16
0.17
0.19
0.19
0.16
0.18
0.17
0.15
0.14
0.16
0.18
0.21
0.17
0.16
0.14
0.19
0.19
0.18
0.17
0.18

6
6
5
7
7
5
6
5
5
6
5
5
5
5
5
5
6
5
6
6
6
6
5
5
5
6
6
6
5
6
6
6
5
5
6
6
6
7
7
6
6
5
6
6
7
5
5
6
6
6

Table B.11: Details of the data segments used for ANN method

44

Success Rate

Mean MDD

Mean ASR

Turning points of impact γ
1% 1.55% ± 0.26% 69.43% ± 1.97%
2% 1.54% ± 0.25% 74.03% ± 1.99%
5% 0.50% ± 0.21% 70.06% ± 2.44%
10% 0.81% ± 0.18% 71.22% ± 2.41%

1.60%±0.17%
1.65%±0.18%
1.26%±0.20%
0.61%±0.11%

1.38±0.12
1.62±0.13
1.25±0.14
1.61±0.13

Momentum points of impact γ
1% 1.46% ± 0.28% 67.81% ± 2.01%
2% 1.43% ± 0.26% 70.09% ± 2.21%
5% 0.82% ± 0.15% 75.47% ± 2.20%
10% 0.23% ± 0.06% 77.59% ± 2.35%

1.65%±0.18%
1.57%±0.18%
0.65%±0.11%
0.23%±0.07%

1.26±0.13
1.57±0.13
1.63±0.13
1.44±0.09

γ

Mean Return

BAH mean return:1.44 ± 0.44%
BAH mean MDD:8.2 ± 0.41%
BAH mean ASR:1.01 ± 0.15%

Table B.12: Performance comparison between the SVR and ANN models for turning points
with impact and momentum characteristics. Whenever a result of one of the methods is
better at 5% level, according to Wilcoxon signed-rank test, we mark it with (*). Boldface
numbers mark results that exceed the corresponding BAH metric at 5% level.

45

This figure "diagram5-peakTrough.JPG" is available in "JPG" format from:
http://arxiv.org/ps/1209.0127v2

