Let’go to build a new Tradestation RSI strategy in EasyLanguage. Today we present the excellent 2-period RSI method devised by Larry Connors. We apply it to the US index using the SPDR S&P 500 ETF SPY.
Firstly, what is the Relative Strength Index (RSI)?
From Investopedia 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 Strenght Index and Connors RSI:
We have many strategies with RSI Indicator. This is our custom indicator that shows also the direction:
The original Connors strategy is:
BUY: when the Relative Strenght Index indicator is oversold below the 5 level.
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 time frame daily. The system does not have money management and always buy $ 10,000 with an initial capital of $ 30,000 and has a huge stop loss of $ 2,000.
CODE IN EASYLANGUAGE – STRATEGY 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, 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 );
The Trading System’s equity line and results:
We coded the Larry Connors RSI 2 strategy in EasyLanguage for TradeStation and we like it!
Decent operation’s number ( 227 ) and average profit ( $ 44), very good percent profitable ( 70% ).
We can improve it adding a trend filter and money management rules. The size must depend on implicit or historical volatility.
Tradestation and MultiCharts Strategy RSI Connors – Easylanguage final code:
STATE STREET SPDR: SPDR S&P 500 ETF SPY
WIKIPEDIA: Larry Connors
Investopedia Connors Rsi — Link
For more information:
Short Term Trading Strategies That Work