Log in to see Cloud of Tags

Wealth-Lab Wiki

ARSI - Asymmetrical RSI

RSS

Syntax

public ARSI(DataSeries ds, int period, string description)
public static ARSI Series(DataSeries ds, int period)

Parameter Description

ds The source DataSeries
period The indicator period.

Description

The ARSI (Asymmetrical RSI) indicator from the October 2008 issue of Stocks & Commodities magazine.

Open Issues

  • (18427) FirstValidValue after Synchronize is incorrect for ARSI

Example

/* WealthScript from Oct 2008 Traders' Tip */
using System;
using System.Collections.Generic;
using System.Text;
using System.Drawing;
using WealthLab;
using WealthLab.Indicators;
using TASCIndicators;

namespace WealthLab.Strategies { /* ARSI divergence: Price sets a lowest low but the indicator fails to confirm the new low and turns up */ public class ARSI_Divergence : WealthScript { private StrategyParameter paramHighest; private StrategyParameter paramPeriod; private StrategyParameter paramExitDays; public ARSI_Divergence() { paramPeriod = CreateParameter("ARSI period", 14, 1, 100, 1); paramHighest = CreateParameter("Highest high of", 20, 5, 50, 1); paramExitDays = CreateParameter("Exit after", 20, 1, 50, 1); } protected override void Execute() { bool trough = false; int troughBar = -1; int low = paramHighest.ValueInt; int period = paramPeriod.ValueInt; int days = paramExitDays.ValueInt; ARSI arsi = ARSI.Series( Close, period ); Lowest indicatorLowest = Lowest.Series( arsi, low ); Lowest hLow = Lowest.Series( Low, low ); HideVolume(); LineStyle solid = LineStyle.Solid; ChartPane arsiPane = CreatePane( 50, false, true ); PlotSeries( arsiPane, arsi, Color.Green, solid, 2 ); PlotSeries( arsiPane, RSI.Series( Close, period ), Color.Red, solid, 1 );

for(int bar = 80; bar < Bars.Count; bar++) { if (!IsLastPositionActive) { /* 1st trough: both price and indicator */ if( trough == false ) { if( ( Low[bar-1] == Lowest.Series( Low, low )[bar-1] ) & ( arsi[bar-1] == Lowest.Series( arsi, low )[bar-1] ) & TurnUp( bar, Low ) & TurnUp( bar, arsi ) ) { trough = true; troughBar = bar-1; } } if( trough == true ) { if( ( Low[bar] != Lowest.Series( Low, low )[bar] ) & ( arsi[bar] == Lowest.Series( arsi, low )[bar] ) ) trough = false; }

/* 2nd trough: price low not confirmed by the indicator */

if( trough == true ) { if( ( Low[bar-1] == Lowest.Series( Low, low )[bar-1] ) & ( Low[bar-1] <= Low[troughBar] ) & ( arsi[bar-1] != Lowest.Series( arsi, low )[bar-1] ) & ( arsi[bar-1] > arsi[troughBar] ) & TurnUp( bar, Low ) & TurnUp( bar, arsi ) ) { trough = false; BuyAtMarket( bar+1 ); /* Highlight divergence */ for (int b = troughBar; b <= bar; b++) SetPaneBackgroundColor( arsiPane, b, Color.FromArgb( 30, Color.LightGreen ) ); DrawLine( PricePane, troughBar, Low[troughBar], bar-1, Low[bar-1], Color.Blue, solid, 2 ); DrawLine( arsiPane, troughBar, arsi[troughBar], bar-1, arsi[bar-1], Color.Red, solid, 2 ); } } } else { /* Exit after N days */ Position p = LastPosition; if ( bar+1 - p.EntryBar >= days ) SellAtMarket( bar+1, p, "Timed" ); } } } } }

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.