Announcement

Collapse
No announcement yet.

Cmo & Wma

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

  • Cmo & Wma

    File Name: CMO_WMA.efs

    Description:
    CMO & WMA

    Formula Parameters:
    LenCMO : 9
    LenAvg : 9


    Notes:
    This indicator plots Chandre Momentum Oscillator and its WMA on the
    same chart. 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_WMA.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:        
        CMO & WMA

    Version:            1.0  03/27/2009

    Formula Parameters:                     Default:
        LenCMO                              9
        LenAvg                              9

    Notes:
        This indicator plots Chandre Momentum Oscillator and its WMA on the 
        same chart. 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 & WMA");
        
    setCursorLabelName("CMO"0);
        
    setCursorLabelName("WAvg"1);
        
    setDefaultBarFgColor(Color.blue0);
        
    setDefaultBarFgColor(Color.red1);
        
    addBand(0PS_SOLID1Color.brown);    
        
    setStudyMax(101);
        
    setStudyMin(-101);
        var 
    x=0;
        
    fpArray[x] = new FunctionParameter("LenCMO"FunctionParameter.NUMBER);
        
    with(fpArray[x++]){
            
    setLowerLimit(1);        
            
    setDefault(9);
        }
        
    fpArray[x] = new FunctionParameter("LenAvg"FunctionParameter.NUMBER);
        
    with(fpArray[x++]){
            
    setLowerLimit(1);        
            
    setDefault(9);
        }   
    }

    var 
    xCMO null
    var xCMO_WMA null;

    function 
    main(LenCMOLenAvg) {
    var 
    nBarState getBarState();
    var 
    nCMO 0;
    var 
    nCMOavg 0;

        if (
    nBarState == BARSTATE_ALLBARS) {
            if (
    LenCMO == nullLenCMO 9;
            if (
    LenAvg == nullLenAvg 9;
        }    
       
        if (
    bInit == false) {
            
    xCMO efsInternal("Calc_CMO"LenCMO);
            
    xCMO_WMA wma(LenAvgxCMO);
            
    bInit true;
        }

        
    nCMO xCMO.getValue(0);
        
    nCMOavg xCMO_WMA.getValue(0);
        if (
    nCMOavg == null) return;
        return new Array(
    nCMOnCMOavg);
    }

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

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

    var 
    yMOM null;

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

Working...
X