Announcement

Collapse
No announcement yet.

CMO Filt

Collapse
This topic is closed.
X
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • CMO Filt

    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:
    PHP 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/2009

    Formula Parameters:                     Default:
        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.
    **********************************/

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

    function 
    preMain() {
        
    setStudyTitle("CMOfilt");
        
    setCursorLabelName("CMOfilt"0);
        
    setDefaultBarFgColor(Color.blue0);
        
    setStudyMax(101);
        
    setStudyMin(-101);
        var 
    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(LengthFilterTopBandLowBand) {
        var 
    nBarState getBarState();
        var 
    nCMOfilt 0;
        if (
    nBarState == BARSTATE_ALLBARS) {
            if (
    Length == nullLength 9;
            if (
    Filter == nullFilter 3;
            if (
    TopBand == nullTopBand 70;
            if (
    LowBand == nullLowBand = -70;
        }
        if (
    bInit == false) {
            
    xCMOfilt efsInternal("Calc_CMO"LengthFilter);
            
    addBand(TopBandPS_SOLID1Color.red"TopBand");
            
    addBand(LowBandPS_SOLID1Color.green"LowBand");
            
    addBand(0PS_SOLID1Color.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(nLengthnFilter) {
        var 
    nRes 0;
        var 
    0;
        var 
    nPrice 0;
        var 
    nPriceAbs 0;
        var 
    nSum 0;
        var 
    naSum 0;
        if (
    xSecondInit == false) {
            
    xMOM efsInternal("Calc_Price");
            
    xMOMAbs getSeries(xMOM1);
            
    xSecondInit true
        
    }
        for (
    0nLengthi++) {
            
    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(
    nPriceMath.abs(nPrice));

Working...
X