Jump to content

Welcome to the new Traders Laboratory! Please bear with us as we finish the migration over the next few days. If you find any issues, want to leave feedback, get in touch with us, or offer suggestions please post to the Support forum here.

  • Welcome Guests

    Welcome. You are currently viewing the forum as a guest which does not give you access to all the great features at Traders Laboratory such as interacting with members, access to all forums, downloading attachments, and eligibility to win free giveaways. Registration is fast, simple and absolutely free. Create a FREE Traders Laboratory account here.

Jeff65

RSI Fade System

Recommended Posts

Here is a simple automated trading system that has been exploiting an edge in the S&P futures market (ES) for over a year. The equity curve shows the performance of trading one contract and takes into account both slippage and commissions ($18.50 per trade).

 

attachment.php?attachmentid=20595&stc=1&d=1271205892

Equity Curve 2009-2010

($18.50 deducted per trade)

 

I attached the EasyLanguage code so you can experiment with it if you wish.

 

I create trading systems for TradeStation to exploit such edges. Edges in the market, such as this example, can appear and persist for months or even years. I attempt to find these and ride them until they begin to fail. How do I know when they fail? I usual use a simple moving average of the equity curve. When it begins to fall below the moving average then I stop trading it. Anyway, this is an example of an edge that I discovered last summer. I then created a simple trading system based around it and the edge continues today.

 

How does this system work? It's simple. I use RSI(9) to fade price extremes in the pre-market hours (600 - 830 Central). It can be traded on a 5-minute chart or 10-minute chart. The equity curve above is from a 5-minute chart. The system has a $150 profit target and a $250 stop which is typical for a trend fading system. That's it! The choppy nature of the ES market in the pre-market hours has really made this simple concept work. Of course the edge will not last forever! It could end this week or last for another year.

 

I bring this up because trading systems don't have to be complicated. Often what's more important is simply diversifying across different markets with different systems. That also implies being properly funded to trade a portfolio of systems.

 

Here is the code:

 

{== START OF HEADER ==========================================================================

Program: EE Morning Fade
Author:  Jeff65
Date:    August 2009

Platform:       TradeStation v8.6
Chart Settings: 5-minute bar 
Market:         ES

DESCRIPTION:

This program uses standard RSI to fade the market. Trades are entered at the extreme of the
signal bar on a limit ordrer. Trades are exited at market.

Learn More: http://www.eminiedges.com

== END OF HEADER =============================================================================}

Inputs:
Cntracts(1),
   TradeTimeStart(530),
   TradeTimeEnd(830),
profittarget$(150),
   stopLoss$( 250),
DayLoss$(250),
   RSI_Period(9),
   UpperLimit(70),
   LowerLimit(30);

Variables:

{ -- Software Version Information ------------------------------------------------------- }

vNumber("1.00"), // Current version of this software
vProductName("Morning Fade"),// Product name

  { -- Trading Variables ------------------------------------------------------------------ }

MarkPos       ( 0 ), // Market Position
TradeFlag ( false ), // Trade Flag. TRUE = activily trade
RetVal		  ( 0 ), // Return value place holder

{ -- Money Management ------------------------------------------------------------------- }

ATR(0),				// ATR at purchase
PLB4Today(0),		// P&L total before today
ProfToday(0),		// P&L total for today (NP + OPP - PLB4Today)
OPP(0),				// Open Position Profit
NP(0);				// Net P&L of all closed positions

{=== START OF PROGRAM  ======================================================================}

  If ( date <> date[1] ) Then
  Begin
     PLB4Today = NetProfit;
  End;

////////////////////////////////////////////////////////////////////////////
//
// Compute the current market position and reset TradeFlag to FALSE
//

MarkPos = MarketPosition;
TradeFlag = false;

  NP = NetProfit - PLB4Today;
  OPP = OpenPositionProfit;
  ProfToday = NP + OPP;


////////////////////////////////////////////////////////////////////////////
//
// Determine if current time is within valid market session. 
// This is done by setting the TradeFlag to TRUE which will allow
// new positions to be opened.
//

If ( Time > TradeTimeStart ) And ( Time < TradeTimeEnd ) Then
   TradeFlag = true;

