Announcement

Collapse
No announcement yet.

Ergotic MDI (Mean Deviation Indicator)

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

  • Ergotic MDI (Mean Deviation Indicator)

    File Name: Ergotic_MDI.efs

    Description:
    Ergotic MDI (Mean Deviation Indicator)

    Formula Parameters:
    r : 32
    s : 5
    u : 5


    Notes:
    This is one of the techniques described by William Blau in his book "Momentum,
    Direction and Divergence" (1995). If you like to learn more, we advise you to
    read this book. His book focuses on three key aspects of trading: momentum,
    direction and divergence. Blau, who was an electrical engineer before becoming
    a trader, thoroughly examines the relationship between price and momentum in
    step-by-step examples. From this grounding, he then looks at the deficiencies
    in other oscillators and introduces some innovative techniques, including a
    fresh twist on Stochastics. On directional issues, he analyzes the intricacies
    of ADX and offers a unique approach to help define trending and non-trending periods.


    Download File:
    Ergotic_MDI.efs



    EFS Code:
    PHP Code:
    /*********************************
    Provided By:  
        eSignal (Copyright c eSignal), a division of Interactive Data 
        Corporation. 2008. 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:        
        Ergotic MDI (Mean Deviation Indicator)
        
    Version:            1.0  01/12/2009

    Formula Parameters:                     Default:
        r                                   32
        s                                   5    
        u                                   5    

    Notes:
        This is one of the techniques described by William Blau in his book "Momentum,
        Direction and Divergence" (1995). If you like to learn more, we advise you to
        read this book. His book focuses on three key aspects of trading: momentum, 
        direction and divergence. Blau, who was an electrical engineer before becoming 
        a trader, thoroughly examines the relationship between price and momentum in 
        step-by-step examples. From this grounding, he then looks at the deficiencies 
        in other oscillators and introduces some innovative techniques, including a 
        fresh twist on Stochastics. On directional issues, he analyzes the intricacies 
        of ADX and offers a unique approach to help define trending and non-trending periods.

    **********************************/

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

    function 
    preMain() {
        
    setStudyTitle("Ergotic_MDI (Mean Deviation Indicator)");
        
    setCursorLabelName("ErgMDI"0);
        
    setCursorLabelName("SigLin"1);
        
    setDefaultBarFgColor(Color.fushcia0);
        
    setDefaultBarFgColor(Color.grey1);
        
    addBand(0PS_SOLID1Color.blue);
        
        var 
    x=0;
        
    fpArray[x] = new FunctionParameter("r"FunctionParameter.NUMBER);
        
    with(fpArray[x++]){
            
    setLowerLimit(1);        
            
    setDefault(32);
        }

        
    fpArray[x] = new FunctionParameter("s"FunctionParameter.NUMBER);
        
    with(fpArray[x++]){
            
    setLowerLimit(1);        
            
    setDefault(5);
        }

        
    fpArray[x] = new FunctionParameter("u"FunctionParameter.NUMBER);
        
    with(fpArray[x++]){
            
    setLowerLimit(1);        
            
    setDefault(5);
        }
    }

    var 
    xSignal null;
    var 
    xEMA_R null;
    var 
    xEMA_S null;
    var 
    xEMA_U null;

    function 
    main(rsu) {
    var 
    nState getBarState();
    var 
    nMDI 0;
    var 
    nSignal 0;

        if (
    nState == BARSTATE_ALLBARS) {
            if (
    == null32;
            if (
    == null5;
            if (
    == null5;
        }

        if ( 
    bInit == false ) { 
            
    xEMA ema(r);
            
    xEMA_S efsInternal("Calc_EMA_S"xEMA);
            
    xEMA_U ema(uema(sxEMA_S));
            
    xSignal ema(uxEMA_U);
            
    bInit true
        } 

        
    nMDI xEMA_U.getValue(0);
        
    nSignal xSignal.getValue(0);
        
        if (
    nSignal == null || nMDI == null) return;

        return new Array(
    nMDInSignal);
    }

    function 
    Calc_EMA_S(xEMA) {
    var 
    nRes 0;
        if (
    xEMA.getValue(0) == null) return;
        
    nRes close(0) - xEMA.getValue(0);
        if (
    nRes == nullnRes 1;
        return 
    nRes;

Working...
X