CMO Filt

ICE Data Services -


CMOfilt.efs  EFSLibrary - Discussion Board
  

File Name: CMOfilt.efs


Description:
CMOfilt


Formula Parameters:
Length3 : 9
Filter : 3
TopBand : 70
LowBand : -70

Notes:
This indicator plots a CMO which ignores price changes which are less
than a threshold value. 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:
CMOfilt.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:            CMOfilt  Version:            1.0  03/31/2009Formula Parameters:                     Default:    Length3                             9    Filter                              3    TopBand                             70    LowBand                             -70Notes:    This indicator plots a CMO which ignores price changes which are less     than a threshold value. 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() {    setStudyTitle("CMOfilt");    setCursorLabelName("CMOfilt", 0);    setDefaultBarFgColor(Color.blue, 0);    setStudyMax(101);    setStudyMin(-101);    var x = 0;    fpArray[x] = new FunctionParameter("Length", FunctionParameter.NUMBER);    with(fpArray[x++]) {        setLowerLimit(1);        setDefault(9);    }    fpArray[x] = new FunctionParameter("Filter", FunctionParameter.NUMBER);    with(fpArray[x++]) {        setLowerLimit(0);        setDefault(3);    }    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( - 101);        setDefault( - 70);    }}var xCMOfilt = null;function main(Length, Filter, TopBand, LowBand) {    var nBarState = getBarState();    var nCMOfilt = 0;    if (nBarState == BARSTATE_ALLBARS) {        if (Length == null) Length = 9;        if (Filter == null) Filter = 3;        if (TopBand == null) TopBand = 70;        if (LowBand == null) LowBand = -70;    }    if (bInit == false) {        xCMOfilt = efsInternal("Calc_CMO", Length, Filter);        addBand(TopBand, PS_SOLID, 1, Color.red, "TopBand");        addBand(LowBand, PS_SOLID, 1, Color.green, "LowBand");        addBand(0, PS_SOLID, 1, Color.grey, "ZeroLine");        bInit = true;    }    nCMOfilt = xCMOfilt.getValue(0);    if (nCMOfilt == null) {        return;    }    return nCMOfilt;}var xSecondInit = false;var xMOM = null;var xMOMAbs = null;function Calc_CMO(nLength, nFilter) {    var nRes = 0;    var i = 0;    var nPrice = 0;    var nPriceAbs = 0;    var nSum = 0;    var naSum = 0;    if (xSecondInit == false) {        xMOM = efsInternal("Calc_Price");        xMOMAbs = getSeries(xMOM, 1);        xSecondInit = true    }    for (i = 0; i < nLength; i++) {        nPrice = xMOM.getValue( - i);        nPriceAbs = xMOMAbs.getValue( - i);        if (nPriceAbs > nFilter) {            nSum += nPrice;            naSum += nPriceAbs;        }    }    if (naSum != 0) {        nRes = 100 * nSum / naSum;    } else {        nRes = 0;    }    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));}