Why does only one line of the “drawTextRelative()” function executes and not both?
Can, and how do you get both to execute in the same efs script?
Can, and how do you get both to execute in the same efs script?
PHP Code:
function preMain(){
setPriceStudy(true);
var nPbUp = null;
var nPbDn = null;
var BarCntr = 0;
}
function main() {
var PB = efsExternal("/My EFS scripts/Price Bands.efs");
var PBHi = getSeries(PB,0);
var nPBHi = PBHi.getValue();
var PrevPbHi = PBHi.getValue(-1);
var BarHi = getValue("High");
var ctPbUp = getGlobalValue("nPbUp");
var PBLo = getSeries(PB,1);
var nPBLo = PBLo.getValue();
var PrevPbLo = PBLo.getValue(-1);
var BarLo = getValue("Low");
var ctPbDn = getGlobalValue("nPbDn");
// Count Up Bars
if( nPBHi > PrevPbHi && BarHi == nPBHi ) {
ctPbUp = ++ctPbUp
} else { ctPbUp = 0 };
setGlobalValue("nPbUp", ctPbUp);
// Count Down Bars
if ( nPBLo < PrevPbLo && BarLo == nPBLo ) {
ctPbDn = ++ctPbDn
} else { ctPbDn = 0 };
setGlobalValue("nPbDn", ctPbDn);
//debugPrintln("Symbol: " + getSymbol());
//debugPrintln("Interval: " + getInterval());
//debugPrintln("CurrentBar: " + getCurrentBarIndex());
//debugPrintln(" PBHi: " + getSeries(PB,0), "PBLo: " + getSeries( PB,1));
debugPrintln( " ctPbDn: " + ctPbDn, " ctPbUp: " + ctPbUp, "CurrentBar: " + getCurrentBarIndex());
drawTextRelative( 0, AboveBar2, getGlobalValue("nPbUp"), null, null, Text.PRESET, null, null );
drawTextRelative( 0, BelowBar2, getGlobalValue("nPbDn"), null, null, Text.PRESET, null, null );
return
}
Comment