Bull Power

ICE Data Services -

Bull_Power.efs  
EFSLibrary - Discussion Board  

File Name: Bull_Power.efs

Description:
Bull Power Indicator

Formula Parameters:

Notes:

Download File:
Bull_Power.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:        
    Bull Power Indicator 

Version:            1.0  10/15/2008

Notes:

Formula Parameters:                     Default:


**********************************/
function preMain(){
    setStudyTitle("BBB Bull Power");
    setCursorLabelName("Bull Power",0);
    setDefaultBarFgColor(Color.blue,0);
    setDefaultBarThickness(2);
}

var xOpen  = null;
var xHigh  = null;
var xLow   = null;
var xClose = null;
var bInit  = false;

function main(){
var value = 0;

    if(bInit == false){
        xOpen  = open();
        xHigh  = high();
        xLow   = low();
        xClose = close();
        bInit = true;
    }

    var nOpen_0  = xOpen.getValue(0);
    var nClose_0 = xClose.getValue(0);
    var nClose_1 = xClose.getValue(-1);
    var nHigh_0  = xHigh.getValue(0);
    var nLow_0   = xLow.getValue(0);

    if(nClose_1 == null) return;

    if(nClose_0 < nOpen_0) 
        if(nClose_1 < nOpen_0) 
            value = Math.max(nHigh_0 - nClose_1, nClose_0 - nLow_0); 
        else  
            value = Math.max(nHigh_0 - nOpen_0, nClose_0 - nLow_0); 
    else 
        if (nClose_0 > nOpen_0)
            if(nClose_1 > nOpen_0)  
                value = nHigh_0 - nLow_0;  
            else
                value = Math.max(nOpen_0 - nClose_1,nHigh_0 - nLow_0); 
        else 
            if(nHigh_0 - nClose_0 > nClose_0 - nLow_0)
                if(nClose_1 < nOpen_0)  
                    value = Math.max(nHigh_0 - nClose_1,nClose_0 - nLow_0);  
                else 
                    value = nHigh_0 - nOpen_0;
            else 
                if(nHigh_0 - nClose_0 < nClose_0 - nLow_0)
                    if(nClose_1 > nOpen_0)
                        value = nHigh_0 - nLow_0;  
                    else   
                        value = Math.max(nOpen_0 - nClose_1,nHigh_0 - nLow_0); 
                else
                    if(nClose_1 > nOpen_0) 
                        value = Math.max(nHigh_0 - nOpen_0,nClose_0 - nLow_0); 
                    else
                        if(nClose_1 < nOpen_0)
                            value = Math.max(nOpen_0 - nClose_1,nHigh_0 - nLow_0); 
                        else 
                           value = nHigh_0 - nLow_0;
    return value;
}