HAL Id: inria-00338099
https://hal.inria.fr/inria-00338099v2
Submitted on 15 Nov 2008
HAL
is a multi-disciplinary open access archive for the deposit and dissemination of sci- entific research documents, whether they are pub- lished or not. The documents may come from teaching and research institutions in France or abroad, or from public or private research centers.
L’archive ouverte pluridisciplinaire
HAL, estdestinée au dépôt et à la diffusion de documents scientifiques de niveau recherche, publiés ou non, émanant des établissements d’enseignement et de recherche français ou étrangers, des laboratoires publics ou privés.
Time Series Technical Analysis via New Fast Estimation Methods: A Preliminary Study in Mathematical Finance
Michel Fliess, Cédric Join
To cite this version:
Michel Fliess, Cédric Join. Time Series Technical Analysis via New Fast Estimation Methods: A
Preliminary Study in Mathematical Finance. IAR-ACD08 (23rd IAR Workshop on Advanced Control
and Diagnosis), Nov 2008, Coventry, United Kingdom. �inria-00338099v2�
estimation methods: a preliminary study in
mathematial nane
Mihel FLIESS
∗,∗∗
Cédri JOIN
∗,∗∗∗
∗
INRIA-ALIEN
∗∗
LIX (CNRS,UMR7161), Éole polytehnique
91128 Palaiseau, Frane
Mihel.Fliesspolytehnique.edu
∗∗∗
CRAN (CNRS,UMR 7039),Nany-Université
BP239, 54506 Vand÷uvre-lès-Nany, Frane
Cedri.Joinran.uhp-nany.fr
Abstrat: Newfast estimation methods stemming from ontrol theory lead to afresh look at
time series, whih bears someresemblaneto tehnial analysis. The results are applied to
atypialobjet of nanial engineering, namely the foreast of foreignexhange rates,via a
model-free setting,i.e., viarepeatedidentiationsofloworderlineardiereneequationson
slidingshort time windows. Severalonviningomputersimulations,inludingthepredition
ofthe position and of thevolatilitywith respet tothe foreastedtrendline, areprovided. Z-
transformanddierentialalgebraarethemainmathematialtools.
Keywords: Timeseries,identiation,estimation, trends,noises,model-freeforeasting,
mathematialnane,tehnialanalysis,heterosedastiity,volatility,foreignexhangerates,
lineardiereneequations,Z-transform,algebra.
1. INTRODUCTION
1.1 Motivations
Reent advanes in estimation and identiation (see,
e.g.,(Fliess &Sira-Ramírez,2003;Fliess&Sira-Ramírez,
2004; Fliess, Join & Sira-Ramírez, 2004; Fliess & Sira-
Ramírez,2008;Fliess,Join&Sira-Ramírez,2008)andthe
referenes therein) stemming from mathematial ontrol
theorymaybesummarizedbythetwofollowingfats:
• Their algebrainature permits to derive exatnon-
asymptotiformulaeforobtainingtheunknownquan-
titiesin realtime.
• Thereisnoneedtoknowthestatistialpropertiesof
theorrupting noises.
Those tehniques have already been applied in many
onrete situations, inluding signal proessing (see the
referenes in (Fliess, 2008)). Their reent and suessful
extension to disrete-time linear ontrol systems (Fliess,
Fuhshumer, Shöberl, Shlaher & Sira-Ramírez, 2008)
haspromptedustostudytheirrelevanetonanialtime
series.
Remark 1.1. Therelationshipbetweentimeseriesanalysis
and ontrol theory is well doumented (see, e.g., (Box,
Jenkins & Reinsel, 1994; Gouriéroux & Monfort, 1995;
Hamilton, 1994) and the referenes therein). Our view-
point seemsneverthelesstobequitenewwhenompared
to theexisting literature.
Remark 1.2. The title of this ommuniation is due to
analysis, or harting (see, e.g., (Aronson, 2007; Béhu,
Bertrand&Nebenzahl,2008;Kaufman,2005;Kirkpatrik
& Dahlquist, 2006; Murphy, 1999) and the referenes
therein),whihiswidelyusedamongtradersandnanial
professionals.
1
1.2 Lineardiereneequations
Consider the univariate time series {x(t) | t ∈ N}: x(t)
is not regarded here as a stohasti proess like in the
familiar ARMA and ARIMA models but is supposed to
satisfyapproximatively alineardiereneequation
x(t+n)−a1x(t+n−1)− · · · −anx(t) = 0 (1)
where a1, . . . , an ∈ R. Introdue as in digital signal
proessingtheadditivedeomposition
x(t) =xtrendline(t) +ν(t) (2)
where
• xtrendline(t) is the trendline2 whih satises Eq. (1)
exatly;
• theadditivenoiseν(t)isthemismathbetweenthe
realdata andthetrendline.
Thus
x(t+n)−a1x(t+n−1)− · · · −anx(t) =ǫ(t) (3)
where
ǫ(t) =ν(t+n)−a1ν(t+n−1)− · · · −anν(t) (4)
1
Tehnial analysis is often severely ritiized in the aademi
worldandamongthepratitionersofmathematialnane(see,e.g.,
(Paulos,2003)).
2
Weonlyassumethat theergodimean ofν(t)is0,i.e.,
N→+∞lim
ν(0) +ν(1) +· · ·+ν(N)
N+ 1 = 0 (5)
Itmeansthat,∀t∈N, themovingaverage
MAν,N(t) = ν(t) +ν(t+ 1) +· · ·+ν(t+N)
N+ 1 (6)
is loseto 0 if N is largeenough.It follows from Eq. (4)
that ǫ(t)also satisestheproperties(5)and (6).Most of
thestohasti proesses,likenitelinearombinations of
i.i.d. zero-mean proesses, whih are assoiated to time
series modeling, do satisfy almost surely suh a weak
assumption.Ouranalysis
• doesnotmakeanydierenebetweennon-stationary andstationarytimeseries,
• does not need the often tedious and umbersome
trend and seasonalitydeomposition (our trendlines
inludetheseasonalities,iftheyexist).
1.3 Amodel-freesetting
Itshould belearthat
• aonretetimeseriesannotbewell approximated in generalbyasolutionofaparsimonious Eq.(1),
i.e., alineardiereneequationofloworder;
• the useof large order lineardierene equations, or
ofnonlinearones,mightleadtoaformidableompu-
tationalburden fortheir identiations withoutany
lear-utforeastingbenet.
We adopt therefore the quite promising viewpoint of
(Fliess &Join,2008)where theontrol of omplex sys-
temsisahievedwithouttryingaglobalidentiationbut
thanksto elementarymodels whih areonly validduring
ashorttime intervalandareontinuouslyupdated.
3
We
utilize here low order dierene equations.
4
Then the
windowsize for themovingaverage(6) doesnot needto
belarge.
1.4 Content
Set. 2, whih onsiders the identiability of unknown
parameters, extendsto the disrete-time ase aresult in
(Fliess, 2008). The onvining omputer simulations in
Set.3arebasedontheexhangeratesbetweenUSDollars
anduros.Besidesforeastingthetrendline,wepredit
• the position of the future rate w.r.t. the foreasted
trendline,
• thestandarddeviationw.r.t.theforeastedtrendline.
Thoseresultsmightleadtoanewunderstandingofvolatil-
ityandriskmanagement.
5
Set.4onludeswithashort
disussiononthenotionoftrend.
3
Seethe numerousexamplesandthe referenesin(Fliess&Join,
2008)foronreteillustrations.
4
Compare with (Markovsky, Willems, van Huel, de Moor &
Pintelon,2005).
5
See(Taleb,1997)foraritialappraisaloftheexistingliterature
onthissubjet,whihisofutmostimportaneinnanialengineer-
ing.(Extreme)risksaredisussedin(Bouhaud&Potters,1997;Da-
orogna,Gençay,Müller,Olsen&Pitet,2001;Mandelbrot&Hud-
son,2004;Sornette,2003)fromquitedierentperspetives.Itisthe
trendlinewhihwouldexhibitabrupthangesinoursetting(ompare
2. PARAMETERIDENTIFICATION
2.1 Rationalgenerating funtions
Consideragain Eq.(1). TheZ-transformX ofxsatises
(see,e.g.,(Doetsh,1967;Jury,1964))
zn[X−x(0)−x(1)z−1− · · · −x(n−1)z−(n−1)]
− · · · −an−1z[X−x(0)]−anX= 0 (7)
It showsthatX, whih is alled thegenerating funtion
ofx, isarationalfuntionofz,i.e., X∈R(z): X =P(z)
Q(z) (8)
where
P(z) =b0zn−1+b1zn−2+· · ·+bn−1∈R[z]
Q(z) =zn− · · · −an−1z−an∈R[z]
Hene
Proposition2.1. x(t), t ≥ 0, satises a linear dierene
equation(1)if,andonlyif,itsgeneratingfuntion X isa
rationalfuntion.
It is obvious that the knowledge of P and Q permits to
determinetheinitialonditionsx(0), . . . , x(n−1).
Remark2.2. Considertheinhomogeneouslineardierene
equation
x(t+n)−a1x(t+n−1)− · · · −anx(t)
= X
nite
̟(t)αt+ X
nite
̟′(t) sin(ωt+ϕ)
where ̟(t), ̟′(t) ∈ R[t], α, ω, ϕ ∈ R. Then the Z-
transformX ∈R(z) ofx(t)is againrational. It isequiv-
alentsayingthatx(t),t≥0, stillsatisesahomogeneous diereneequation.
2.2 Parameteridentiability
Generalities Let
K=Q(a1, . . . , an, b0, . . . , bn−1)
be the eld generated over the eld Q of rational num-
bers by a1, . . . , an, b0, . . . , bn−1, whih are onsidered as
unknownparametersandthereforeinouralgebraisetting
as independent indeterminates (Fliess & Sira-Ramírez,
2003; Fliess, Join & Sira-Ramírez, 2004; Fliess & Sira-
Ramírez, 2008). Write K¯ the algebrailosure of K (see, e.g.,(Lang,2002;Chambert-Loir,2005)).ThenX ∈K¯(z),
i.e., X is arational funtion over K¯. MoreoverK¯(z)is a
dierential eld (see, e.g., (Chambert-Loir, 2005)) with
respet to the derivation
d
dz. Its subeld of onstants is
thealgebraiallylosedeld K¯.
IntroduethesquareWronskianmatrixMoforder2n+ 1
(Chambert-Loir,2005)whereitsχth-row,0≤χ≤2n,is dχ
dzχznX, . . . , dχ dzχX, dχ
dzχzn−1, . . . , dχ
dzχ1 (9)
It followsfrom Eq. (7) that the rank of M is 2n if, and
only if, x does not satisfy a linear dierene relation of
orderstritlylessthann. Hene
referenes therein). Our estimation tehniques permit an eient
hange-pointdetetion (Mboup,Join &Fliess,2008),whih needs
Theorem2.3. If x does not satisfy a linear dierene
equationoforderstritlylessthann,thentheparameters a1, . . . , an, b0, . . . , bn−1
arelinearly identiable.
6
Identiability of the dynamis For identifying the dy-
namis, i.e., a1, . . . , an, without having to determine the
initialonditionsonsiderthe(n+ 1)×(n+ 1)Wronskian
matrixN,where itsµth-row,0≤µ≤n+ 1,is dn+µ
dzn+µznX, . . . , dn+µ dzn+µX
It is obtained by taking the X-dependent entries in the n+ 1lastrowsoftype(9),i.e., indisregardingtheentries dependingonb0, . . . , bn−1.TherankofN isagainn.Hene
Corollary 2.4. a1, . . . , an arelinearlyidentiable.
Identiability of the numerator Assume now that the
dynamis is known but not the numerator P in Eq. (8).
Weobtainb0, . . . , bn−1 fromtherstnrows(9).Hene
Corollary 2.5. b0, . . . , bn−1 arelinearlyidentiable.
2.3 Somehintson theomputerimplementation
We proeed as in (Fliess &Sira-Ramírez, 2003; Fliess &
Sira-Ramírez,2008)andin(Fliess,Fuhshumer,Shöberl,
Shlaher & Sira-Ramírez, 2008). The unknown linearly
identiable parameters are solutions of a matrix linear
equation, the oeients of whih depend on x. Let
us emphasize that we substitute to x its ltered value
thanks to a disrete-time version of (Mboup, Join &
Fliess,2009).
7
3. EXAMPLE:FORECASTING 5DAYS AHEADTHE
$-EXCHANGERATES
We are utilizing data from the European Central Bank,
depited by the blue lines in theFigures 1and 2, whih
summarizethe2400lastdailyexhangeratesbetweenthe
US Dollarsandtheuros.
8
3.1 Foreastingthe trendline
In order to foreast the exhange rate 5 days ahead we
applytherulesskethedinSet.2.3andweutilizealinear
diereneequation(1)oforder3(thelteredvaluesofthe
exhangeratesaregivenbytheblaklinesintheFigures1,
2). Fig.3providestheestimated valuesoftheoeients
of the dierene equation. The results on the foreasted
valuesoftheexhangeratesaredepitedbytheredlinesin
theFigures1and2,whihshouldbeviewedasapredited
trendline.
6
It means following the terminology of (Fliess & Sira-Ramírez,
2003; Fliess & Sira-Ramírez, 2008) that a1, . . . , an, b0, . . . , bn−1
are uniquely determined by a system of 2n linear equations, the
oeientsofwhihdependon
dχ
dzχX and dzdχχzm,0≤m≤n−1.
7
See,e.g.,(Gençay,Selçuk&Hafner,2002)foranexellentpresen-
tationofvariouslteringtehniquesineonomisandnane.
8
Theauthors areperfetly aware thatonlyomputationsdealing
withhighfrequenydata mightbeofpratialvalue.Thistypeof
resultswillbepresentedelsewhere.
0 500 1000 1500 2000 2500
0.8 0.9 1.0 1.1 1.2 1.3 1.4 1.5 1.6 1.7 1.8
Samples
Figure 1.Exhange rates(blue ),ltered signal(blak-
-),foreastedsignal(5 daysahead)(red)
0 500 1000 1500 2000 2500
−3
−2
−1 0 1 2 3
Samples
Figure 3. Parameter estimations a1 (red −.−), a2 (blue
−−)anda3(blak−−)(5 daysahead)
3.2 Above orunder the preditedtrendline?
Consideragaintheerror ν(t)in Eq. (2)andits moving
averageMAν,N(t)in Eq. (6). ForeastingMAν,N(t) asin
Set.3.1tellsusanexpetedposition withrespettothe
foreastedtrendline. The blue line of Fig. 4 displaysthe
resultfor the window size N = 100.The meaningof the
indiators△and∇is lear.
Table1omparesforvariouswindowsizesthesignsofthe
preditedvaluesofMAν,N(t),whih tellsusifoneshould
expet to beaboveorunder thetrendline, with the true
positionsofx(t)withrespettothetrendline.Theresults
areexpressedviaperentages.
3.3 Preditedvolatility w.r.t.the trendline
Introduethemoving standarddeviation
MSTDν,N(t) =
s PN
τ=0(ν(t+τ)−MAν,N(t−N+τ))2 N+ 1
1050 1100 1150 1200 1250 1300 1350 1400 1450 1.00
1.05 1.10 1.15 1.20 1.25 1.30 1.35
Samples
Figure2.ZoomofFigure1
0 500 1000 1500 2000 2500
−0.03
−0.02
−0.01 0.00 0.01 0.02 0.03
Samples
Figure 4. Predited position w.r.t. the trendline (5 days
ahead)∇:above,△:under
Window'ssize Perentage
50 65.6%
100 88.3%
200 62.3%
300 67.1%
Table 1. Comparison between the sign of the
preditedvalueofMAν,N(t)andthetrueposi-
tionofx(t)w.r.t.thetrendline(5daysahead).
and foreast it as in Set. 3.2. The results, whih are
displayedforawindowsize N = 100 in Table 2and Fig.
5viathefamiliarondeneintervals,
9
onrmthetime-
dependeneofthevariane,i.e.,theheterosedastiity.
9
There is of ourse no need for the underlying statistis to be
Condeneintervals Predition Real
mean-3×std,mean+3×std 99% 98.7%
mean-2×std,mean+2×std 95% 92.2%
mean-std,mean+std 68% 64.4%
Table2.Condeneintervalvalidations(5days
ahead)
0 500 1000 1500 2000 2500
−0.20
−0.15
−0.10
−0.05 0.00 0.05 0.10 0.15 0.20
Samples
Figure5.Condeneinterval(95%)(5daysahead)
3.4 Forasting10 days ahead
Figures 6, 7, 8, 9 display the same type of results as
in Setions 3.1, 3.2, 3.3 via similar omputations for a
foreasting 10 days ahead. The quality of the omputer
simulationsonlyslightlydeteriorates.
quantitieslikeskewnessand kurtosis,whihwouldbeobtained by
1050 1100 1150 1200 1250 1300 1350 1400 1450 1.00
1.05 1.10 1.15 1.20 1.25 1.30 1.35
Samples
Figure7.ZoomofFigure6
0 500 1000 1500 2000 2500
0.8 0.9 1.0 1.1 1.2 1.3 1.4 1.5 1.6 1.7 1.8
Samples
Figure 6.Exhange rates(blue ), lteredsignal(blak -
-),foreastedsignal(red) (10daysahead)
4. CONCLUSION
Theexisteneoftrends,whihis
• thekeyassumptionin tehnialanalysis,10
• quite foreign, to the best of our knowledge, to the
aademimathematialnane,wheretheparadigm
of random walks is prevalent (see, e.g., (Wilmott,
2006)),
10
Trendsintehnialanalysisshouldnotbeonfusedwithwhatare
alledtrendsinthetimeseriesliterature (see,e.g.,(Gouriéroux &
0 500 1000 1500 2000 2500
−0.03
−0.02
−0.01 0.00 0.01 0.02 0.03
Samples
Figure 8.Predited position w.r.t. thetrendline (10 days
ahead)∇:above,△: under
isfundamentalinourapproah.Atheoretialjustiation
willappearsoon(Fliess &Join,2009).
11
Wehopeitwill
leadto asoundfoundation oftehnialanalysis,
12
whih
will bring asa byprodut easily implementable real-time
omputerprograms.
13
11
Theexisteneoftrendsdoesnotneessarilyontraditarandom
harater(see(Fliess&Join,2009)fordetails).
12
Seealso(Daorogna,Gençay,Müller,Olsen&Pitet,2001)fora
mostexiting studywhihemployshighfrequenydata.Thereare
alsoothertypesofattemptstoputtehnialanalysisonarmbasis
(see,e.g.,(Lo,Mamaysky&Wang, 2000)).See(Blanhet-Salliet,
Diop, Gibson, Talay & Tanré, 2007) for a omparison between
tehnial analysis and model-based approahes with parametri
unertainties.
13
Ourtehnisalreadyleadtosuhomputerprogramsinautomati
0 500 1000 1500 2000 2500
−0.20
−0.15
−0.10
−0.05 0.00 0.05 0.10 0.15 0.20
Samples
Figure9.Condeneinterval(95%)(10daysahead)
Aknowledgement.TheauthorswishtothankG.Daval-Lelerq
(Soiété Générale - Corporate & Investment Banking) for helpful
disussionsandomments.
REFERENCES
Aronson D. (2007). Evidene-Based Tehnial Analysis.
Wiley.
Béhu T., Bertrand E., Nebenzahl J. (2008). L'analyse
tehnique(6
e
éd.).Eonomia.
Blanhet-SallietC.,DiopA.,GibsonR.,TalayD.,Tanré
E.(2007).Tehnialanalysisomparedtomathemat-
ial models based methods under parameters mis-
speiation.J. BankingFinane,31, 13511373.
BouhaudJ.-P.,PottersM.(1997).Théoriedesrisques-
naniers.Eyrolles.Englishtranslation(2000):Theory
ofFinanial Risks.CambridgeUniversityPress.
BoxG.E.P.,JenkinsG.M.,Reinsel,G.(1994).TimeSeries
Analysis: Foreastingand Control (3
rd
ed.). Prentie
Hall.
Chambert-Loir A. (2005). Algèbre orporelle. Édit. Éole
Polytehnique. English translation (2005): A Field
GuidetoAlgebra.Springer.
Daorogna M.M., Gençay R., Müller U., Olsen R.B.,
PitetO.V.(2001).AnIntrodutiontoHighFrequeny
Finane.Aademi Press.
Doetsh G. (1967). Funktionaltransformationen. In R.
Sauer,L.Szabó(Eds):MathematisheHilfsmitteldes
Ingenieurs,1.Teil,pp.232484.Springer.
DurlaufS.N.,PhilipsP.C.B.(1988).Trendsversusrandom
walksintimeseriesanalysis.Eonometria,56,1333
1354.
Fliess M. (2008). Critique du rapport signal à bruit en
ommuniationsnumériques.ARIMA,toappear.On-
linehttp://hal.inria.fr/inria- 003 1171 9/en /.
Fliess M., Fuhshumer S., Shöberl M., Shlaher K.,
Sira-RamírezH.(2008).Anintrodutiontoalgebrai
disrete-time linear parametri identiation with a
onrete appliation. J. europ. syst. automat., 42,
211232.
Fliess M., Join C. (2008). Commande sans modèle et
ommande à modèle restreint, e-STA, 5. Online
http://hal.inria.fr/inria -00 2881 07/e n/.
Fliess M., Join C. (2009). A mathematial proof of the
Fes,Maroo.Soononlinehttp://hal.inria.fr/INRIA.
FliessM.,JoinC.,Sira-RamírezH.(2004).Robustresidual
generation for linear fault diagnosis: an algebrai
settingwithexamples.Int.J.Control,77,12231242.
FliessM.,JoinC.,Sira-RamírezH. (2008).Non-lineares-
timationiseasy.Int.J.ModellingIdentiationCon-
trol,4,1227.
FliessM.,Sira-RamírezH.(2003).Analgebraiframework
forlinearidentiation.ESAIMControlOptimiz.Cal-
ulus Variat.,9,151168.
Fliess, M., Sira-Ramírez, H. (2004). Reonstruteurs
d'état. C.R.Aad.Si. ParisSer. I,338,9196.
FliessM.,Sira-RamírezH.(2008).Closed-loopparametri
identiation for ontinuous-time linear systems via
new algebrai tehniques. In H. Garnier, L. Wang
(Eds):Identiation ofContinuous-timeModels from
SampledData,pp.363391,Springer.
GençayR.,SelçukF.,WhitherB.(2002).AnIntrodution
to Wavelets and Other Filtering Methods in Finane
andEonomis.AademiPress.
Gouriéroux C., Monfort A. (1995). Séries temporelles
et modèles dynamiques (2
e
éd.). Eonomia. English
translation(1996):TimeSeriesandDynamiModels.
CambridgeUniversityPress.
Hamilton J.D. (1994). Time Series Analysis. Prineton
UniversityPress.
KaufmanP.J.(2005).New Trading Systemsand Methods
(4
th
ed.).Wiley.
Jury E.I. (1964). Theory and Appliation of the z-
Transform Method.Wiley.
Kirkpatrik C.D.,Dahlquist J.R.(2006). Tehnial Anal-
ysis: The Complete Resoure for Finanial Market
Tehniians.FTPress.
LangS. (2002).Algebra(3
rd
rev.ed.).Springer.
LoA.W., MamayskyH., Wang J. (2000).Foundationsof
tehnial analysis: omputational algorithms, statis-
tial inferene, and empirial implementation. J. Fi-
nane,55,1705-1765.
MandelbrotB.B.,HudsonR.L.(2004).The(Mis) Behav-
ior of Markets.BasiBooks.
Markovsky I., Willems J.C., van Huel S., de Moor B.,
Pintelon R. (2005). Appliation of strutured total
least squares for systemidentiation and model re-
dution. IEEE Trans. Automat. Control, 50, 1490-
1500.
Mboup M., Join C., Fliess M. (2008). A delay estima-
tion approah to hange-point detetion. Pro. 16
th
Medit. Conf. Control Automation, Ajaio. Online
http://hal.inria.fr/in ria- 0017 977 5/en /.
MboupM.,JoinC.,FliessM.(2009).Numerialdierenti-
ationwithannihilatorsinnoisyenvironment.Numer.
Algor.,DOI:10.1007/s11075-008-9236-1.
Murphy J.J. (1999). Tehnial Analysis of the Finanial
Markets(3
rd
rev.ed.).NewYorkInstituteofFinane.
Paulos J.A. (2003). A Mathematiian Plays the Stok
Market. BasiBooks.
Sornette D. (2003). Why Stok Markets Crash: Critial
EventsinComplexFinanialSystems.PrinetonUni-
versityPress.
TalebN.(1997).DynamiHedging.Wiley.
WilmottP.(2006).PaulWilmottonQuantitativeFinane
(2
nd
ed.,3volumes).Wiley.