The RSI Trend Catcher uses the Relative Strength Index to generate buy and sell signals.

 

It uses a threshold range above which it will buy and below which it will sell. The range it determined as:

 

Top of range - entered by user as entryThreshold

Bottom of range - ( 100 - entryThreshold )

 

It sets the stops stopWidth fraction of the ATR from the close.

 

It uses a threshold range for exits. Above which it exits a short position, and below which it exits a long position.

 

 

The RSI Trend Catcher System uses the following parameters:

 

RSI

 

 

RSI Length (Bars)

Number of bars used to calculate the RSI

 

Entry RSI Threshold

The top of the entry range above which the system will enter a long position. 100 - entryThreshold is the bottom of the entry range, below which the system will enter a short position.

 

Exit RSI Threshold

The bottom of the exit range, below which the system will exit a long position. 100 - exitThreshold is the top of the exit range, above which the system will exit a short position.

 

Stop Width (ATR)

Fraction of the ATR used for stop. Stops are based off the Close

 

ATR Bars

Number of bars used to calculate the Average True Range

 

 

Entry Script

' ---------------------------------------------
' Enter position if RSI crosses threshold.
' ---------------------------------------------
VARIABLES: exitStop TYPE: Floating
 
IF instrument.position <> LONG AND
   relativeStrengthIndex > entryThreshold THEN
   
  ' Compute the stop.
   exitStop = instrument.close - (stopWidth * averageTrueRange)
   
  ' Enter a long on the open with this stop.
  broker.EnterLongOnOpen( exitStop )
ENDIF
 
IF instrument.position <> SHORT AND
   relativeStrengthIndex < (100 - entryThreshold) THEN
   
  ' Compute the stop.
   exitStop = instrument.close + (stopWidth * averageTrueRange)
   
  ' Enter a long on the open with this stop.
  broker.EnterShortOnOpen( exitStop )
ENDIF

 

 

Exit Script

' ---------------------------------------------
' Exit Position if RSI crosses Threshold
' ---------------------------------------------
 
IF   instrument.position = LONG AND
   relativeStrengthIndex <= exitThreshold THEN
   
  ' Exit the position.
  broker.ExitAllUnitsOnOpen
ENDIF
 
IF   instrument.position = SHORT AND
   relativeStrengthIndex >= (100 - exitThreshold) THEN
   
  ' Exit the position.
  broker.ExitAllUnitsOnOpen
ENDIF

 

 

Adjust Stops

' ---------------------------------------------
' Enter stop if "holdstops" is true
' ---------------------------------------------
IF holdStops THEN
 
  broker.ExitAllUnitsOnStop( instrument.unitExitStop )    
ENDIF

 


Edit Time: 9/20/2017 07:56:26 AM


Topic ID#: 197

 

Created with Help & Manual 7 and styled with Premium Pack Version 2.80 © by EC Software