If ( ProfToday <= -(DayLoss$) ) Then TradeFlag = false;

////////////////////////////////////////////////////////////////////////////
//
// If current time is within valid market session then we look for an
// opportunity to trade
//

If ( TradeFlag ) Then
Begin

	 If ( MarkPos = 0 ) Then
 Begin
    	If ( RSI( Close, RSI_Period ) < LowerLimit ) Then  Buy ("LE") Cntracts contract next bar at Low limit
    	Else If ( RSI( Close, RSI_Period ) > UpperLimit ) Then Sell Short("SE") Cntracts contract next bar at High limit;   
    	ATR = AvgTrueRange(13);
    End;

End
Else
Begin

    // Exit all positions when not in valid session

    If MarkPos = 1 then sell("Close All") next bar at market;
 If MarkPos = -1 then buytocover(" Close All") next bar at market;

End; 

If ( profittarget$ > 0 ) then SetProfitTarget( profitTarget$ );
SetStopLoss( stopLoss$ );

 

Jeff

Equity_Curve.png.9cc3b91058b3ecff5c9dc400aa86df29.png

Share this post


Link to post
Share on other sites

Hello,

 

Attached are two images of the trades made by the RSI Fading System (Morning Fade) for the month of April. The charts and graphs depict trades in my live account which, of course, takes into account slippage. The system enters on limit orders and if I'm not filled I don't take the trade. I'll wait until the next setup. Slippage most often occurs on the 830 Central exit and is 1 tick. Anyway, this market edge continues to hold well.

 

attachment.php?attachmentid=20844&stc=1&d=1272722627

 

attachment.php?attachmentid=20843&stc=1&d=1272722627

5aa70fffa5da7_MorningFadeResultsApril2010.png.8060fd537d54c1031f5eada25c966605.png

5aa70fffaa549_MorningFadeEQCurveApril2010.png.c0c9a607d9b4637b56a9fa965fc10471.png

Share this post


Link to post
Share on other sites

Very good idea.

add some filters can be very profitable system.

 

Hello,

 

Attached are two images of the trades made by the RSI Fading System (Morning Fade) for the month of April. The charts and graphs depict trades in my live account which, of course, takes into account slippage. The system enters on limit orders and if I'm not filled I don't take the trade. I'll wait until the next setup. Slippage most often occurs on the 830 Central exit and is 1 tick. Anyway, this market edge continues to hold well.

 

attachment.php?attachmentid=20844&stc=1&d=1272722627

 

attachment.php?attachmentid=20843&stc=1&d=1272722627

Share this post


Link to post
Share on other sites
Very good idea.

add some filters can be very profitable system.

 

While I can’t explain why, it is often the case that different days of the week show unique trading characteristics. I tested this day trading system across each day of the week. That is, what would the system performance look like if I just took trades on Mondays? How about Tuesday? And so on.

 

In short, Friday is a consistent loser and by not trading this ES scalping system on Friday, you can produce better performance results. I created some equity charts and a short video *removed promotional URL* to demonstrate what I did, for those who are interested.

 

Jeff

Share this post


Link to post
Share on other sites

 

{== START OF HEADER ==========================================================================

Program: EE Morning Fade
Author:  Jeff65
Date:    August 2009

Platform:       TradeStation v8.6
Chart Settings: 5-minute bar 
Market:         ES

DESCRIPTION:

This program uses standard RSI to fade the market. Trades are entered at the extreme of the
signal bar on a limit ordrer. Trades are exited at market.

Learn More: http://www.eminiedges.com

== END OF HEADER =============================================================================}

Inputs:
Cntracts(1),
   TradeTimeStart(530),
   TradeTimeEnd(830),
profittarget$(150),
   stopLoss$( 250),
DayLoss$(250),
   RSI_Period(9),
   UpperLimit(70),
   LowerLimit(30);

Variables:

{ -- Software Version Information ------------------------------------------------------- }

vNumber("1.00"), // Current version of this software
vProductName("Morning Fade"),// Product name

  { -- Trading Variables ------------------------------------------------------------------ }

