Welcome to the Traders Laboratory.

Automated Trading Black box systems, strategy automation, algorithmic trading, etc...

Reply
Old 04-13-2010, 10:07 PM   #1

Jeff65's Avatar

Join Date: Apr 2010
Location: Gurnee
Posts: 24
Ignore this user

Thanks: 13
Thanked 13 Times in 6 Posts

RSI Fade System

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).


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:

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
Attached Thumbnails
RSI Fade System-equity_curve.png  
Jeff65 is offline  
Reply With Quote
The Following 7 Users Say Thank You to Jeff65 For This Useful Post:
arjfca (11-11-2010), ClearAir (04-14-2010), DugDug (04-14-2010), LabRatNo9 (02-29-2012), Piv0tPoint (04-23-2010), Tams (04-13-2010), topbadbady (05-03-2010)
Old 05-01-2010, 11:07 AM   #2

swansjr's Avatar

Join Date: Oct 2007
Location: Gurnee, IL
Posts: 281
Ignore this user

Thanks: 86
Thanked 134 Times in 71 Posts

Re: RSI Fade 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.



Attached Thumbnails
RSI Fade System-morning-fade-results-april-2010.png   RSI Fade System-morning-fade-eq-curve-april-2010.png  
swansjr is offline  
Reply With Quote
The Following 4 Users Say Thank You to swansjr For This Useful Post:
bibulous (05-11-2010), kuro (05-01-2010), qnamicb (11-14-2010), topbadbady (05-03-2010)
Old 05-03-2010, 04:25 PM   #3

Join Date: Nov 2009
Location: shanghai
Posts: 5
Ignore this user

Thanks: 2
Thanked 1 Time in 1 Post

Thumbs up Re: RSI Fade System

Very good idea.
add some filters can be very profitable system.

Quote:
Originally Posted by swansjr »
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.



topbadbady is offline  
Reply With Quote
Old 05-03-2010, 09:20 PM   #4

swansjr's Avatar

Join Date: Oct 2007
Location: Gurnee, IL
Posts: 281
Ignore this user

Thanks: 86
Thanked 134 Times in 71 Posts

Re: RSI Fade System

Quote:
Originally Posted by topbadbady »
Very good idea.
add some filters can be very profitable system.

Would love to hear your ideas, if you don't mind.
swansjr is offline  
Reply With Quote
Old 05-03-2010, 09:28 PM   #5

Jeff65's Avatar

Join Date: Apr 2010
Location: Gurnee
Posts: 24
Ignore this user

Thanks: 13
Thanked 13 Times in 6 Posts

Re: RSI Fade System

Quote:
Originally Posted by topbadbady »
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
Jeff65 is offline  
Reply With Quote
Old 11-11-2010, 05:45 AM   #6

Join Date: Oct 2010
Posts: 9
Ignore this user

Thanks: 9
Thanked 1 Time in 1 Post

Re: RSI Fade System

Quote:

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
Hello Jeff
I know it is an old post, but do you remember why you used the ATR value?

Martin
arjfca is offline  
Reply With Quote
Old 11-11-2010, 02:02 PM   #7

Jeff65's Avatar

Join Date: Apr 2010
Location: Gurnee
Posts: 24
Ignore this user

Thanks: 13
Thanked 13 Times in 6 Posts

Re: RSI Fade System

Quote:
Originally Posted by arjfca »
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.
Jeff65 is offline  
Reply With Quote
Old 11-12-2010, 12:33 AM   #8

Join Date: Oct 2009
Posts: 16
Ignore this user

Thanks: 5
Thanked 2 Times in 2 Posts

Re: RSI Fade System

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.
jurotraderslab is offline  
Reply With Quote

Reply

Thread Tools
Display Modes Help Others By Rating This Thread
Help Others By Rating This Thread:

Similar Threads
Thread Thread Starter Forum Replies Last Post
Multi System for Universal System Dr. Clayburg philloo Coding Forum 7 01-18-2012 07:41 AM
Gaps - to Fade or Not to Fade (Gap As % from the X Days Average Range) N57H Technical Analysis 0 07-21-2009 11:47 PM
Which System Would You Prefer? maildigger E-mini Futures Trading Laboratory 9 08-17-2008 12:00 PM
DOW/Gap Plays:Fade/Trade/OR Just Observe ? michaelstuarts Beginners Forum 4 04-26-2007 11:20 PM
sharing your system Don4 Brokers and Data Feeds 10 03-06-2007 11:15 AM

All times are GMT -4. The time now is 06:40 PM.
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
CS to VB integration by DeskLancer
©2006-2011 Traders Laboratory, All Rights Reserved.