2008 July: Leader of the MACD

ICE Data Services -


MACD_Leader.efs  EFSLibrary - Discussion Board
  

File Name: MACD_Leader.efs


Description:
The following study is based on the July 2008 article, Leader of the MACD, by Giorgos E. Siligardos, PhD.


Formula Parameters:
NA

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

Download File:
MACD_Leader.efs




EFS Code:

/*********************************Provided By:      eSignal (Copyright ) eSignal), a division of Interactive Data     Corporation. 2007. 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:        Leader of the MACD                    by Giorgos E. Siligardos, PhDVersion:            1.0  5/13/2008Notes:* July 2008 Issue of Stocks and Commodities Magazine* Study requires version 8.0 or later.**********************************/function preMain(){    setStudyTitle("MACD Leader");    setPriceStudy(false);    setCursorLabelName("Leader");}var bVersion    = null;var bInit = false;var xMACDLeader = null;function main(){    if (bVersion == null) bVersion = verify();    if (bVersion == false) return;        if(bInit == false){        xMACDLeader = efsInternal("Calc");        bInit = true;    }        var nMACDLeader = xMACDLeader.getValue(0);        if(nMACDLeader==null) return;        return nMACDLeader;}var xInit = false;var xMACDSig1 = null;var xMACDSig2 = null;var xEMA1 = null;var xEMA2 = null;function Calc(){    if(xInit==false){        xMACDSig1 = macdSignal(1,12,12);        xMACDSig2 = macdSignal(1,26,26);        xEMA1 = ema(12);        xEMA2 = ema(26);        xInit = true;    }        var nMACDSig1 = xMACDSig1.getValue(0);    var nMACDSig2 = xMACDSig2.getValue(0);    var nEMA1 = xEMA1.getValue(0);    var nEMA2 = xEMA2.getValue(0);        if(nMACDSig1==null || nMACDSig2==null || nEMA1==null || nEMA2==null) return;        var Indicator1 = nEMA1+nMACDSig1;    var Indicator2 = nEMA2+nMACDSig2;        return Indicator1-Indicator2;}function verify() {    var b = false;    if (getBuildNumber() < 779) {        drawTextAbsolute(5, 35, "This study requires version 8.0 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;}