CMO Abs

ICE Data Services -

CMO_Abs.efs  

EFSLibrary - Discussion Board  

File Name: CMO_Abs.efs

Description:
CMOabs

Formula Parameters:

  • Length : 9
  • TopBand : 70
  • LowBand : 20

Notes:
This indicator plots the absolute value of CMO. CMO was developed by Tushar Chande. A scientist, an inventor, and a respected trading system developer, Mr. Chande developed the CMO to capture what he calls "pure momentum". For more definitive information on the CMO and other indicators we recommend the book The New Technical Trader by Tushar Chande and Stanley Kroll.
The CMO is closely related to, yet unique from, other momentum oriented indicators such as Relative Strength Index, Stochastic, Rate-of-Change, etc. It is most closely related to Welles Wilder`s RSI, yet it differs in several ways:

  • It uses data for both up days and down days in the numerator, thereby directly measuring momentum;
  • The calculations are applied on unsmoothed data. Therefore, short-term extreme movements in price are not hidden. Once calculated, smoothing can be applied to the CMO, if desired;
  • The scale is bounded between +100 and -100, thereby allowing you to clearly see changes in net momentum using the 0 level. The bounded scale also allows you to conveniently compare values across different securities.

Download File:
CMO_Abs.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:        
    CMOabs 
 
Version:            1.0  03/27/2009

Formula Parameters:                     Default:
    Length                              9
    TopBand                             70
    LowBand                             20

Notes:
    This indicator plots the absolute value of CMO. CMO was developed by Tushar 
    Chande. A scientist, an inventor, and a respected trading system developer, 
    Mr. Chande developed the CMO to capture what he calls "pure momentum". For 
    more definitive information on the CMO and other indicators we recommend the 
    book The New Technical Trader by Tushar Chande and Stanley Kroll.
    The CMO is closely related to, yet unique from, other momentum oriented indicators 
    such as Relative Strength Index, Stochastic, Rate-of-Change, etc. It is most closely 
    related to Welles Wilder`s RSI, yet it differs in several ways:
        - It uses data for both up days and down days in the numerator, thereby directly 
          measuring momentum;
        - The calculations are applied on unsmoothed data. Therefore, short-term extreme 
          movements in price are not hidden. Once calculated, smoothing can be applied to 
          the CMO, if desired;
        - The scale is bounded between +100 and -100, thereby allowing you to clearly see 
          changes in net momentum using the 0 level. The bounded scale also allows you to 
          conveniently compare values across different securities.
**********************************/

var fpArray = new Array();
var bInit = false;

function preMain() {
    setPriceStudy(false);
    setStudyTitle("CMO (Chandre Momentum Oscillator)");
    setCursorLabelName("CMO", 0);
    setDefaultBarFgColor(Color.blue, 0);
    setStudyMax(101);
    setStudyMin(-1);
    var x=0;
    fpArray[x] = new FunctionParameter("Length", FunctionParameter.NUMBER);
	with(fpArray[x++]){
        setLowerLimit(1);		
        setDefault(9);
    }
    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(0);		
        setDefault(20);
    }
}

var xCMO = null

function main(Length, TopBand, LowBand) {
var nBarState = getBarState();
var nCMO = 0;

    if (nBarState == BARSTATE_ALLBARS) {
        if (Length == null) Length = 9;
        if (TopBand == null) TopBand = 70;
        if (LowBand == null) LowBand = 20;
    }    
    
    if (bInit == false) {
        xCMO = efsInternal("Calc_CMO", Length);
        addBand(TopBand, PS_SOLID, 1, Color.red, "TopBand");
        addBand(LowBand, PS_SOLID, 1, Color.brown, "LowBand");        
        bInit = true;
    }    
    
    nCMO = xCMO.getValue(0);
    if (nCMO == null) return;

    return nCMO;
}

var xSecondInit = false;
var xSMA = null;
var xMOM = null;

function Calc_CMO(LenCMO) {
var nRes = 0;
    if(xSecondInit == false){
        xSMA = sma(LenCMO, efsInternal("Calc_Price"));
        xMOM = mom(LenCMO);
        xSecondInit = true
    }
    var nSMA = xSMA.getValue(0);
    if (nSMA == null) return;
    nRes = Math.abs(100 * (xMOM.getValue(0) / (nSMA * LenCMO)));
    return nRes;    
}

var yMOM = null;

function Calc_Price(){
    if(yMOM==null) yMOM = mom(1);
    return Math.abs(yMOM.getValue(0));
}