Presentation is loading. Please wait.

Presentation is loading. Please wait.

Introduction to Algorithmic Trading Strategies Lecture 2 Hidden Markov Trading Model Haksun Li

Similar presentations


Presentation on theme: "Introduction to Algorithmic Trading Strategies Lecture 2 Hidden Markov Trading Model Haksun Li"— Presentation transcript:

1 Introduction to Algorithmic Trading Strategies Lecture 2 Hidden Markov Trading Model Haksun Li haksun.li@numericalmethod.com www.numericalmethod.com

2 Outline  Carry trade  Momentum  Valuation  CAPM  Markov chain  Hidden Markov model 2

3 References  Algorithmic Trading: Hidden Markov Models on Foreign Exchange Data. Patrik Idvall, Conny Jonsson. University essay from Linköpings universitet/Matematiska institutionen; Linköpings universitet/Matematiska institutionen. 2008.  A tutorial on hidden Markov models and selected applications in speech recognition. Rabiner, L.R. Proceedings of the IEEE, vol 77 Issue 2, Feb 1989. 3

4 FX Market  FX is the largest and most liquid of all financial markets – multiple trillions a day.  FX is an OTC market, no central exchanges.  The major players are:  Central banks  Investment and commercial banks  Non-bank financial institutions  Commercial companies  Retails 4

5 Electronic Markets  Reuters  EBS (Electronic Broking Service)  Currenex  FXCM  FXall  Hotspot  Lava FX 5

6 Fees  Brokerage  Transaction, e.g., bid-ask 6

7 Basic Strategies  Carry trade  Momentum  Valuation 7

8 Carry Trade  Capture the difference between the rates of two currencies.  Borrow a currency with low interest rate.  Buy another currency with higher interest rate.  Take leverage, e.g., 10:1.  Risk: FX exchange rate goes against the trade.  Popular trades: JPY vs. USD, USD vs. AUD  Worked until 2008. 8

9 Momentum  FX tends to trend.  Long when it goes up.  Short when it goes down.  Irrational traders  Slow digestion of information among disparate participants 9

10 Purchasing Power Parity  McDonald’s hamburger as a currency.  The price of a burger in the USA = the price of a burger in Europe  E.g., USD1.25/burger = EUR1/burger  EURUSD = 1.25 10

11 FX Index  Deutsche Bank Currency Return (DBCR) Index  A combination of  Carry trade  Momentum  Valuation 11

12 CAPM 12

13 Alpha 13

14 Bayes Theorem 14

15 Markov Chain s2: MEAN- REVERTIN G s1: UP s3: DOWN a22 = 0.2 a11 = 0.4a33 = 0.5 a12 = 0.2 a21 = 0.3 a23 = 0.5 a32 = 0.25 a13 = 0.4 a31 = 0.25 15

16 Example: State Probability 16

17 Markov Property 17

18 Hidden Markov Chain 18

19 Markov Chain s2: MEAN- REVERTIN G s1: UP s3: DOWN a22 = ? a11 = ?a33 = ? a12 = ? a21 = ? a23 = ? a32 = ? a13 = ? a31 = ? 19

20 Problems 20

21 Likelihood Solutions 21

22 Likelihood By Enumeration 22

23 Forward Procedure 23

24 Backward Procedure 24

25 Decoding Solutions 25

26 Decoding Solutions 26

27 Maximizing The Expected Number Of States 27

28 Viterbi Algorithm 28

29 Viterbi Algorithm 29

30 Learning Solutions 30

31 As A Maximization Problem 31

32 Baum-Welch 32

33 Xi 33

34 Estimation Equation 34

35 Estimation Procedure 35

36 Conditional Probabilities  Our formulation so far assumes discrete conditional probabilities.  The formulations that take other probability density functions are similar.  But the computations are more complicated, and the solutions may not even be analytical, e.g., t-distribution. 36

37 Heavy Tail Distributions  t-distribution  Gaussian Mixture Model  a weighted sum of Normal distributions 37

38 Trading Ideas  Compute the next state.  Compute the expected return.  Long (short) when expected return > (<) 0.  Long (short) when expected return > (<) c.  c = the transaction costs  Any other ideas? 38

39 Experiment Setup  EURUSD daily prices from 2003 to 2006.  6 unknown factors.  Λ is estimated on a rolling basis.  Evaluations:  Hypothesis testing  Sharpe ratio  VaR  Max drawdown  alpha 39

40 Best Discrete Case 40

41 Best Continuous Case 41

42 Results  More data (the 6 factors) do not always help (esp. for the discrete case).  Parameters unstable. 42

43 TODOs  How can we improve the HMM model(s)? Ideas? 43


Download ppt "Introduction to Algorithmic Trading Strategies Lecture 2 Hidden Markov Trading Model Haksun Li"

Similar presentations


Ads by Google