logo
Welcome Guest! To enable all features please Login or Register.

Notification

Icon
Error

Options
Go to last post Go to first unread
zigzag  
#1 Posted : Sunday, May 24, 2009 8:16:40 AM(UTC)
zigzag

Rank: Advanced Member

Groups: Registered, Registered Users
Joined: 1/13/2009(UTC)
Posts: 42

Following jhughey's suggestion, i am posting the message below in the Advanced Coding session.

Basically, I am curious to know from Forum members what works and what doesn't for them in terms of indicators that try to identify mean-reverting/non-mean-reverting markets and respective trading system for each regime. For instance, I am experimenting with oscillators (ie, rsi) for mean-reverting periods and with breakout systems for non-mean-reverting periods. As for identifying the regime, I find that ADX is a bit too slow and misses beginning of meaningful moves. I am studying simple indicators that measure % change from X-period High -- for instance, (hhv(h,50)-low)/hhv(h,50) -- above/below a certain level, as indication of mean-reversion. Nothing too earth-shattering, just looking for a simple and fairly effective method.

I have recently read an interesting article in Futures Magazine about the existence (or lack thereof) of mean reversion in stocks. Under the authors' apparent conclusion that there is a significant degree of autocorrelation in the SPX with a one-day lookback period, they suggest a simple trading system where one would buy at close if close<open and sell at close if close>open.

Further looking into the mean reversion assumption, I tested (with optimization - sorry) the following system on SPY from 3/12/1997 to 5/8/2009, including some long-term trend filter:

LE: ref(c<ref(O,-8) and l>mov(c,282,e),-1)

LX: ref(c>ref(O,-1) or l<mov(c,282,e),-1)

SE: ref(c>ref(O,-1) and h<mov(c,282,e),-1)

SX: ref(c<ref(O,-8) or l>mov(c,282,e),-1)

With the following parameters:

Interest 0%

Margin 3%

100% available equity

Position Limit 1

Long Initial 100%

Long Maintenance 0%

Short Initial 200%

Short Maintenance 101%

Commissions $10

Realistic Market Price No

Delay to Open 0

All trades at Close

The results stats look good and the equity curve almost improbably good. Would anybody care to post comments on this system? Is it realistic from a practical point of view?

Many thanks.

ZigZag

johnl  
#2 Posted : Sunday, May 24, 2009 8:58:48 PM(UTC)
johnl

Rank: Advanced Member

Groups: Registered, Registered Users
Joined: 11/7/2005(UTC)
Posts: 602


I wrote this for a quick test:

{-----------------------------------}
a1:=(C<Ref(O,-8));
a2:=(L>Mov(C,282,E));
a3:=a1*a2;
le:=Ref(a3,-1);
a4:=If((le=1) AND (Ref(le,-1)=0),1,0);
{-----------------------------------}
b1:=(C>Ref(O,-1));
b2:=(L<Mov(C,282,E));
b3:=b1 OR b2;
lx:=Ref(b3,-1);
b4:=If((lx=1) AND (Ref(lx,-1)=0),1,0);
{-----------------------------------}
c1:=b4*(C-ValueWhen(1,a4=1,C));
Cum(c1)


zigzag  
#3 Posted : Tuesday, May 26, 2009 2:32:38 PM(UTC)
zigzag

Rank: Advanced Member

Groups: Registered, Registered Users
Joined: 1/13/2009(UTC)
Posts: 42

johnl

thank you for your excellent code. i have adapted it for short trades as well. any idea why that discrete jump downward on the graph right around may 2003? it is about where daily SPY crosses its 282-day EMA.

ZigZag

johnl  
#4 Posted : Wednesday, May 27, 2009 4:40:33 PM(UTC)
johnl

Rank: Advanced Member

Groups: Registered, Registered Users
Joined: 11/7/2005(UTC)
Posts: 602

My guess to investigate would be to see if the signals work better farther away from than
closer to the 282-day EMA.



Users browsing this topic
Guest (Hidden)
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.