MarkPos       ( 0 ), // Market Position
TradeFlag ( false ), // Trade Flag. TRUE = activily trade
RetVal		  ( 0 ), // Return value place holder

{ -- Money Management ------------------------------------------------------------------- }

ATR(0),				// ATR at purchase
PLB4Today(0),		// P&L total before today
ProfToday(0),		// P&L total for today (NP + OPP - PLB4Today)
OPP(0),				// Open Position Profit
NP(0);				// Net P&L of all closed positions

{=== START OF PROGRAM  ======================================================================}

  If ( date <> date[1] ) Then
  Begin
     PLB4Today = NetProfit;
  End;

////////////////////////////////////////////////////////////////////////////
//
// Compute the current market position and reset TradeFlag to FALSE
//

MarkPos = MarketPosition;
TradeFlag = false;

  NP = NetProfit - PLB4Today;
  OPP = OpenPositionProfit;
  ProfToday = NP + OPP;


////////////////////////////////////////////////////////////////////////////
//
// Determine if current time is within valid market session. 
// This is done by setting the TradeFlag to TRUE which will allow
// new positions to be opened.
//

If ( Time > TradeTimeStart ) And ( Time < TradeTimeEnd ) Then
   TradeFlag = true;

If ( ProfToday <= -(DayLoss$) ) Then TradeFlag = false;

////////////////////////////////////////////////////////////////////////////
//
// If current time is within valid market session then we look for an
// opportunity to trade
//

If ( TradeFlag ) Then
Begin

	 If ( MarkPos = 0 ) Then
 Begin
    	If ( RSI( Close, RSI_Period ) < LowerLimit ) Then  Buy ("LE") Cntracts contract next bar at Low limit
    	Else If ( RSI( Close, RSI_Period ) > UpperLimit ) Then Sell Short("SE") Cntracts contract next bar at High limit;   
    	[HIGHLIGHT YELLOW]ATR = AvgTrueRange(13);[/HIGHLIGHT YELLOW]     End;

End
Else
Begin

    // Exit all positions when not in valid session

    If MarkPos = 1 then sell("Close All") next bar at market;
 If MarkPos = -1 then buytocover(" Close All") next bar at market;

End; 

If ( profittarget$ > 0 ) then SetProfitTarget( profitTarget$ );
SetStopLoss( stopLoss$ );

 

Jeff

 

Hello Jeff

I know it is an old post, but do you remember why you used the ATR value?

 

Martin

Share this post


Link to post
Share on other sites
Hello Jeff

I know it is an old post, but do you remember why you used the ATR value?

 

Martin

 

 

Hey Martin. I simply picked it. I did no back testing or optimization on that number.

Share this post


Link to post
Share on other sites

I backtested your system on 5 years of data and it doesn't show good results, it does show better results starting from 2008 but still nowhere near the equity curve you are showing. I used 1 min OHLC data to test the strategy. I am not saying simple things don't work but this just seemed very suspicious to me that such a system would work and the backtest showed it wouldn't.

Share this post


Link to post
Share on other sites
I backtested your system on 5 years of data and it doesn't show good results, it does show better results starting from 2008 but still nowhere near the equity curve you are showing. I used 1 min OHLC data to test the strategy. I am not saying simple things don't work but this just seemed very suspicious to me that such a system would work and the backtest showed it wouldn't.

 

The graph at the beginning of this post is on a 5-minute chart. The system does not trade 1-minute bars because that's far too noisy. It was designed on 5-minute bars and I've also traded it on 10-minute bars.

 

Also during the development it was pointed out that this was a recent edge, that started in the last two years and probably won't last forever.

 

If you want to know more I posted some videos on my blog that show how I developed this system. You can find those videos here.

 

Again, this system probably has an edge that will not last forever. It's not a super great system. You're not going to get rich trading this system alone! But it's an example of finding an edge in the market and attempting to exploit it. If you watch the videos on how I created it you will get the main thrust which is, tips on developing a trading system.

 

Hope that helps.

Share this post


Link to post
Share on other sites

