High Frequency Trading Using Regime Switching Strategy Huynh Gia Huy G1000176L Le Hoang Thai G1000293G Reference Developing HighFrequency Equities Trading Models Leandro Rafael ID: 384554
Download Presentation The PPT/PDF document "FE8827 Quantitative Trading Strategies p..." is the property of its rightful owner. Permission is granted to download and print the materials on this web site for personal, non-commercial use only, and to display it on your personal computer provided you do not modify the materials and that you retain all copyright notices contained in the materials. By downloading content from our website, you accept the terms of this agreement.
Slide1
FE8827 Quantitative Trading Strategies projectHigh Frequency Trading Using Regime Switching Strategy
Huynh
Gia
Huy
(G1000176L)
Le Hoang Thai (G1000293G)Slide2
Reference“Developing High-Frequency Equities Trading Models”, Leandro Rafael Infantino, Savion
Itzhaki
, MBA thesis, MIT, June 2010.Slide3
ContentsSimply GuideModel Building: motivation, trading ideas, potential problems and implementation.Simulation Results: without/with transaction costs, development from the thesis.
Weaknesses of Trading Signals in the Thesis and Proposed Improvement: mean reverting signals and regime switching signals.Slide4
Simple GuideTo display performance statistics, run rsperf.m file: rsperf(index,
rf
,
lossthreshold
)
Input:
index
= 1: regime switching with transaction
costs.
index
= 2: regime switching without transaction costs
.
index
= 3: mean reverting with transaction costs.
index
= 4: mean reverting without transaction
costs.
rf
: risk free rate
lossthreshold
: omega loss
threshold
Ouput
: Omega ratio, Sharpe ratio, Omega Sharpe ratio,
MaxDD
(max drawdown) and
MaxDDD
(max drawdown duration).Slide5
Simple GuideTo start trading strategies, run regswitch.m file.
In this file, turn
on/off regime
switching by setting
regimeSwitching
variable to 1 to turn on and 0 to turn off.
regimeSwitching
= 1; % default
value
Change line 32 in this file to run simulation for a period of time. Default is whole year running from week 1 to week 52.
for
week=1:
52Slide6
Model building - MotivationIn high frequency environment, high precision of the stock return prediction is not required.Fundamental Law of Active Management
IR: Information Ratio
IC:
Information Coefficient (our skill)
Breadth: “the number of independent forecasts of exceptional return made per year”
Breadth very big => IC can be relatively small
=> prediction can be less preciseSlide7
Model building - Trading ideasUse Principle Component Analysis (PCA) as the basis to compute cumulative returnsDepending on the current strategy (mean-reversion or momentum), trading signals are generated if observed cumulative returns differ from model cumulative returns.
Predicted – observed > threshold => buy (sell)
Predicted – observed < -threshold => sell (buy)Slide8
Differences between this project and the paperNumber of stocks used in the simulation: only first 10 stocks (instead of 50) are chosen to represent the stock universe.Data source: the primary data used in this project is obtained from Thomson Reuters Tick History database, and from two major exchanges: NASDAQ and NYSE; whereas prices used in the thesis are from top of the book bid-ask quotes.
Model parameters: various model parameters are not specified in the thesis, thus simulation results can be affected by the choice of different parameter values.
Transaction costs are included.
Signal in the thesis is found insufficient and has been modified to improve stabilty and performance of returns.Slide9
Model building - Potential problems - data volumeHuge volume of data: more than 15Gbs of one year tick data to process (and that’s only for 10 stocks).Simulation time can be very long because of this.
Code optimization is important!Slide10
ImplementationMatlab is chosen as it provides many built-in mathematics functions suitable for rapid model development.Pre-process data before running simulation:Only one mid-price per second per stock
Need to duplicate values for missing seconds in raw data.
Processed data saved in separate .
csv
files.
Run simulation based on processed data.
All daily returns are saved in .
csv
files.Slide11
Some code optimization techniquesAlways pre-allocate memory for matrix and avoid changing matrix size constantly.Avoid loop as much as possible and make use of Vectorization
(performance increased dramatically!)
Use
Matlab
profiler to identify areas for improvement.
Normal for loop
Vectorization
i
= 0;
for t = 0:.01:10
i
=
i
+ 1;
y(
i
) = sin(t);
end
t = 0:.01:10;
y = sin(t);Slide12
Simulation results - thesisMean-reversion strategy, without transaction cost.Slide13
Simulation results – this projectMean-reversion strategy, without transaction cost.Slide14
Simulation results – this projectMean-reversion strategy, without transaction cost.Omega: 2.6741 (Loss threshold: 0)Sharpe: 0.3507
Omega Sharpe: 0.0022
Max Drawdown: 0.1566
Max Drawdown duration: 73 days.Slide15
Simulation results - thesisRegime switching strategy, without transaction cost.Slide16
Simulation results – this projectRegime switching strategy, without transaction cost.Slide17
Simulation results – this projectRegime switching strategy, without transaction cost.Omega: 0.7381 (Loss threshold: 0)
Sharpe
: -0.0903
Omega Sharpe
: -0.0014
Max Drawdown
: 0.5569
Max Drawdown duration
:
226 days.Slide18
CommentsThe different simulation results between this project and thesis can be due to:Different stock universeDifferent data source (therefore different mid-prices)
Parameters used (thresholds).
In the thesis, transaction cost is not taken into account and it is a important factor to consider in high frequency trading model.
All profits can be erased by transaction cost.
Next step for this project: include transaction cost!
To be realistic, transaction cost from Interactive Brokers is used; that is, $0.005 / share / tradeSlide19
Transaction costs: Modifications to existing strategyIn an attempt to factor in the transaction cost, the trading model is modified. Two potential places:Mark-up the threshold by the transaction cost, i.e.
new threshold = threshold + transaction cost
Lower the log returns. Use this new log returns as input for Principal Components Analysis
log_return
= log[(
current_price
- cost) /
previous_price
+ cost)]
This project uses the second approach.Slide20
Simulation result – modified modelMean-reversion strategy, with transaction cost.Slide21
Simulation results – this projectMean-reversion strategy, with transaction cost.Omega: 1.0131 (
Loss threshold: 0
)
Sharpe
:
0.0192
Omega Sharpe
:
0.0002315
Max Drawdown
: 0.2373
Max Drawdown duration: 68 days.Slide22
Simulation result – modified modelModified regime switching strategy, with transaction cost.Slide23
Simulation results – this projectMean-reversion strategy, with transaction cost.Omega: 0.7805 (
Loss threshold: 0
)
Sharpe
: -0.0708
Omega Sharpe
: -0.0010
Max
Drawdown
: 0.4941
Max Drawdown duration
: 248 days.Slide24
Weaknesses of the trading signals in the thesis – Proposed ImprovementsMean reverting signal: In the thesis, if mean reverting signal > 0, we buy and sell when signal < 0. It includes noise due to rounding or computational issues.
Solution: set a threshold to filter away noise that creates fault trades.
This threshold after trial and error has been determined to be 0.0001 (parameter 1)Slide25
Weaknesses of the trading signals in the thesis - Proposed ImprovementsRegime Switching Signals:The authors use difference in two consecutive Euclidean distance to signal the regime switching:If E
H
(t) - E
H
(t-1) > 0: momentum regime
If E
H
(t) - E
H
(t-1) < = 0: mean reverting regime
This signals introduce noise and cause fault signals and consequently fault trades.Slide26
Weaknesses of the trading signals in the thesis - Proposed ImprovementsRegime Switching Signals – Noise
Diagram of Euclidean distance difference (
E
H
(t) - E
H
(t-1
)) is shown above.
According to the authors, the strategy keeps changing the regimes as signals swing around 0 from positive to negative. Slide27
Weaknesses of the trading signals in the thesis - Proposed ImprovementsRegime Switching Signals – Fault Signals
Diagram of Euclidean distance difference (
E
H
(t) - E
H
(t-1
)) is shown above and
Euclidean
distance
(
E
H(t)) below.One strong pulse in E distance creates one regime switching signal but it contains one up pulse and one down pulse in E distance difference. According to the authors,
it creates two signals that causes the system to switch back and forth (mean reverting -> momentum -> mean reverting) within <150 seconds. Slide28
Weaknesses of the trading signals in the thesis - Proposed ImprovementsRegime Switching Signals – Noise – Solution
We set a threshold of 2 standard deviation to filter out noise (parameter 2). Magnitude falls between ± 2
std
dev
is considered insignificant.
Instead of using differences of 2 consecutive E distance (
E
H
(t) - E
H
(t-1)), we use EH
(t) – ewma5(EH(t)) where ewma5(EH(t))
is equally weighted moving averages value of previous 5 seconds of E distance (parameter 3).Ignore 2 consecutive regime switching signals fall into a timespan of less than 250 seconds to remove fault signals (parameter 4).Slide29
ConclusionsSimulation returns are very sensitive to parameters used.All 4 parameters can be improved by employing optimization.Due to the time constraint, we leave this part for future development.