Adjusted_ROC.efs
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 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() { 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 Variables var bVersion = null; // Version flag var bInit = false; // Initialization flag var 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 globals var 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; }