Trader's DFA Marc Wildi - Statistician and Economist Kent Hoxsey - Programmer and Trader
-
Upload
nina-barlow -
Category
Documents
-
view
42 -
download
0
description
Transcript of Trader's DFA Marc Wildi - Statistician and Economist Kent Hoxsey - Programmer and Trader
Trader's DFA
Marc Wildi - Statistician and EconomistKent Hoxsey - Programmer and Trader
A Practioner's Introductionto the Direct Filter Approach
SignalX Noisy Data:
Financial (stocks), macro (GDP)
Filter: a set of weights such that
is `free of noise'
is Signal the
For example a Trend (Mom
entum)
t
k
t k t kk
t
Y X
Y
Real-Time Signalextraction
1
1 2
0
future
Idealized Trend:
Y `senses' the (X ,X ,...)
vs.
Real-Time Finite Sample Estima
ˆ ˆ
te
T k T k T Tk
T
kT k T k
X
Y X
Real-Time Perspective
• Turning-points (trades) are delayedo Performances affected
• Delay could be decreased by selecting shorter filterso Generate more `false’ alarmso Performances affected
• Tradeoff: speed/timeliness vs. smoothness/reliability
Real-Time SignalextractionFrequency Domain
1
0
1
0
Idealized Target: Y
ˆ ˆReal-Time Estimate:
Transferfunctions
( ):= exp( ) ( if symmetric)
ˆ ˆ( ):= exp( )
T k T kk
T k T k
kk
T
k
T
kk
X
Y X
ik
ik
Optimization Criterion: Mean-Square
2ˆFILTERWEIGHTS
2
ˆ
ˆFilter error:
Criterion: E[ ] min
Frequency Domain
ˆˆ( ) ( ) S( ) min
k
t t t
t
k k kk
r Y Y
r
Objectives
1.Real-time filters which are `fast’o Detect turning-points timely
2.Real-time filters which are `reliable’o Impose strong noise suppression
2
2
ˆ
ˆIdea: decompose Γ( )-Γ( ) in MS-Criterion
ˆˆ( ) ( ) S( ) min
k k
k k kk
Cosine Law applied to
ˆ ( )
ˆ( ) ( )
ˆ ( )
( )
2
2
ˆ( ) ( )
ˆ ˆ ˆ( ) ( ) 2 ( ) ( ) 1 cos( ( ))
2ˆ( ) ( )
Decomposition of Mean-Square Criterion
/2 2
01
/2 2
1
/2
1
ˆˆ( ) ( ) ( )
ˆ ˆA( ) A( ) ( )
ˆ ˆˆ2A( )A( ) 1 cos( ( )) ( )
Mean-Squ
(
are: 0
Faster Filter : >0
Slower Filter:
1
<0
)
T
k k kk
T
k k kk
T
k k k kk
S
S
S
Timeliness and Noise Suppression
/2 2
1
/2
1
expweight
expweight
expw
ˆ ˆA( ) A( ) ( ) ( , )
ˆ ˆˆ2A( )A( ) 1 cos( ( )) ( ) ( , )
1 , if ( in passband)( , )
|1+ | > ( in st
cutoff
cuto opbff cutoff
eight
e
(1
xpweia
ghnd)
)
t
T
k k k kk
T
k k k k kk
k k
k
k k k
S W
S W
W
Three Hyperparameters: , ,
Timelines
expw
, s
cutoff
Si
eight
Reliabilit gnaly,
Control: Interfacing with the Criterion
Mean-Square: 0
CUSTOMIZATION:
Smaller delay : >0
Stronger noise suppression: 0
Both...
: signal
Next : Kent s
expwe
work
ight
on t
expw
hese
Cu
eigh
h
toff
yper
t
parameters
Latest Developments (2011,2012)
• Fast closed-form solutionso I-MDFA
• Generic Approacho Replicate model-based approaches, HP-designs, CF-
designs (see http://blog.zhaw.ch/idp/sefblog)o Customize traditional mean-square approaches
• Alleviate/control overfittingo Regularizationo Rmetrics-2012
Background
• SEFBlog:o http://blog.zhaw.ch/idp/sefblogo Articles, books, applications, R-code, tutorials
• Recent Articles:o Wildi/McElroy (2012)
http://blog.zhaw.ch/idp/sefblog/index.php?/archives/263-On-a-Trilemma-Between-Accuracy,-Timeliness-and-Smoothness-in-Real-Time-Forecasting-and-Signal-Extraction.html
o Wildi (2012) http://blog.zhaw.ch/idp/sefblog/index.php?/
archives/262-Up-Dated-I-MDFA-Code-and-Working-Paper.html
Background
• R-Code/tutorialso Check the categories `I-MDFA code repository’ or
`tutorial’ on SEFBlog
• Macro-indicators o http://www.idp.zhaw.ch/usrio http://www.idp.zhaw.ch/euri
• Tradingo http://www.idp.zhaw.ch/MDFA-XTo http://blog.zhaw.ch/idp/sefblog/index.php?/
archives/157-A-Generalization-of-the-GARCH-in-Mean-Model-Vola-in-I-MDFA-filter.html
A Hybrid Approach
• iMetricao Access to State Space, ARIMA, I-MDFA, Stochastic
Volatility, Hybrido Chris Blakely: www.cd-blakely.com
Vola in I-MDFA
Described in a blog post, and then in more detail later in a conference presentation.
http://blog.zhaw.ch/idp/sefblog/index.php?/archives/157-A-Generalization-of-the-GARCH-in-Mean-Model-Vola-in-I-MDFA-filter.html
Exercise: Reproduce the Example
Code available on SEF-Blog at:
http://blog.zhaw.ch/idp/sefblog/uploads/Vola_in_I-MDFA_prototype1.r
Runs as-is, but you need a "trading" function
Zero-crossing function:start with your filter weights and data series
create a vector of NAs as long as your index to be your signal
set signal to 1 where filtered data > 0
set signal to 0 where filtered data < 0
fill your NAs - na.locf() is your best friend
Not sophisticated, but tricky: watch your lagsVeddy importante: signal *today* means returns *tomorrow*
Corollary: Understand the Behavior
Reference code runs a multi-stage loopcalculates filters for combinations of params
runs an optimizer over the param space
Effective, but not illuminating for meparameter changes not intuitive (for me)
needed a feel for sensitivity
And I just happen to have a lot of machines...easy code changes: expand.grid and foreach
lots of cpu time
eventually, lots of results