Wednesday, February 18, 2009

Qs RSI Lag

Continuing with the new Qs Dirty Dozen, the RSI Lag system looks like a worthy component.
Trading both long and short with a good balance of performance, the system incorporates a 2 high, 2 low signal with an RSI momentum confirmation. The long side has a few more consecutive losers than I'm typically comfortable with, but the relative drawdown in pretty muted. The system only holds for a few days (which I like), minimizing risk exposure.
The equity curve is attractive given the inclusion of both long and short signals. The short side only curve is even better looking. TS2000i code is posted below:





9 comments:

mr rolfsson said...

TS8 Code for copy&paste

Input : Len(15),Len1(15),Len2(6),Len3(7);

If C > C[1] AND L < L[1] AND RSI(C,Len) > RSI(C[1],Len) Then
SellShort this bar;

If marketposition < 0 AND Barssinceentry >= Len2 then
BuyToCover this bar;

If C < C[1] AND H > H[1] AND RSI(C,Len1) < RSI(C[1],Len1) Then
Buy this bar;

If marketposition > 0 AND Barssinceentry >= Len3 then
BuyToCover this bar;

bzbtrader said...

mr,
Thanks for the TS8 code clarifications.

Damian said...

where is the RSI(2) in this? I see RSI(C,Len) where Len = 15.

bzbtrader said...

Damian,
Good catch. You are correct. Thanks for noticing. The RSI period is 15, not 2. The problem (not an excuse) with testing 10 or 20 systems a day is that sometimes part of my feeble mind is analyzing one system while another part of my brain is busy posting it.

Damian said...

No worries - and believe me I understand the issue!

bf said...

I am having no luck recreating this strategy in strategydesk...

consider only the long trades...am i correct in reading the code as saying one exits a long trade after 7 days ?

i buy on close if
Bar[High,D]greater Bar[High,D,1] AND RSI[RSI,15,D]less than RSI[RSI,15,D,1] AND Bar[Close,D] less Bar[Close,D,1]

then on the oct/2007 to feb/2009 time period i get 25 trades, 11 of which are profitable, and a profit of -16%. very different. any idea of what i might be doing wrong ?

bzbtrader said...

bf,
I can't see what the problem is. Not familiar wih strategydesk(SD), but your code looks like it lines up with mine. I'll ponder it further. Do my other systems correlate when you test them out in SD?

bf said...

Not sure if this will post correctly....here are the LONG trades from the time period you tested. trading $10000 of QQQQ each time, buying and selling at the close.

Also, is mr rolfsson's code in the comments correct? Shouldn't his last line read "if marketposition greater than 0 and Barssinceentry greater than len 3 then SELLtocover this bar?" I don't know tradestation but it seems like there isn't a sell statement for the open long position.

Ok, here are the trades:

Symbol Date Action Quantity Price Profit-Loss Profit-Loss % Cumulative P&L
qqqq 10/3/2007 Buy 193 51.65 0 0 0
qqqq 10/12/2007 Sell 193 53.53 352.84 3.54 352.84
qqqq 10/15/2007 Buy 188 53.12 0 0 352.84
qqqq 10/24/2007 Sell 188 53.77 112.2 1.12 465.04
qqqq 10/25/2007 Buy 188 53.05 0 0 465.04
qqqq 11/5/2007 Sell 188 54.07 181.76 1.82 646.8
qqqq 11/14/2007 Buy 199 50.09 0 0 646.8
qqqq 11/26/2007 Sell 199 48.98 -230.89 -2.32 415.91
qqqq 11/30/2007 Buy 194 51.31 0 0 415.91
qqqq 12/11/2007 Sell 194 51.32 -8.06 -0.08 407.85
qqqq 1/8/2008 Buy 213 46.92 0 0 407.85
qqqq 1/17/2008 Sell 213 45.41 -331.63 -3.32 76.22
qqqq 1/25/2008 Buy 227 43.99 0 0 76.22
qqqq 2/5/2008 Sell 227 43.67 -82.66 -0.83 -6.44
qqqq 2/12/2008 Buy 228 43.82 0 0 -6.44
qqqq 2/22/2008 Sell 228 43.68 -41.92 -0.42 -48.36
qqqq 2/28/2008 Buy 226 44.12 0 0 -48.36
qqqq 3/10/2008 Sell 226 41.26 -656.36 -6.58 -704.72
qqqq 3/12/2008 Buy 234 42.71 0 0 -704.72
qqqq 3/24/2008 Sell 234 44.58 427.56 4.28 -277.17
qqqq 4/2/2008 Buy 219 45.49 0 0 -277.17
qqqq 4/11/2008 Sell 219 44.28 -274.99 -2.76 -552.16
qqqq 4/17/2008 Buy 220 45.27 0 0 -552.16
qqqq 4/28/2008 Sell 220 47.24 423.4 4.25 -128.76
qqqq 4/30/2008 Buy 211 47.21 0 0 -128.76
qqqq 5/9/2008 Sell 211 48.21 201 2.02 72.24
qqqq 5/14/2008 Buy 203 49.11 0 0 72.24
qqqq 5/23/2008 Sell 203 48.2 -194.73 -1.95 -122.49
qqqq 6/17/2008 Buy 206 48.54 0 0 -122.49
qqqq 6/19/2008 Sell 206 48.77 37.38 0.37 -85.11
qqqq 7/2/2008 Buy 223 44.71 0 0 -85.11
qqqq 7/14/2008 Sell 223 44.23 -117.04 -1.17 -202.15
qqqq 7/28/2008 Buy 225 44.42 0 0 -202.15
qqqq 8/6/2008 Sell 225 46.63 487.25 4.88 285.1
qqqq 8/7/2008 Buy 216 46.27 0 0 285.1
qqqq 8/18/2008 Sell 216 47.6 277.28 2.77 562.38
qqqq 9/8/2008 Buy 230 43.31 0 0 562.38
qqqq 9/17/2008 Sell 230 40.21 -723 -7.26 -160.62
qqqq 10/14/2008 Buy 297 33.61 0 0 -160.62
qqqq 10/23/2008 Sell 297 30.49 -936.64 -9.38 -1097.26
qqqq 10/29/2008 Buy 314 31.78 0 0 -1097.26
qqqq 11/7/2008 Sell 314 31.19 -195.26 -1.96 -1292.52
qqqq 11/10/2008 Buy 324 30.77 0 0 -1292.52
qqqq 11/19/2008 Sell 324 26.86 -1276.84 -12.81 -2569.36
qqqq 12/4/2008 Buy 359 27.81 0 0 -2569.36
qqqq 12/15/2008 Sell 359 29.16 474.65 4.75 -2094.71
qqqq 12/26/2008 Buy 343 29.13 0 0 -2094.71
qqqq 1/7/2009 Sell 343 30.44 439.33 4.4 -1655.38
qqqq 1/22/2009 Buy 347 28.76 0 0 -1655.38
qqqq 2/2/2009 Sell 347 29.41 215.55 2.16 -1439.83
qqqq 2/10/2009 Buy 329 30.34 0 0 -1439.83
qqqq 2/20/2009 Sell 329 28.87 -493.63 -4.95 -1933.46
qqqq 2/25/2009 Buy 349 28.59 0 0 -1933.46
qqqq 3/6/2009 Sell 349 26.3 -809.21 -8.11 -2742.67

bzbtrader said...

bf,
Send me your email and I'll send you the TS trade printout.