Announcement

Collapse
No announcement yet.

2016 Aug: The Middle-High-Low Moving Average by Vitali Apirine

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

  • 2016 Aug: The Middle-High-Low Moving Average by Vitali Apirine

    File Name: MHL_MA.efs

    Description:
    The Middle-High-Low Moving Average by Vitali Apirine

    Formula Parameters:

    MHL_MA.efs
    Lookback: 15
    Avg Length: 35
    Smoothing: sma
    Show Average: true

    Notes:
    The related article is copyrighted material. If you are not a subscriber
    of Stocks & Commodities, please visit www.traders.com.

    Download File:
    MHL_MA.efs

    MHL_MA.efs


    EFS Code:
    PHP Code:
    /*********************************
    Provided By:  
    eSignal (Copyright c eSignal), a division of Interactive Data 
    Corporation. 2016. 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:        
        The Middle-High-Low Moving Average by Vitali Apirine

    Version:            1.00  06/09/2016

    Formula Parameters:                     Default:
    Lookback                                15
    Avg Length                              35
    Smoothing                               sma
    Show Average                            true



    Notes:
    The related article is copyrighted material. If you are not a subscriber
    of Stocks & Commodities, please visit www.traders.com.

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

    var fpArray = new Array();

    function 
    preMain(){
        
    setPriceStudy(true);
        
    setStudyTitle("MHL");
        
    setCursorLabelName("MHL",0);
        
    setCursorLabelName("MA",1);
        
    setDefaultBarFgColor(Color.RGB(0,148,255), 0);
        
    setDefaultBarFgColor(Color.RGB(255,155,0), 1);
        
        var 
    0;
        
    fpArray[x] = new FunctionParameter("Lookback"FunctionParameter.NUMBER)
            
    with(fpArray[x++]){
            
    setName("Lookback");
            
    setDefault(15);
            
    setLowerLimit(1);
        }

        
    fpArray[x] = new FunctionParameter("AvgLength"FunctionParameter.NUMBER)
            
    with(fpArray[x++]){
            
    setName("Avg Length");
            
    setDefault(35);
            
    setLowerLimit(1);
        }

        
    fpArray[x] = new FunctionParameter("Smoothing"FunctionParameter.STRING)
            
    with(fpArray[x++]){
            
    setName("Smoothing");
            
    addOption("sma");
            
    addOption("ema");
            
    setDefault("sma");
        }

        
    fpArray[x] = new FunctionParameter("isPlot"FunctionParameter.BOOLEAN)
            
    with(fpArray[x++]){
            
    setName("Show Average");
            
    setDefault(true);
        }
    }

    var 
    bVersion null;
    var 
    bInit false;
    var 
    xMA null;
    var 
    xBaseMA null;

    function 
    main(LookbackAvgLengthSmoothingisPlot){
        if (
    bVersion == nullbVersion verify();
        if (
    bVersion == false) return;
        
        if (
    getBarState() == BARSTATE_ALLBARS){
            
    bInit false;
        }
        
        if(!
    bInit){
            
    xMA = eval(Smoothing)(AvgLengthmiddleDonchian(Lookback)); 
            
    xBaseMA = eval(Smoothing)(AvgLength);
            
    bInit true;
        }

        if (
    xMA.getValue(0) != null){
            if (
    isPlot) return [xMA.getValue(0), xBaseMA.getValue(0)];
            else return 
    xMA.getValue(0);
        }
    }

    function 
    verify(){
        var 
    false;
        if (
    getBuildNumber() < 719){
            
            
    drawTextAbsolute(535"This study requires version 10.6 or later."
                
    Color.whiteColor.blueText.RELATIVETOBOTTOM|Text.RELATIVETOLEFT|Text.BOLD|Text.LEFT,
                
    null13"error");
            
    drawTextAbsolute(520"Click HERE to upgrade.@URL=http://www.esignal.com/download/default.asp"
                
    Color.whiteColor.blueText.RELATIVETOBOTTOM|Text.RELATIVETOLEFT|Text.BOLD|Text.LEFT,
                
    null13"upgrade");
            return 
    b;
        } 
        else
            
    true;
        
        return 
    b;

Working...
X