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

ICE Data Services -


Adjusted_ROC.efs  EFSLibrary - Discussion Board
  

File Name: Adjusted_ROC.efs


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.

Download File:
Adjusted_ROC.efs




EFS Code:

/***************************************Provided By : eSignal (c) Copyright 2007Description:  Two-Point Problem of the Rate of Change               by Martti Luoma and Jussi NikkinenVersion 1.0  2/05/2007Notes:* April 2007 Issue of Stocks and Commodities Magazine* Study requires version 8.0 or later.Formula Parameters:                     Default:Periods                                 21*****************************************************************/function preMain() {    setStudyTitle("Adjusted ROC ");    setCursorLabelName("AdjROC", 0);    setDefaultBarFgColor(Color.red, 0);    setDefaultBarThickness(2, 0);        var fp1 = new FunctionParameter("Periods", FunctionParameter.NUMBER);        fp1.setName("Periods");        fp1.setLowerLimit(1);        fp1.setDefault(21);}// Global Variablesvar bVersion  = null;    // Version flagvar bInit     = false;   // Initialization flagvar xAdjROC   = null;function main(Periods) {    if (bVersion == null) bVersion = verify();    if (bVersion == false) return;        //Initialization    if (bInit == false) {        xAdjROC = efsInternal("calcAdjROC", Periods);        bInit = true;    }        return xAdjROC.getValue(0);}// AdjROC globalsvar xEMA = null;function calcAdjROC(nP) {    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");        drawTextAbsolute(5, 20, "Click HERE to upgrade.@URL=http://www.esignal.com/download/default.asp",             Color.white, Color.blue, Text.RELATIVETOBOTTOM|Text.RELATIVETOLEFT|Text.BOLD|Text.LEFT,            null, 13, "upgrade");        return b;    } else {        b = true;    }        return b;}