Bull And Bear Balance

ICE Data Services -


BBB.efs  EFSLibrary - Discussion Board
  

File Name: BBB.efs


Description:
Bull And Bear Balance Indicator


Formula Parameters:

Notes:
This new indicator analyzes the balance between bullish and
bearish sentiment.
One can cay that it is an improved analogue of Elder Ray indicator.
To get more information please see "Bull And Bear Balance Indicator"
by Vadim Gimelfarb in S&C magazine.

This script requires that Bull_Power.efs and Bear_Power.efs are located
in the same folder.

Download File:
BBB.efs
Bear_Power.efs
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 And Bear Balance Indicator Version:            1.0  10/15/2008Notes:    This new indicator analyzes the balance between bullish and    bearish sentiment.    One can cay that it is an improved analogue of Elder Ray indicator.    To get more information please see "Bull And Bear Balance Indicator"     by Vadim Gimelfarb in S&C magazine.     This script requires that Bull_Power.efs and Bear_Power.efs are located     in the same folder.Formula Parameters:                     Default:**********************************/var bInit = false;function preMain(){    setStudyTitle("BBB");    setCursorLabelName("BBB",0);    setShowCursorLabel(false, 1);    setDefaultBarFgColor(Color.red, 0);    setDefaultBarFgColor(Color.brown, 1);    setPlotType(PLOTTYPE_HISTOGRAM, 1);}var xBull_p = null;var xBear_p = null;function main(){var nBBB = 0;    if ( bInit == false ) {         xBull_p = efsExternal("bull_power.efs");        xBear_p = efsExternal("bear_power.efs");        bInit = true;     } 	nBBB =  xBull_p.getValue(0) - xBear_p.getValue(0);		if(nBBB < 0)		setDefaultBarFgColor(Color.red,0);	else		setDefaultBarFgColor(Color.blue,0);			return new Array(nBBB, nBBB);}

/*********************************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:            Bear Power Indicator Version:            1.0  10/15/2008Notes:Formula Parameters:                     Default:**********************************/function preMain(){    setStudyTitle("BBB Bear Power");    setCursorLabelName("Bear Power",0);    setDefaultBarFgColor(Color.red,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(nClose_0 - nOpen_0, nHigh_0 - nLow_0); 		else  			value = nHigh_0 - nLow_0; 	else 		if (nClose_0 > nOpen_0)			if(nClose_1 > nOpen_0)  				value = Math.max(nClose_1 - nLow_0, nHigh_0 - nClose_0);			else				value = Math.max(nOpen_0 - nLow_0,nHigh_0 - nClose_0); 		else 			if(nHigh_0 - nClose_0 > nClose_0 - nLow_0)				if(nClose_1 > nOpen_0)  					value = Math.max(nClose_1 - nOpen_0,nHigh_0 - nLow_0);  				else						value = nHigh_0 - nLow_0;			else 				if(nHigh_0 - nClose_0 < nClose_0 - nLow_0)					if(nClose_0 > nOpen_0)						value = Math.max(nClose_0 - nLow_0,nHigh_0 - nClose_0);					else 								value = nOpen_0 - nLow_0; 				else					if(nClose_0 > nOpen_0)						value = Math.max(nClose_1 - nOpen_0,nHigh_0 - nLow_0); 					else						if(nClose_1 < nOpen_0)							value = Math.max(nOpen_0 - nLow_0, nHigh_0 - nClose_0); 						else 							value = nHigh_0 - nLow_0;	return value;}

/*********************************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/2008Notes: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;}