Rate Of Change |
The Rate of Change (Roc) function measures rate of change relative to previous periods.The function is used to determine how rapidly the data is changing. The factor of 100 is usually used to merely make the numbers easier to interpret or graph. The function can be used to measure the Roc of any data series, such as price or another indicator.
The most popular way to use the indicator is as follows. When indicator is above the 0.5 line, it is a buy signal. If indicator crosses the 0.5 line from above it is a sell signal.
To initialize Roc indicator use one of the following constructors:
Roc – sets default values: period = 14
Roc(Int32) – sets value for period
Roc(TimeSpan) – sets time period
Use
ROC - property to get current value
1// Create new instance 2Roc roc = new Roc(28); 3 4// Number of stored values 5roc.HistoryCapacity = 2; 6 7// Add new data point 8roc.Add(CurrentPrice); 9 10// Get indicator value 11double IndicatorValue = roc.ROC; 12// Get previous value 13if (roc.HistoryCount == 2) 14{ 15 double IndicatorPrevValue = roc[1]; 16}