MAofROC.efs

ICE Data Services -


MAofROC.efs 
  

File Name: MAofROC.efs


Description:
Moving Average of Rate of Change oscillator.


Formula Parameters:
rocLength: Default is 21

rocPriceSource: Default is "Close"
valid inputs: Open, High, Low, Close, HL/2, HLC/3 and OHLC/4

Notes:
NA

Download File:
MAofROC.efs




EFS Code:



/*********************************Provided By : eSignal. (c) Copyright 2003*********************************/function preMain() {    setStudyTitle("Moving Average of ROC");    setCursorLabelName("MA", 0);    setCursorLabelName("ROC", 1);    setDefaultBarFgColor(Color.red, 0);    setDefaultBarFgColor(Color.blue, 1);    setPlotType(PLOTTYPE_HISTOGRAM, 1);    setDefaultBarThickness(3, 1);}var MAstudy = null;var ROCstudy = null;function main(rocLength, rocPriceSource, maLength, maOffset, maType) {	if (MAstudy == null || ROCstudy == null) {		//check for valid inputs		if (rocLength == null)			rocLength = 21;		if (rocPriceSource == null) {			rocPriceSource = "Close";		} else if(rocPriceSource == "C" || rocPriceSource == "O" || rocPriceSource == "H" || rocPriceSource == "L") {			rocPriceSource = rocPriceSource;		} else if(rocPriceSource == "Close" || rocPriceSource == "Open" || rocPriceSource == "High" || rocPriceSource == "Low") {			rocPriceSource = rocPriceSource;		} else if(rocPriceSource == "HL/2" || rocPriceSource == "HLC/3" || rocPriceSource == "OHLC/4") {            rocPriceSource = rocPriceSource;		} else {			rocPriceSource = "Close";		}		ROCstudy = new ROCStudy(rocLength, rocPriceSource);		if (maLength == null)			maLength = 18;		if (maOffset == null) {			maOffset = 0;        } else {            maOffset = Math.round(maOffset);        }		if (maType == null) {			maType = "MAStudy.SIMPLE";		} else if(maType == "MAStudy.EXPONENTIAL" || maType == "MAStudy.SIMPLE" || maType == "MAStudy.WEIGHTED" || maType == "MAStudy.VOLUMEWEIGHTED") {			maType = maType;		} else {			maType = "MAStudy.SIMPLE";		}		MAstudy = new MAStudy(maLength, maOffset, ROCstudy, ROCStudy.ROC, eval(maType));	}        var vMA = MAstudy.getValue(MAStudy.MA);    var vROC = ROCstudy.getValue(ROCStudy.ROC);    return new Array (vMA, vROC);}