Original article by Mike B. Siroky
For this June’s Stocks & Commodities Tips, I substituted the article by Mike B. Siroky, “Wilder’s RSI: Extending the Time Horizon” for the article by Sylvain Vervoort.
I provide a system that uses the author’s adjustable RSI bands that automatically adjust to the appropriate level for the input RSI length. The system is very simple:
- Buy next bar at market open when the RSI is less than the lower confidence interval band (RSI_CILOW).
- Exit the long position next bar at market open when the RSI is greater than the upper confidence interval band (RSI_CIUP).
- Reverse rules for shorting.
- I have a parameter that allows testing long only, short only or both long and short.
- The system lost when the short side was allowed to trade.
Figure 1 shows the AIQ EDS Summary long only back-test report using the NASDAQ 100 list of stocks over the period 5/11/2000 to 5/12/2014. Neither commission nor slippage have been subtracted from these results. In running this test, I used a capital protect of 98% which is equivalent to a 2% stop loss using the close. All entries and exits are at the next open. I could not get the short side to show a profit even with added market timing filters for trend on the NASDAQ 100 index.
AIQ EDS Summary long only back-test report using the NASDAQ 100 list of stocks over the period 5/11/2000 to 5/12/2014.
The EDS code is below and also available at http://www.tradersedgesystems.com/aiq/traderstips/jun14/aiq/RSI%20Extended.EDS
!WILDER’S RSI: EXTENDING THE TIME HORIZON
!Author: Mike B. Siroky, TASC May 2014
!Coded by: Richard Denning 5/10/2014
!www.TradersEdgeSystems.com
!Author: Mike B. Siroky, TASC May 2014
!Coded by: Richard Denning 5/10/2014
!www.TradersEdgeSystems.com
!INPUTS:
W1 is 55. !RSI length for going long
W2 is 5. !RSI length for going short
numSD is 1.645.
W1 is 55. !RSI length for going long
W2 is 5. !RSI length for going short
numSD is 1.645.
!CONSTANT:
EXPECTED_VALUE is 50.
EXPECTED_VALUE is 50.
!USER DEFINED FUNCTIONS
!RSI BANDS:
RSI_CIUP1 is (EXPECTED_VALUE/100 + Sqrt(EXPECTED_VALUE/100/2/W1)*numSD)*100.
RSI_CILOW1 is (EXPECTED_VALUE/100 – Sqrt(EXPECTED_VALUE/100/2/W1)*numSD)*100.
RSI_CIUP2 is (EXPECTED_VALUE/100 + Sqrt(EXPECTED_VALUE/100/2/W2)*numSD)*100.
RSI_CILOW2 is (EXPECTED_VALUE/100 – Sqrt(EXPECTED_VALUE/100/2/W2)*numSD)*100.
!RSI BANDS:
RSI_CIUP1 is (EXPECTED_VALUE/100 + Sqrt(EXPECTED_VALUE/100/2/W1)*numSD)*100.
RSI_CILOW1 is (EXPECTED_VALUE/100 – Sqrt(EXPECTED_VALUE/100/2/W1)*numSD)*100.
RSI_CIUP2 is (EXPECTED_VALUE/100 + Sqrt(EXPECTED_VALUE/100/2/W2)*numSD)*100.
RSI_CILOW2 is (EXPECTED_VALUE/100 – Sqrt(EXPECTED_VALUE/100/2/W2)*numSD)*100.
!RSI WILDER:
U is [close]-val([close],1).
D is val([close],1)-[close].
rsiLen1 is 2 * W1 – 1.
AvgU is ExpAvg(iff(U>0,U,0),rsiLen1).
AvgD is ExpAvg(iff(D>=0,D,0),rsiLen1).
RSI_1 is 100-(100/(1+(AvgU/AvgD))).
rsiLen2 is 2 * W2 – 1.
AvgU2 is ExpAvg(iff(U>0,U,0),rsiLen2).
AvgD2 is ExpAvg(iff(D>=0,D,0),rsiLen2).
RSI_2 is 100-(100/(1+(AvgU2/AvgD2))).
U is [close]-val([close],1).
D is val([close],1)-[close].
rsiLen1 is 2 * W1 – 1.
AvgU is ExpAvg(iff(U>0,U,0),rsiLen1).
AvgD is ExpAvg(iff(D>=0,D,0),rsiLen1).
RSI_1 is 100-(100/(1+(AvgU/AvgD))).
rsiLen2 is 2 * W2 – 1.
AvgU2 is ExpAvg(iff(U>0,U,0),rsiLen2).
AvgD2 is ExpAvg(iff(D>=0,D,0),rsiLen2).
RSI_2 is 100-(100/(1+(AvgU2/AvgD2))).
!RULES:
HD if hasdatafor(210) >= 200.
HD if hasdatafor(210) >= 200.
Buy if RSI_1 < RSI_CILOW1 and HD.
Exit if RSI_1 > RSI_CIUP1 and HD.
Exit if RSI_1 > RSI_CIUP1 and HD.
NDXc is TickerUDF(“NDX”,[close]).
Sell if RSI_2 > RSI_CIUP2 and NDXc < simpleavg(NDXc,200) and HD.
Cover if RSI_2 < RSI_CILOW2 and HD.
Sell if RSI_2 > RSI_CIUP2 and NDXc < simpleavg(NDXc,200) and HD.
Cover if RSI_2 < RSI_CILOW2 and HD.