ROC

Modified on 2016/11/04 22:23 by Eugene — Categorized as: Standard Indicators

Syntax

public ROC(DataSeries source, int period, string description)
public static ROC Series(WealthLab.DataSeries source, int period)
public static double Value(int bar, DataSeries source, int period)

Parameter Description

source The source DataSeries
period Indicator calculation period

Description

The Rate of Change (ROC) indicator provides the percentage that the security's price has changed over the specified period. The Rate of Change shows the speed at which price changes from one period to another. Compare to Momentum. It gives a excellent indication of the market participants' commitment to the current trend. When the ROC begins to reverse or turn, it indicates diminishing commitment and a loss of momentum. ROC is a leading or coincidental indicator.

Like other momentum indicators, ROC has overbought and oversold zones. These zones are defined by lines that are placed so that ROC spends about 5% of its time within the zones. The lines should be adjusted according to market conditions.

Interpretation


Calculation

ROC is the percentage change between the current price with respect to an earlier price. Typically, the closing Price Series (Bars.Close) is used.

ROCbar = 100 * ( ( Pricebar / Pricebar - period ) - 1 ),

where bar is the current Bar. For example, if the current price is 77 and the previous price were 70, ROC = 100 * (( 77 / 70 ) - 1 ) = 10.0, which is the percentage change from 70.

Example

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

namespace WealthLab.Strategies { public class MyStrategy : WealthScript { protected override void Execute() { /* This system is based on a smoothed Rate of Change. Entry occurs when smoothed ROC rises above zero. The long Position is closed when the smoothed ROC turns down. */ DataSeries roc = ROC.Series( Close, 40 ); DataSeries SMARoc = SMA.Series( roc, 14 ); ChartPane ROCPane = CreatePane( 35, true, true ); PlotSeries( ROCPane, roc, Color.DarkBlue, WealthLab.LineStyle.Histogram, 3 ); PlotSeries( ROCPane, SMARoc, Color.Black, WealthLab.LineStyle.Dotted, 2 ); for(int bar = 54; bar < Bars.Count; bar++) { if (IsLastPositionActive) { if( TurnDown( bar, SMARoc ) ) SellAtMarket( bar+1, LastPosition ); } else { if( CrossOver( bar, SMARoc, 0 ) ) BuyAtMarket( bar+1 );

} } } } }