Still working on it. The following scripts are very similar. The first one "Close" is outputting correctly. The second one "Close 1" is not returning any values. Thanks.
PHP Code:
function preMain() {
setPriceStudy(true);
setStudyTitle("Close");
setDefaultBarFgColor(Color.red, 0);
setPlotType(PLOTTYPE_DOT, 0);
setDefaultBarThickness(0, 0);
setShowTitleParameters(false);
}
var Close = null;
var BarCntr = 0;
function main() {
var nState = getBarState();
var Close = close(-1);
if (nState == BARSTATE_NEWBAR) {
BarCntr += 1;
}
Close = (open() + high() + low() + close()) / 4;
var retArray = new Array(1);
retArray[0] = Close;
if (BarCntr > 3) {
var myRef1 = ref(-1);
var Close1 = myRef1 [0]; debugPrintln(Close1);
}
return retArray;
}
PHP Code:
function preMain() {
setPriceStudy(true);
setStudyTitle("Close1");
setDefaultBarFgColor(Color.red, 0);
setPlotType(PLOTTYPE_DOT, 0);
setDefaultBarThickness(0, 0);
setShowTitleParameters(false);
}
var Close = null;
var BarCntr = 0;
function main() {
var nState = getBarState();
var startTime = 630;
var barTime = (hour(0) * 100) + minute(0);
var xClose = close(inv("15"));
if (nState == BARSTATE_NEWBAR) {
BarCntr += 1;
}
if (barTime == startTime) {
Close = xClose.getValue(0);
}
var retArray = new Array(1);
retArray[0] = Close; //debugPrintln(retArray[0]);
if (BarCntr > 300) {
var myRef1 = ref(-1);
var Close1 = myRef1 [0]; debugPrintln(Close1);
}
return retArray;
}