SARSI (Self-Adjusting RSI)

Modified on 2012/06/25 09:18 by Eugene — Categorized as: TASCIndicators

Syntax

public SARSI(DataSeries ds, int period, double multiplier, string description) public static SARSI Series(DataSeries ds, int period, double multiplier)

Parameter Description

dsThe source DataSeries
periodRSI lookback period
multiplierConstant multiplier

Description

David Sepiashvili's Self-Adjusting RSI from February 2006 Traders' Tips (Stocks & Commodities magazine) presents a technique to adjust the traditional RSI overbought and oversold thresholds to ensure that 70-80% of RSI values lie between the two thresholds. Wealth-Lab's calculation is based on an algorithm by Sepiashvili which adjusts the thresholds based on a simple moving average of the RSI.

Example

The demo Strategy below uses the traditional RSI rules, going long when the RSI indicator crosses over its lower benchmark and exiting when it crosses below the upper benchmark.

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

namespace WealthLab.Strategies { public class MyStrategy : WealthScript { protected override void Execute() { RSI rsi = RSI.Series( Close,50 ); SARSIUpper saru = SARSIUpper.Series( Close,50,2.0 ); SARSILower sarl = SARSILower.Series( Close,50,2.0 ); ChartPane rsiPane = CreatePane( 40,true,true ); PlotSeries( rsiPane, rsi, Color.DarkBlue, LineStyle.Solid, 2 ); PlotSeriesFillBand( rsiPane, saru, sarl, Color.Silver, Color.Transparent, LineStyle.Solid, 2); for(int bar = GetTradingLoopStartBar(50 * 3); bar < Bars.Count; bar++) { if (IsLastPositionActive) { if( CrossUnder(bar, rsi, saru) ) SellAtMarket(bar+1, LastPosition); } else { if( CrossOver(bar, rsi, sarl) ) BuyAtMarket(bar+1); } } } } }