# 2007 Apr: Two-Point Problem of the Rate of Change

ICE Data Services -

EFSLibrary - Discussion Board

Description:
This study is based on the April 2007 article, Two-Point Problem of the Rate of Change, by Martti Luoma and Jussi Nikkinen.

Formula Parameters:

• Periods: 21

Notes:
The related article is copyrighted material. If you are not a subscriber of Stocks & Commodities, please visit www.traders.com.

EFS Code:

```/***************************************
Provided By : eSignal (c) Copyright 2007
Description:  Two-Point Problem of the Rate of Change
by Martti Luoma and Jussi Nikkinen

Version 1.0  2/05/2007

Notes:
* April 2007 Issue of Stocks and Commodities Magazine
* Study requires version 8.0 or later.

Formula Parameters:                     Default:
Periods                                 21
*****************************************************************/

function preMain() {
setDefaultBarFgColor(Color.red, 0);
setDefaultBarThickness(2, 0);

var fp1 = new FunctionParameter("Periods", FunctionParameter.NUMBER);
fp1.setName("Periods");
fp1.setLowerLimit(1);
fp1.setDefault(21);
}

// Global Variables
var bVersion  = null;    // Version flag
var bInit     = false;   // Initialization flag

function main(Periods) {
if (bVersion == null) bVersion = verify();
if (bVersion == false) return;

//Initialization
if (bInit == false) {
bInit = true;
}

}

var xEMA = null;

if (bInit == false) {
xEMA = ema(nP, roc(1));
bInit = true;
}

var nEMA = xEMA.getValue(0);
if (nEMA == null) return;

return (nEMA * nP);
}

function verify() {
var b = false;
if (getBuildNumber() < 779) {
drawTextAbsolute(5, 35, "This study requires version 8.0 or later.",
Color.white, Color.blue, Text.RELATIVETOBOTTOM|Text.RELATIVETOLEFT|Text.BOLD|Text.LEFT,
null, 13, "error");