Real Time Outside Bar

ICE Data Services -

RT_OutsideBarAlert.efs  EFSLibrary - Discussion Board

File Name: RT_OutsideBarAlert.efs

Real Time Outside Bar

Formula Parameters:
Enable Alerts : True
Outside Bar Color : Blue
Up Bar Color : Green
Down Bar Color : Red


Download File:

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:            Real Time Outside Bar    Version:            1.0  06/16/2009 Formula Parameters:                     Default:    Enable Alerts                       True    Outside Bar Color                   Blue      Up Bar Color                        Green    Down Bar Color                      Red    Notes:**********************************/var bNewBar = false;var bAlert = false;function preMain() {	setPriceStudy(true);	setStudyTitle("Real Time Outside Bar");	setShowCursorLabel(false);	setShowTitleParameters(false);	setColorPriceBars(true);	setDefaultPriceBarColor(;	var fp1 = new FunctionParameter("cColor", FunctionParameter.COLOR);	fp1.setName("Outside Bar Color");	fp1.setDefault(;	var fp2 = new FunctionParameter("bEnable", FunctionParameter.BOOLEAN);	fp2.setName("Enable Alerts");	fp2.setDefault(true);	var fp3 = new FunctionParameter("cUpColor", FunctionParameter.COLOR);	fp3.setName("Up Bar Color");	fp3.setDefault(;	var fp4 = new FunctionParameter("cDownColor", FunctionParameter.COLOR);	fp4.setName("Down Bar Color");	fp4.setDefault(;}var xOpen = null;var xHigh = null;var xLow = null;var xClose = null;var bInit = false; function main(bEnable, cColor, cUpColor, cDownColor) {	if (getBarState() == BARSTATE_NEWBAR) bNewBar = true;		if(!bInit){        xOpen = open();        xHigh = high();        xLow = low();        xClose = close();        bInit = true;    }        var nOpen = xOpen.getValue(0);    var nHigh = xHigh.getValue(0);    var nHigh_1 = xHigh.getValue(-1);    var nLow = xLow.getValue(0);    var nLow_1 = xLow.getValue(-1);    var nClose = xClose.getValue(0);        if(nHigh_1 == null || nLow_1 == null) return;    if (nHigh > nHigh_1 && nLow < nLow_1 ) bAlert = true; 		if (bAlert == true) {		setPriceBarColor(cColor);         if (bEnable == true && bNewBar == true) {			Alert.playSound("pop.wav");			Alert.addToList(getSymbol(), "Outside Bar", cColor, Color.white);			bNewBar = false;		}		bAlert = false;	} else {		if (nClose >= nOpen)             setPriceBarColor(cUpColor)		else             setPriceBarColor(cDownColor)	}	return;}