RAVI

Modified on 2020/05/31 05:42 by Eugene — Categorized as: Community Indicators

Syntax

public RAVI(DataSeries ds, int periodFast, int periodSlow, bool useSMA, bool useAbsolute, string description)
public static RAVI Series(DataSeries ds, int periodFast, int periodSlow, bool useSMA, bool useAbsolute)

Parameter Description

dsDataSeries
periodFastFast moving average period (default: 7)
periodSlowSlow moving average period (default: 65)
useSMAUse SMA (default) or EMA for the calculation
useAbsoluteTake the absolute value of the result (default) as per the book by Tushar Chande or preserve trend direction

Description

Chande's Range Action Verification Index (RAVI) indicator was developed by Tushar Chande. It's used to identify whether a market is trending. The RAVI indicator is calculated using two moving averages, fast and slow. The first one is a short moving average with a lookback period of 7 bars. The second one is a long moving average with a lookback period of 65 bars. The indicator returns a percentage value. Above a certain threshold, the market is considered trending.

References:


Example

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 RAVI_ : WealthScript { protected override void Execute() { var ravi = RAVI.Series(Close, 7, 65, true, true);

ChartPane p = CreatePane(30, false, false); HideVolume(); PlotSeries(p, ravi, Color.Black, LineStyle.Solid, 3); DrawHorzLine(p, 3, Color.Blue, LineStyle.Dashed, 1); DrawHorzLine(p, -3, Color.Red, LineStyle.Dashed, 1);

for(int bar = 1; bar < Bars.Count; bar++) { SetSeriesBarColor(bar, ravi, (ravi[bar] > ravi[bar-1]) ? Color.Green : Color.Red); } } } }