L/O/G/O
e Zhao
nnum ureshi
Jingwei an
Rachel Yue iu
YAHQQ
Strategy
Today’s agenda
• Introduction
• Stock picking
• Yahqq strategy process
• Testing result
• Risk analysis
• Conclusion
Hedge ratio and correlation
Pairs Trading defined
• a market neutral trading strategy enabling traders to profit from virtually any market conditions: uptrend, downtrend, or sideways movement.
• one stock moves up while the other moves down, the pairs trade would be to short the outperforming stock and to long the underperforming one, betting that the "spread" between the two would eventually converge
Moving Average(MA)
• An indicator frequently used in technical analysis showing the average value of a security's price over a set period.
• emphasize the direction of a trend and to smooth out price and volume fluctuations
• upward momentum is confirmed when a short-term average crosses above a longer-term average. Downward momentum is confirmed when a short-term average crosses below a long-term average
YAHQQ Strategy
• Pairs trading based on MA technique
• Spread converge signal: BUY spread
• Spread diverge signal: SELL spread
Spread<-stk1-hr*stk2
BUY spread: buy stk1, sell stk2
SELL spread: sell stk1, buy stk2
YAHQQ Strategy Process
7 pairs stocks
Compare each
spread with its
MA
Converge: BUY
spread
Diverge: SELL
spread
Continue process
Decide the trading signal
Decide trading quantity
Put into P nL function
Comparing each spread with its
MAs
• Converge signal
• boolB5[i, j]<-matrix(maN5[i-
2,j]<spreadN5[[j]][[i-2]] & maN5[i-
1,j]>spreadN5[[j]][[i-1]])
• Diverge Signal
• boolS5[i, j]<-matrix(maN5[i-
2,j]>spreadN5[[j]][[i-2]] & maN5[i-
1,j]<spreadN5[[j]][[i-1]])
Buy/Sell/Hold decision matrix
if(boolB5[i,j]){pos5[i,j]<-1}
else if (boolS5[i,j]){pos5[i,j]<--1}
else{pos5[i,j]<-0}
GS vs. JPM
HD vs. LOW
DRI vs. CAKE
T vs. VZ
KO vs. PEP
JNJ vs.PG
CMI vs. CAT
Quantity function
• mph1<-mean(head(stks1,30))
• mph2<-mean(head(stks2,30))
• mpt1<-mean(tail(stks1,30))
• mpt2<-mean(tail(stks2,30))
• mp1<-(mph1+mpt1)/2
• mp2<-(mph2+mpt2)/2
• qty1<-100*round((100000/mp1)/100)
• qty2<-100*round((100000/mp2)/100)
• qty<-c(qty1,qty2)
Backtesting and Forward Performance
Out-Of-Sample
Test
In-Sample
Test
Backtesting
In-Sample Test
Out-Of-Sample Test
Forward Performance(Simulation)
Today
07-01-01 to
08-01-01 09-01-01 to
11-01-01
11-01-01 to
12-01-01
In-Sample PNL Test
In-Sample PNL Test
In-Sample PNL Test
Out-Of-Sample PNL Test
Out-Of-Sample PNL Test
BackTesting
BackTesting
BackTesting
Simulation PNL
Simulation PNL
L/O/G/O
Risk Measurement
Tools used for risk
Assessment
• Sharpe ratio
• Treynor ratio
• Max Drawdowns
• Beta
• Volatility
IN-SAMPLE RESULTS
GS JPM HD LOW DRI CAKE T VZ KO PEP JNJ PG CMI CATGM
BETA 1.53 2.12 0.98 1.06 1.03 1.03 1.49 0.66 0.59 0.49 0.48 0.43 0.56 1.92
MAX DRAWDOWN 130.6 31 18.3 14.55 26.89 26.49 9.3 11.5 29.46 23.42 19.64 22.49 92.01 72.02
MA5 MA10 MA15 MA20 MA25 MA30 MA35 MA40 MA45 MA50
Sharpe Ratio 1.15 3.56 3.44 2.06 2.84 0.93 0.925 1.1 2.07 1.25
Treynor Ratio 26.8 53.11 57.1 38 28.2 21.6 12.2 15.1 16.1 23.2
THE BEST MA (RISK
ANALYSIS)
PORTFOLIO (MA 15)
BETA 1.06
VOLATALITY 28%
MAXD (PRICE) 37.69
MAX DD
MA 5 115552
MA10 102744
MA15 75634
MA20 69360
MA25 154119
MA30 82498
MA35 125360
MA40 121282
MA45 98034
MA50 88308
OUT-OF SAMPLE TEST
MA5 MA10 MA15 MA20 MA25 MA30 MA35 MA40 MA45 MA50
Sharpe Ratio 2.63 0.66 2.34 1.42 0.886 0.58 0.92 2.77 2.17 0.78
Treynor Ratio 29.4 7.38 22.7 -12.4 15.8 0.208 6.9 29 7.5 21.2
GS JPM HD LOW DRI CAKE T VZ KO PEP JNJ PG CMI CATGM
BETA 1.30 1.48 0.86 0.84 0.83 1.06 0.61 0.60 0.59 0.58 0.46 0.59 1.64 1.42
MAX DRAWDOWN 85.44 18.52 14.4 8.79 11.86 9.87 4.7 7.35 10.42 10.77 10.56 8.86 39.29 43.9
Testing MA 15
PORTFOLIO (MA 15)
BETA 0.91
VOLATALITY 12%
MAXD (PRICE) 20.34
MAX DD
MA 5 103141
MA10 82451
MA15 61544
MA20 68174
MA25 81835
MA30 79494
MA35 67058
MA40 59208
MA45 76500
MA50 75400
L/O/G/O
Thank You!
Yahqq