High - EMA

ICE Data Services -


High_ema.efs  EFSLibrary - Discussion Board
  

File Name: High_ema.efs


Description:
High - EMA indicator.


Formula Parameters:
Length: 13
Price Data To Use: Close

Notes:
This indicator plots the difference between the High (of the previous period)
and an exponential moving average (13 period) of the Close (of the previous period).

Download File:
High_ema.efs




EFS 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:            High - EMAVersion:            1.0  09/23/2008Notes:    This indicator plots the difference between the High (of the previous period)    and an exponential moving average (13 period) of the Close (of the previous period).    Formula Parameters:                     Default:    Length                                  13    Price Data To Use                      Close**********************************/var fpArray = new Array();var bInit = false;function preMain(){    setStudyTitle("High - EMA");    setCursorLabelName("High - EMA", 0);    setDefaultBarFgColor(Color.blue, 0);    setPlotType(PLOTTYPE_LINE,0);    setDefaultBarThickness(1,0);        addBand(0, PS_SOLID, 1, Color.black);        var x=0;    fpArray[x] = new FunctionParameter("Length", FunctionParameter.NUMBER);	with(fpArray[x++]){        setLowerLimit(1);		        setDefault(13);    }    fpArray[x] = new FunctionParameter("Price", FunctionParameter.STRING);    with(fpArray[x++]){        setName("Price Data To Use");        addOption("open");         addOption("high");        addOption("low");        addOption("close");        addOption("hl2");        addOption("hlc3");        addOption("ohlc4");         setDefault("close");     }}var xEMA = null;var xMyPrice = null;var xHigh_EMA = null;function main(Length, Price) {var nHigh_EMA = 0;    if (Length == null) Length = 13;    if(Price == null) Price= "close";    if ( bInit == false ) {         xMyPrice = eval(Price)();        xEMA = ema(Length, xMyPrice);        xHigh_EMA = efsInternal("Calc_xHigh_EMA", xEMA);        bInit = true;     }     nHigh_EMA = xHigh_EMA.getValue(0);    return nHigh_EMA;}function Calc_xHigh_EMA(xEMA) {var nRes = 0    if (xEMA.getValue(-1) == null ) return;    nRes = high(-1) - xEMA.getValue(-1);    if (nRes == null) nRes = 1;    return nRes;}