BWI

ICE Data Services -

BWI.efs  
EFSLibrary - Discussion Board  

File Name: BWI.efs

Description:
BWI

Formula Parameters:

  • Length: 21
  • StdDev: 2
  • Line Thickness: 2
  • Line Color: Green
  • Display Cursor Labels: True

Notes:

Download File:
BWI.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:        
    BWI

Version:            1.0  10/31/2008

Notes:

Formula Parameters:                     Default:
    Length                              21
    StdDev                              2
    Line Thickness                      2
    Line Color                          Green
    Display Cursor Labels               True
**********************************/

var fpArray = new Array();
var bInit = false;

function preMain() {
    setPriceStudy(false);
    setShowCursorLabel(false);
    setShowTitleParameters( false );
    
    setStudyTitle("BWI");
    setCursorLabelName("BWI", 0);

    setDefaultBarFgColor(Color.green, 0);
    setPlotType(PLOTTYPE_LINE, 0); 
    setDefaultBarThickness(2, 0);
   
    askForInput();
    var x=0;
    fpArray[x] = new FunctionParameter("LineColor", FunctionParameter.COLOR);
    with(fpArray[x++]){
        setName("Line Color");
        setDefault(Color.green);
    }    

    fpArray[x] = new FunctionParameter("ViewValue", FunctionParameter.BOOLEAN);
    with(fpArray[x++]){
        setName("Display Cursor Labels");
        setDefault(true);
    }    
    
    fpArray[x] = new FunctionParameter("Length", FunctionParameter.NUMBER);
	with(fpArray[x++]){
        setLowerLimit(1);		
        setDefault(21);
    }

    fpArray[x] = new FunctionParameter("StdDev", FunctionParameter.NUMBER);
	with(fpArray[x++]){
        setLowerLimit(1);		
        setDefault(2);
    }

    fpArray[x] = new FunctionParameter("Thickness", FunctionParameter.NUMBER);
	with(fpArray[x++]){
        setName("Line Thickness");
        setLowerLimit(1);		
        setDefault(2);
    }
}

var xUpperBB = null;
var xLowerBB = null;
var xMidBB  = null;

function main(Length, StdDev, Thickness, LineColor, ViewValue) {
var nBWI = 0;
    if ( bInit == false ) { 
        setDefaultBarFgColor(LineColor, 0);
        setDefaultBarThickness(Thickness, 0);
        setShowCursorLabel(ViewValue);        
        xUpperBB = upperBB(Length, StdDev);
        xLowerBB = lowerBB(Length, StdDev);
        xMidBB  =  middleBB(Length, StdDev);
        bInit = true; 
    } 

    if (getCurrentBarCount() < Length) return;

    nBWI = ((xUpperBB.getValue(0) - xLowerBB.getValue(0)) / xMidBB.getValue(0))*100;
 
    return nBWI; 
}