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

ICE Data Services -


MHL_MA.efs  EFSLibrary - Discussion Board
  

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




EFS 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 responsiblefor 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 ApirineVersion:            1.00  06/09/2016Formula Parameters:                     Default:Lookback                                15Avg Length                              35Smoothing                               smaShow Average                            trueNotes:The related article is copyrighted material. If you are not a subscriberof 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 x = 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(Lookback, AvgLength, Smoothing, isPlot){    if (bVersion == null) bVersion = verify();    if (bVersion == false) return;        if (getBarState() == BARSTATE_ALLBARS){        bInit = false;    }        if(!bInit){        xMA = eval(Smoothing)(AvgLength, middleDonchian(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 b = false;    if (getBuildNumber() < 719){                drawTextAbsolute(5, 35, "This study requires version 10.6 or later.",             Color.white, Color.blue, Text.RELATIVETOBOTTOM|Text.RELATIVETOLEFT|Text.BOLD|Text.LEFT,            null, 13, "error");        drawTextAbsolute(5, 20, "Click HERE to upgrade.@URL=http://www.esignal.com/download/default.asp",             Color.white, Color.blue, Text.RELATIVETOBOTTOM|Text.RELATIVETOLEFT|Text.BOLD|Text.LEFT,            null, 13, "upgrade");        return b;    }     else        b = true;        return b;}