CMOabsav.efs
File Name: CMOabsav.efs
Description:
CMOabsav
Formula Parameters:
- Length1 : 5
- Length2 : 10
- Length3 : 20
- TopBand : 70
- LowBand : 20
Notes:
This indicator plots the absolute value of CMO averaged over three different lengths. This indicator plots a classical-looking oscillator, which is really an averaged value based on three different periods.
Download File:
CMOabsav.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: CMOabsav Version: 1.0 04/06/2009 Formula Parameters: Default: Length1 5 Length2 10 Length3 20 TopBand 70 LowBand 20 Notes: This indicator plots the absolute value of CMO averaged over three different lengths. This indicator plots a classical-looking oscillator, which is really an averaged value based on three different periods. **********************************/ var fpArray = new Array(); var bInit = false; function preMain() { setPriceStudy(false); setStudyTitle("CMOabsav"); setCursorLabelName("CMOabsav", 0); setDefaultBarFgColor(Color.blue, 0); setStudyMax(101); setStudyMin( - 1); var x = 0; fpArray[x] = new FunctionParameter("Length1", FunctionParameter.NUMBER); with(fpArray[x++]) { setLowerLimit(1); setDefault(5); } fpArray[x] = new FunctionParameter("Length2", FunctionParameter.NUMBER); with(fpArray[x++]) { setLowerLimit(1); setDefault(10); } fpArray[x] = new FunctionParameter("Length3", FunctionParameter.NUMBER); with(fpArray[x++]) { setLowerLimit(1); setDefault(20); } fpArray[x] = new FunctionParameter("TopBand", FunctionParameter.NUMBER); with(fpArray[x++]) { setLowerLimit(1); setDefault(70); } fpArray[x] = new FunctionParameter("LowBand", FunctionParameter.NUMBER); with(fpArray[x++]) { setLowerLimit(1); setDefault(20); } } var xCMOabsav = null; function main(Length1, Length2, Length3, TopBand, LowBand) { var nBarState = getBarState(); var nCMOabsav = 0; if (nBarState == BARSTATE_ALLBARS) { if (Length1 == null) Length1 = 5; if (Length2 == null) Length2 = 10; if (Length3 == null) Length3 = 20; if (TopBand == null) TopBand = 70; if (LowBand == null) LowBand = 20; } if (bInit == false) { xCMOabsav = efsInternal("Calc_CMO", Length1, Length2, Length3); addBand(TopBand, PS_SOLID, 1, Color.red, "TopBand"); addBand(LowBand, PS_SOLID, 1, Color.brown, "LowBand"); addBand(0, PS_SOLID, 1, Color.green, "ZeroLine"); bInit = true; } nCMOabsav = xCMOabsav.getValue(0); if (nCMOabsav == null) { return; } return nCMOabsav; } var xSecondInit = false; var xMOM = null; var xMOMAbs = null; function Calc_CMO(Length1, Length2, Length3) { var nRes = 0; var nMaxLen = 0; var i = 0; var nPrice = 0; var nPriceAbs = 0; var nSum1 = 0; var nSum2 = 0; var nSum3 = 0; var naSum1 = 0; var naSum2 = 0; var naSum3 = 0; if (xSecondInit == false) { xMOM = efsInternal("Calc_Price"); xMOMAbs = getSeries(xMOM, 1); xSecondInit = true } nMaxLen = Math.max(Length1, Length2); nMaxLen = Math.max(nMaxLen, Length3); for (i = 0; i < nMaxLen; i++) { nPrice = xMOM.getValue( - i); nPriceAbs = xMOMAbs.getValue( - i); if (i < Length1) { nSum1 += nPrice; naSum1 += nPriceAbs; } if (i < Length2) { nSum2 += nPrice; naSum2 += nPriceAbs; } if (i < Length3) { nSum3 += nPrice; naSum3 += nPriceAbs; } } nRes = Math.abs(100 * (nSum1 / naSum1 + nSum2 / naSum2 + nSum3 / naSum3) / 3); if (nRes == null) { return; } return nRes; } var yMOM = null; function Calc_Price() { var nPrice = 0; if (yMOM == null) { yMOM = mom(1); } nPrice = yMOM.getValue(0); return new Array(nPrice, Math.abs(nPrice)); }