MRO.efs
EFSLibrary - Discussion Board
File Name: MRO.efs
Description:
Momentum Range Oscillator
Formula Parameters:
- Length : 7
Notes:
Download File:
MRO.efs
EFS Code:
/********************************* Provided By: eSignal (Copyright c eSignal), a division of Interactive Data Corporation. 2009. All rights reserved. This sample eSignal Formula Script (EFS) is for educational purposes only and may be modified and saved under a new file name. eSignal is not responsible for the functionality once modified. eSignal reserves the right to modify and overwrite this EFS file with each new release. Description: Momentum Range Oscillator Version: 1.0 09/30/2009 Formula Parameters: Default: Length 7 Notes: **********************************/ var fpArray = new Array(); var bInit = false; function preMain(){ setPriceStudy(false); setShowCursorLabel(true); setShowTitleParameters(false); setStudyTitle("MRO"); setCursorLabelName("MRO", 0); setPlotType(PLOTTYPE_LINE, 0); setDefaultBarFgColor(Color.red, 0); var x = 0; fpArray[x] = new FunctionParameter("Length", FunctionParameter.NUMBER); with(fpArray[x++]) { setLowerLimit(1); setDefault(7); } } var xMRO = null; function main(Length) { var nBarState = getBarState(); var nMRO = 0; if (nBarState == BARSTATE_ALLBARS) { if(Length == null) Length = 7; } if (bInit == false) { xMRO = efsInternal("Calc_MRO", Length); bInit = true; } nMRO = xMRO.getValue(0); if (nMRO == null) return; return nMRO; } var bSecondInit = false; var xMOM = null; var xHLabsMA = null; function Calc_MRO(Length) { var nRes = 0; if (!bSecondInit) { xMOM = mom(3); xHLabsMA = sma(Length, efsInternal("Calc_HLabs")); bSecondInit = true; } nRes = xHLabsMA.getValue(0); if (nRes == null) return; nRes = Math.abs(xMOM.getValue(-1)) / nRes; return nRes; } function Calc_HLabs() { var nRes = 0; nRes = Math.abs(high(0) - low(0)); return nRes; }