RateOfChange (Function)
The RateOfChange function returns the Rate of Change calculation for the current bar.
Syntax
RateOfChange(Price, Length)
Returns (Double)
A numeric value containing ROC for the current bar.
Parameters
Name |
Type |
Description |
Price |
Numeric |
Specifies which bar value (price, function, or formula) to be considered. |
Length |
Numeric |
Sets the number of bars to be considered. |
Remarks
RateOfChange is calculated using the division method. The equivalent of the subtraction method is found in the function Momentum.
ROC = ((Price/Pricep) -1)*100
…where
Price = Current value (that is, Close, High, Low, and so on)
Pricep= Previous value (determined by the value returned for the input Length)
The input Price, is usually hard coded with some bar attribute such as Close, Open, High, Low, and Volume or is replaced with a numeric series type input. However, it can be replaced with a valid EasyLanguage expression. For example: Close + Open, or Average(RSI(Close,14),14).
Example
Value1 = RateOfChange(Close,20);
Reference
P.J. Kaufman, The New Commodity Trading Systems & Methods.