Delta

ICE Data Services -

Delta.efs                                                                                                                             EFSLibrary - Discussion Board

File Name: Delta.efs


Description:
Delta

 

Formula Parameters:
Length Slow : 60
Length Fast : 13
Point : 0.0001

 

Notes:

Download File:
Delta.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:        
    Delta
Version:            1.0  09/15/2009
 
Formula Parameters:                     Default:
    Length Slow                         60    
    Length Fast                         13
    Point                               0.0001
   
Notes:
    
**********************************/
var fpArray = new Array();
var bInit = false;

function preMain(){
    setPriceStudy(false);
    setShowCursorLabel(false);
    setShowTitleParameters(false);
    setStudyTitle("Delta");
    setCursorLabelName("Slow", 0);
    setPlotType(PLOTTYPE_LINE, 0);
    setDefaultBarFgColor(Color.red, 0);
    setCursorLabelName("Fast", 1);
    setPlotType(PLOTTYPE_LINE, 1);
    setDefaultBarFgColor(Color.green, 1);
    var x = 0;
    fpArray[x] = new FunctionParameter("Sper", FunctionParameter.NUMBER);
    with(fpArray[x++]) {
        setName("Length Slow");
        setLowerLimit(1);
        setDefault(60);
    }    
    fpArray[x] = new FunctionParameter("Fper", FunctionParameter.NUMBER);
    with(fpArray[x++]) {
        setName("Length Fast");
        setLowerLimit(1);
        setDefault(13);
    }    
    fpArray[x] = new FunctionParameter("Point", FunctionParameter.NUMBER);
    with(fpArray[x++]) {
        setLowerLimit(0.000001);
        setDefault(0.0001);
    }        
}

var xFma = null;
var xSma = null;

function main(Sper, Fper, Point) {
var nBarState = getBarState();
var nFma = 0;
var nSma = 0;
var nSdel = 0;
var nFdel = 0;
var nClose = 0;
    if (nBarState == BARSTATE_ALLBARS) {
        if(Sper == null) Sper = 60;
        if(Fper == null) Fper = 13;
        if(Point == null) Point = 0.0001;
	}
	if (bInit == false) {
        xFma = ema(Fper);
        xSma = ema(Sper);
        bInit = true;
	}
	nFma = xFma.getValue(0);
	nSma = xSma.getValue(0);
	nClose = close(0);
    if (nSma == null) return;
    nFdel = Math.round((nFma - nClose) / Point);
    nSdel = Math.round((nSma - nClose) / Point);
    return new Array(nSdel, nFdel);
}