quantitative trading strategy based on time series technical analysis
Post on 23-Feb-2016
143 Views
Preview:
DESCRIPTION
TRANSCRIPT
Quantitative Trading Strategy based on
Time Series Technical Analysis
Group Member: Zhao Xia Jun
Lorraine Wang Lu Xiao
Zhang Le Yu
What’s new from the paper
Michel Fliess. Cédric Join Time Series Technical Analysis via New FastEstimation Methods: A Preliminary Study inMathematical Finance.(2008, Coventry, United Kingdom.)
What’s new from the paper
New fast estimation methods are applied to “Model-free” setting
Via repeated identifications of low order linear difference equations on sliding short time windows
Applying signal processing technique on finance
What’s new from our project
As the paper did not discuss any trading strategy, we come up with all the strategies by ourselves based on the techniques from the paper.
Tools and Packages Matlab 2010 Signal Processing Toolbox
This toolbox is included in Matlab starting from version 2010
Data
Data: EUR/USD & GBP/USD & AUD/JPY Exchange Rates
Source:: eSignal software Frequency: One Hour Interval In-Sample: Major analysis are done with data
from 2009 quarter 4 to 2010 quarter 1. Out-of-Sample: The strategies are back tested
on the following 1 year data, i.e. 2010 quarter 2 to 2011 quarter 1.
Inputs, outputs and measurement Trading decisions are made at the end of each
hour. Decision related inputs are only close price of
that hour (as well as past prices). The most important measurement of
performance is the cumulative value of 1 dollar after 1 year.
Sharpe Ratio, maximum drawdown, and percentage correct are also output.
Assume no leverage, no transaction cost, and the deposit for a short position is its price.
Briefly about our work Although the paper applies signal processing
techniques on finance, it provides no trading strategies.
We aim to focus on these new techniques and develop strategies that may work under indicators from the new techniques.
We may use all the techniques, or part of, mentioned in the paper, in our strategies.
Strategies
Use filtering technique only (1 strategy) Use filtering and z-transform (2 strategies) Use moving average on error terms (1
strategy)
Strategy 1: Filtered Price Indicator
Blue line: market prices Green line: filtered prices Strategy 1 is to base trading decisions on the
difference between blue and green lines at each period.
1740 1760 1780 1800 1820 1840 1860 1880 1900
1.43
1.435
1.44
1.445
1.45
1.455
1.46
1.465
1.47
1.475
Strategy 1: Filtered Price Indicator
We should use information up to each period. As the filtered price would be different if we provide it with future prices. (see period 1874)
1850 1860 1870 1880 1890 1900 1910 1920
1.425
1.43
1.435
1.44
1.445
1850 1855 1860 1865 1870 1875
1.425
1.43
1.435
1.44
1.445
Strategy 1: Filtered Price Indicator
The author of the paper believes the average of the difference (errors) between filtered prices and market prices approaches to zero. So a large departure of market price and filtered price is unlikely.
A simple strategy: Buy if filtered price (of this period) is much higher
than close price (of this period); Sell if filtered price (of this period) is much lower
than close price (of this period). Refer to “qt_Strategy_FilteredPriceIndicator.m”
Strategy 1: Filtered Price Indicator Result:
0 1000 2000 3000 4000 5000 6000 70000.9
1
1.1
1.2
1.3Strategy: Filtered Price. Security No:1
Strategy 1: Filtered Price Indicator
0 1000 2000 3000 4000 5000 6000 70000.8
0.9
1
1.1
1.2Strategy: Filtered Price. Security No:2
Strategy 1: Filtered Price Indicator
0 1000 2000 3000 4000 5000 6000 70000.9
1
1.1
1.2
1.3Strategy: Filtered Price. Security No:3
Strategy 2: Simple Prediction The paper uses z-transform and non-linear system
to get coefficients of the equation on filtered prices:
When applying these coefficients on the market prices, we can get predictions of future prices.
Refer to: “qt_GetSinglePrediction.m”
Strategy 2: Simple Prediction
Blue line: Market Prices; Green line: Filtered Prices Red line: Forecasted one-period-after price
350 400 450 500
1.455
1.46
1.465
1.47
1.475
1.48
Strategy 2: Simple Prediction Buy when current price is lower than predicted future price
Volume depends on the prediction length (i.e. number of prediction made) E.g. volume=1 when prediction length=1, i.e. predict only for
next time bar E.g. volume=2 when prediction length=2 and both predicted
prices for next 2 time bars are above current price Sell when current price is higher than predicted future
price Close the open position when the prediction shows a
change of price direction Refer to: “qt_Strategy_SimplePrediction.m”
Strategy 2: Simple Prediction Result
0 1000 2000 3000 4000 5000 6000 70000.85
0.9
0.95
1
1.05Strategy: Prediction. Security No:1
Strategy 2: Simple Prediction
0 1000 2000 3000 4000 5000 6000 70000.9
1
1.1
1.2
1.3Strategy: Prediction. Security No:2
Strategy 2: Simple Prediction
0 1000 2000 3000 4000 5000 6000 70000.9
1
1.1
1.2Strategy: Prediction. Security No:3
Strategy 3: Simple Mean Reverting The difference between market price and filtered
price is believed to be around zero. So we can play mean reversion on the spread of filtered price and market price.
However, this spread is not tradable. We develop our strategy in this way:
If the spread is too large, consider it an opportunity first; Examine whether the change in filtered price would likely
offset the significance of the spread; If not so, enter into new position; We can achieve it with prediction coefficients (same as we
used in strategy 2).
Strategy 3: Simple Mean Reverting
There will be at most 4 threshold in this strategy. Running optimization for these threshold is extremely time-consuming.
We did only for EUR/USD pair and apply the same thresholds on the other two pairs
Refer to “qt_Strategy_SimpleMeanReverting.m”
Strategy 3: Simple Mean Reverting Result:
0 1000 2000 3000 4000 5000 6000 70000.9
1
1.1
1.2Strategy: Mean Reversion. Security No:1
Strategy 3: Simple Mean Reverting
0 1000 2000 3000 4000 5000 6000 70000.8
1
1.2
1.4Strategy: Mean Reversion. Security No:2
Strategy 3: Simple Mean Reverting
0 1000 2000 3000 4000 5000 6000 70000.9
0.95
1
1.05
1.1Strategy: Mean Reversion. Security No:3
Strategy 4: Moving Average
Moving averaging is the main beautiful result of the paper;
It is suggested by the author of the paper that moving average of errors goes to zero in time: MAν,N(t) = νሺtሻ+ νሺt+1ሻ+⋯+ν(t+N)N+ 1
lim ¿n→∞MA=0¿
Strategy 4: Moving Average
In the paper, on daily USD/EUR series, with window size of 100, this model can achieve >80% accuracy in trend prediction.
Strategyby moving average However, in our work, moving average doesn't go
to zero always.
moving average of error terms under different window sizes at 20091201
0 200 400 600 800 1000 1200-2
-1.5
-1
-0.5
0
0.5
1
1.5
2
2.5
3x 10
-4 MvAvg - EUR/USD
Window Size
Mov
ing
Ave
rage
Strategy 4: Moving Average
Strategyby moving average
At the same time, the prediction power of moving average seems to be "only better than bet" in our half-year sample
Strategy 4: Moving Average
Strategyby moving average
Forecast Accuracy – if moving average can predict future price (based on AUD/JPY data from 2009Q4 to 2010Q1)
2 4 8 12 20 50 300 100048.5%
49.0%
49.5%
50.0%
50.5%
51.0%
51.5%
52.0%
52.5%
53.0%
53.5%
1-day prediction3-day prediction5-day prediction
Window Size
Accu
racy
Strategy 4: Moving Average
Strategyby moving average
Forecast Accuracy – if moving average can predict future filtered price (based on AUD/JPY data from 2009Q4 to 2010Q1)
2 4 8 12 20 50 300 100046.0%47.0%48.0%49.0%50.0%51.0%52.0%53.0%54.0%55.0%56.0%57.0%58.0%59.0%60.0%
1-day prediction3-day prediction5-day prediction
Window Size
Accu
racy
Strategy 4: Moving Average
Strategy 4: Moving Average Even the result of the paper can be remade
here, it only captures the difference of price and trend. This spread is not tradable. (even the spread narrows as expected, the direction of market price may vary.
1850 1855 1860 1865 1870 1875
1.425
1.43
1.435
1.44
1.445
1850 1855 1860 1865 1870 1875
1.425
1.43
1.435
1.44
1.445
Strategy 4: Moving Average We develop a similar strategy Simple moving average equally considers new
information and n-period past information. The entry of new price and the leave of past information cause same important pulse in moving average.
To avoid complex weighted average, we choose to use two moving average indicators, so that recent information become more important and the leave of one single past price will not affect the indicator too much.
Strategy 4: Moving Average Buy if both two moving average are below
zero Sell if both two moving average are above
zero Refer to “qt_Strategy_MvAvg.m”
Strategy 4: Moving Average
1 year account value EUR/USD (2010Q2 to 2011Q1) window1 = 4; window2 = 8
Result
0 1000 2000 3000 4000 5000 6000 70000.8
1
1.2
1.4
1.6Strategy: Moving Average. Security No:1
Strategy 4: Moving Average
1 year account value AUD/JPY (2010Q2 to 2011Q1) window1 = 4; window2 = 8
0 1000 2000 3000 4000 5000 6000 70000.8
1
1.2
1.4
1.6Strategy: Moving Average. Security No:2
Strategy 4: Moving Average
1 year account value GBP/USD (2010Q2 to 2011Q1) window1 = 4; window2 = 8
0 1000 2000 3000 4000 5000 6000 70000.9
1
1.1
1.2Strategy: Moving Average. Security No:3
Strategy 4: Moving Average – Optimized Parameters Next consider there exists an optimal position
to every moving average value. Inspired by the result of mean-reverting
example in class, we assume the optimal position is MV1 and MV2 stand for two value of moving
average Visit this expression only if both moving average
are negative (positive) The optimal position is positive related to the size
of moving average, but if it’s too large, the position would also decrease
Strategy 4: Moving Average – Optimized Parameters Fix a=1 in above expression. We run
optimization for four parameters: window size of MV1, window size of MV2, order multiplier in FIR, and b in last expression.
Optimization run on 2009Q4 to 2010Q1 data; Performance result plot for 2010Q2 to
2011Q1. Due to great amount of computation needed,
we run for EUR/USD only at this moment.
Strategy 4: Moving Average – Optimized Parameters
1 year account value EUR/USD (2010Q2 to 2011Q1) window1=4; window2 =40; p=0.75; b=8
0 1000 2000 3000 4000 5000 6000 70000.5
1
1.5
2Strategy: Moving Average with Optimized Parameters. Security No:1
Strategy 4: Moving Average – Optimized Parameters
1 year account value AUD/JPY (2010Q2 to 2011Q1) window1=4; window2 =40; p=0.75; b=8
0 1000 2000 3000 4000 5000 6000 70000.5
1
1.5
2
2.5Strategy: Moving Average with Optimized Parameters. Security No:2
Strategy 4: Moving Average – Optimized Parameters
1 year account value GBP/USD (2010Q2 to 2011Q1) window1=4; window2 =40; p=0.75; b=8
0 1000 2000 3000 4000 5000 6000 70000.5
1
1.5
2Strategy: Moving Average with Optimized Parameters. Security No:3
Summary Mathematics
In this project, we successfully replicated all the mathematical terms described in the paper, including filtered price, z transformation and moving average errors.
Achievement We developed 4 strategies by applying the mathematical
terms as trading indicators. Impressive return was achieved especially with Strategy 4:
moving average of the error terms Further work
Leverage, commission and slippage can be included in the trading model
Optimization can be applied on many trading parameters
top related