Log in to see Cloud of Tags

Wealth-Lab Wiki

TASC 2015-06 | The RSI & Price Trends (Luo)


Traders' Tip text

RSI is many a technical analyst's darlin, one of industry standard indicators which served as a playground for many modifications. In his article in June 2015 issue, Kevin Luo has proven that RSI classic counter-trend trading rules can be traded profitably and without modifications. According to author, buying at close when the RSI falls below 30 and selling when it surges above 70 works.

Caveat that should not be overlooked: out of the ten-year backtest period, 80% of time was spent in a major bull market. In the last 10 years of Russell 2000 or S&P 500 indices, "correctional movements" of 2008, 2010 and 2011 accounted for just two years in sum. In such a market, trading the corrections is natural and easy; but for how long would the bubble last?

To make trading better, author investigates into improvement of RSI trading rules using a couple of logical and simple filters. In the first place, it's possible to get rid of less probable trades by making entries only during uptrends. We define an uptrend with a trailing filter that is activated when prices move up by more than 20% from a low (vice versa for downtrend). This should help reduce the number of trades during a downtrend. Another tweak is to close positions when such 20% uptrend reverses, i.e. when prices decline 20% or greater from last uptrend's peak.

Finally, trades can be taken when the RSI appears stronger and crosses above 50 rather than 30. From our observations, it's this rising RSI requirement that has the salient effect on the system's profitability.


Figure 1. A Wealth-Lab 6 chart illustrates the sample system's performance on the Daily chart of American Express (AXP).

Figure 1 demonstrates the application of two filters: exiting a position when price falls by 20% from a trend's peak, and subsequent entries made in an uptrend when the RSI declined below 50. In the resulting RSI trading system written in C# for Wealth-Lab 6, all the options can be activated individually:

using System;
using System.Collections.Generic;
using System.Text;
using System.Drawing;
using WealthLab;
using WealthLab.Indicators;
using Community.Indicators;

namespace WealthLab.Strategies { public class TASCJune2015 : WealthScript { private StrategyParameter paramRSI; private StrategyParameter paramMult; private StrategyParameter paramUseTF; private StrategyParameter paramUseRisingRSI; private StrategyParameter paramCloseOnReverse;

public TASCJune2015() { paramRSI = CreateParameter("RSI Period", 14, 2, 30, 2); paramMult = CreateParameter("% Reversal", 20, 5, 50, 5); paramUseTF = CreateParameter("Trend filter?", 0, 0, 1, 1); paramUseRisingRSI = CreateParameter("Rising RSI?", 0, 0, 1, 1); paramCloseOnReverse = CreateParameter("Close on reverse?", 0, 0, 1, 1); } protected override void Execute() { double Mult = paramMult.Value; bool trendFilter = paramUseTF.ValueInt == 1 ? true : false; // Entering when the RSI is moving up and crossing above 50. bool risingRSI = paramUseRisingRSI.ValueInt == 1 ? true : false;

// Closing positions when uptrend reverses, that is, prices move down by more than 20% from the high of prior uptrend. bool closeOnTrendReverse = paramCloseOnReverse.ValueInt == 1 ? true : false; double ob = 70, os = risingRSI ? 50 : 30;

NRTR_Percent trendLine = NRTR_Percent.Series( Bars, Mult ); //PlotSeries( PricePane, trendLine, Color.Blue, LineStyle.Solid, 2 ); int rsiPeriod = paramRSI.ValueInt; RSI rsi = RSI.Series( Close, rsiPeriod ); ChartPane rsiPane = CreatePane( 30,true,true ); PlotSeries( rsiPane, rsi, Color.Violet, LineStyle.Solid, 2 ); DrawHorzLine( rsiPane, ob, Color.Blue, LineStyle.Dashed, 1 ); DrawHorzLine( rsiPane, os, Color.Blue, LineStyle.Dashed, 1 ); for(int bar = GetTradingLoopStartBar(20); bar < Bars.Count; bar++) { // Entering trades only during uptrends, that is, when prices move up by more than 20% from low of prior uptrend. bool uptrend = Close[bar] > trendLine[bar]; SetBackgroundColor( bar, Color.FromArgb( 30, uptrend ? Color.Green : Color.Red ) );

if (IsLastPositionActive) { if( closeOnTrendReverse ) { if( !uptrend ) SellAtMarket(bar+1, LastPosition, "Uptrend reversed" ); }

if( CrossOver( bar, rsi, ob ) ) { SellAtMarket(bar+1, LastPosition, "RSI" ); } } else { if( CrossUnder( bar, rsi, os ) ) { if( ( trendFilter && uptrend ) || !trendFilter ) BuyAtMarket(bar+1, Bars.FormatValue(rsi[bar]) ); } } } } } }

Wealth-Lab team

Important Disclaimer: The information provided by Wealth-Lab is strictly for informational purposes and is not to be construed as advice or solicitation to buy or sell any security.  The owner of Wealth-Lab.com assumes no liability resulting from the use of the material contained herein for investment purposes. By using this web site, you agree to the terms of this disclaimer and our Terms of Use.

ScrewTurn Wiki. Some of the icons created by FamFamFam.