Let’s build a new Tradestation Connors RSI strategy in EasyLanguage.
Today we present the excellent 2-period Connors RSI method devised by Larry Connors. We apply it to the US index using the SPDR S&P 500 Exchange Traded Fund (ETF) SPY.
First, What is the Relative Strength Index (RSI)?
From Investopedia is “The RSI is a momentum indicator that measures the magnitude of recent price changes to evaluate overbought or oversold conditions in the price of a stock or other asset“.
Classic Relative Strength Index and Connors RSI:
The original Connors RSI strategy
BUY: When the Relative Strength Index indicator is oversold below the 5 levels.
EXIT: When the price closes above the simple 5-period moving average on PriceClose.
Connors also uses a trend filter through a 200-period moving average to determine the big trend.
Today we will change the original strategy. We using an oversold level of 10 and we will not use the trend filter.
However, the system will only go long on a daily time frame. Caution: The system does not have adequate position sizing and buys $ 10,000 with an initial capital of $ 30,000 and has a huge stop loss of $ 2,000.
EasyLanguage Code for TradeStation and MultiCharts
There are many strategies that you could code in EasyLanguage for TradeStation.
This is only one alternative version.
Let’s start with declaring the inputs:
Then we declare the variables:
Then we code the RSI calculations for the entry signal and the moving average for the exit:
RSI_Value = RSI(Close,RSI_Period);
Exit_MA = Average(Close, MA_Exit_Period);
Finally, we insert the code to send the order and manages the exit:
If ( RSI_Value <= RSI_OverBought ) Then buy(“Buy”) this bar at close;
If ( MarketPosition <> 0 ) And ( Close > Exit_MA ) Then sell(“Exit”) this bar at close;
If ( Max_Risk > 0 ) Then SetStopLoss( Max_Risk );
This is the Trading System’s equity line and results:
We coded the Larry Connors RSI 2 strategy in EasyLanguage for TradeStation and we like it!
The results of our trading operation utilizing strategy: 22trades with an average profit of $44 per trade, with a very good percent of profitable trades at 70%.
We can improve it by adding a trend filter with position sizing rules. The size of the position must depend on implicit or historical volatility.
Tradestation and MultiCharts Strategy RSI Connors – Easylanguage final code:
More from Finance Strategy System
STATE STREET SPDR: SPDR S&P 500 ETF SPY
WIKIPEDIA: Larry Connors