in Search

mean-reversion, again

Last post 05-27-2009, 16:40 by johnl. 3 replies.
Sort Posts: Previous Next
  •  05-24-2009, 8:16 29774

    mean-reversion, again

    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

  •  05-24-2009, 20:58 29779 in reply to 29774

    Re: mean-reversion, again


    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)


  •  05-26-2009, 14:32 29789 in reply to 29779

    Re: mean-reversion, again

    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

  •  05-27-2009, 16:40 29800 in reply to 29789

    Re: mean-reversion, again

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

     
     
View as RSS news feed in XML