Thanks for your response. I retested the system with limit orders on 5 min bars and it shows similar to your results. The problem I would have with this system is that it's performance before October/November 2008 (incidentally this coincides with the market crash) is the exact opposite-equity curve steadily going down. In any case, I understand your logic and wish you luck trading it until it stops working. Just a quick question here. What drawdown will cause you to stop using this system? I am asking because the equity curve going back to 2005 has a sharp V shape with turning point in 2008, so once the equity curve starts going down you cannot be confident it's just a temporary blip or the system simply doesn't work anymore. Regardless of all the ranting here, I do like your systematic approach to researching market behaviour.

Share this post


Link to post
Share on other sites
Thanks for your response. I retested the system with limit orders on 5 min bars and it shows similar to your results. The problem I would have with this system is that it's performance before October/November 2008 (incidentally this coincides with the market crash) is the exact opposite-equity curve steadily going down. In any case, I understand your logic and wish you luck trading it until it stops working. Just a quick question here. What drawdown will cause you to stop using this system? I am asking because the equity curve going back to 2005 has a sharp V shape with turning point in 2008, so once the equity curve starts going down you cannot be confident it's just a temporary blip or the system simply doesn't work anymore. Regardless of all the ranting here, I do like your systematic approach to researching market behaviour.

 

That's a good question. One technique I like to use is to apply either a moving average to your your trading system’s equity curve. You'll have to try a few numbers to see what you like. By placing a simple moving average over your equity curve you create an indicator alerting you when to to stop trading and when to resume trading. You trade the system when the equity curve is above the moving average and stop trading it when it falls.

 

It's true you can't be certain if the drawdown is temporary or if the edge is simply gone. But by "trading the equity curve" this will help keep you out or alert you to when the system is experiencing long periods of drawdown.

 

I have a blog post on this with a short video demonstrating this concept here.

Share this post


Link to post
Share on other sites

I have quite literally scanned over the EasyLanguage that you have given, so may be about to completely misrepresent it, but would make the following suggestions:

 

a) the basic concept is not that disimilar to the 'swing trading' strategies described by Larry Connors, amongst others, in that it involves buying a short term oversold market back in the direction of the longer term trend. While this approach unoubtedly backtests well on daily charts, its performance is typically less impressive on intraday timeframes, where it will often produce highly profitable periods followed by similar losing periods.

 

b) I am not a big advocate of 'filtering' trading signals using multiple price-based indicators. Nevertheless, there is no denying that this particular approach benefits from such multiple indicator confirmations. Try combining the RSI with the Commodity Channel Index and a Value Chart, and then only taking those signals that meet at least two of the oversold conditions.

 

c) this type of strategy, in backtesting in the stock indices, shows a bias towards long positions that cannot be ignored. Though many would argue that this is an undesirable trait and an unjustifiable approach to trading a market, it is somewhat understandable; a large proportion of investors, both retail and institutional, are 'long only', and will look to buy a discounted market.

 

d) Has your 9 period setting for the RSI been properly backtested? I would strongly recommend that you examine the performance of this system with shorter RSI settings.

 

e) Are you confident that employing the ATR in your strategy is increasing its edge? What happens if you replace it with a stop and target derived from the MAE and MFE of past trades?

 

Hope that's of some help to those on this interesting thread. If I've misundertood anything let me know and I will read through the original code more carefully.

Share this post


Link to post
Share on other sites
You trade the system when the equity curve is above the moving average and stop trading it when it falls.here.

 

Though there's nothing -wrong- with what you're saying here, you're presenting one side of the 'equity curve trading' picture.

 

Assuming a strategy has a definite edge, then losing periods can be expected to follow winning periods, on a reversion-to-the-mean type basis, and so many would argue that it makes more sense to commence trading when the equity curve falls below its average (on the assumption that it will soon rise above it), and cease trading when it moves above it (on the assumption that a losing period is most likely just around the corner). This is the opposite to what you describe.

 

I am also guilty of not presenting the full picture; because the equity curve of a profitable strategy is likely to spend more sustained periods above its moving average, then ceasing trading above it is questionable. A sophisticated hedge fund approach may subtley adjust position sizing dependent on the state of the equity curve relative to its moving average, but unless you're lucky enough to be flipping hundreds of contracts, then this isn't much help to you.

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.