Advance-Decline Line

ICE Data Services -


AdvanceDeclineLine.efs  EFSLibrary - Discussion Board
  

File Name: AdvanceDeclineLine.efs


Description:
Advance-Decline Line


Formula Parameters:
Exchange : NYSE

Notes:

Download File:
AdvanceDeclineLine.efs




EFS 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:            Advance-Decline Line    Version:            1.0  07/06/2009    Formula Parameters:                     Default:    Exchange                            NYSENotes:**********************************/var fpArray = new Array();var bInit = false;function preMain(){    setPriceStudy(false);    setStudyTitle("Advance-Decline Line");    setCursorLabelName("AdvDecLine");        var x=0;    fpArray[x] = new FunctionParameter("sExchange", FunctionParameter.STRING);	with(fpArray[x++]){        setName("Exchange");        addOption("NYSE");         addOption("NASDAQ");                 setDefault("NYSE");    }}var xAdvDecL = null;function main(sExchange){var nBarState = getBarState();    if (nBarState == BARSTATE_ALLBARS) {        if (sExchange == null) sExchange = "NYSE";    }    if(!bInit){        xAdvDecL = efsInternal("Calc_AdvDec", sExchange);    }    return xAdvDecL.getValue(0);}var xAdvDec = null;function Calc_AdvDec(_exchange){    if(getBarState() == BARSTATE_ALLBARS){        if(_exchange == "NYSE"){            xAdvDec = close(sym("$ADD"));        }else if(_exchange == "NASDAQ"){            xAdvDec = close(sym("$ADDQ"));        }    }    if(xAdvDec.getValue(-2) == null) return;    if(getCurrentBarCount() > 1) var nRef = ref(-1);    var CumAdvDec = nRef + xAdvDec.getValue(0);    return CumAdvDec;}