I wrote the following peice of code, which include a piece from dloomis, to basically return the high and low for the pre 900am cst hour. when I run it on a chart I get the following error...
line 25: ReferenceError: getvalue is not defined
I know it is something stupid, but I can't figure it out, and it is driving me nuts... Thanks in advance..
function preMain() {
setStudyTitle("9:00 High/Low");
setCursorLabelName("9:00 High/Low");
setPriceStudy(true);
}
/*
* This function returns a High and low for the pre nine o'clock hour
*
*/
function main() {
var nHigh = 0;
var nLow = 0;
var i;
var interval;
var indexer;
var hValue;
var lValue;
indexer = (30 / interval);
interval = getInterval();
getTime();
if(cTimeInt == 90000){
hValue = getValue("High",0,-indexer); //line 25
lValue = getValue("Low",0,-indexer);
//get the high for the first half hour
for(i=0; i<indexer-1; i++){
if(hValue[i] >= nHigh){
nHigh = hValue[i];
}
break;
}
//get the low for the first half hour
for (i = 0; i<indexer-1; i++){
if(lValue[i] <= nLow){
nLow = lValue[i];
}
break;
}
drawTextRelative(1, 80, "High is" + nHigh + "Low is" + nLow, Color.black, Color.red, Text.FRAME | Text.ONTOP | Text.BOLD, null, null, "OS");
}
}
/* This routine returns the following:
CurYr, Current year, YYYY
CurMon, Current month, MM
CurDay, Current Day, DD
cDateInt, Current Date, YYYYMMDD
cDatePrint, Current date YYYY:MMD
CurHr, Current Hour, HH
CurMin, Current Minute, MM
CurSec, Current Seconds, SS
cTimeInt, Current Clock Time, HHMMSS
cTimePrint, Current Clock Time, HH:MM:SS
BarYr, Current Bar Year, YYYY
BarMon, Current BAr Month, MM
BarDay, Current Bar Day, DD
BarYrMonDayInt, YYYYMMDD
BarYrMonDayPrint, YYYY:MMD
BarHr, Current Bar Hour, HH
BarMin, Current Bar Minute
BarSec, Current bar Seconds, SS
cBarTimeInt, Current Bar Time, HHMMSS
cBarTimePrint, Current Bar Time, HH:MM:SS
*/
function getTime(){
today =new Date;
CurYr= today.getYear()+1900;
if(CurYr<10){
CurYr="0"+CurYr;}
CurMon= today.getMonth()+1;
if(CurMon<10){
CurMon="0"+CurMon;}
CurDay= today.getDate();
if(CurDay<10){
CurDay="0"+CurDay;}
cDateInt =CurYr*10000+CurMon*100+CurDay*1;
cDatePrint=CurYr+":"+CurMon+":"+CurDay;
CurHr =today.getHours();
if(CurHr<10){
CurHr="0"+CurHr;}
CurMin =today.getMinutes();
if(CurMin<10){
CurMin="0"+CurMin;}
CurSec =today.getSeconds();
if(CurSec<10){
CurSec="0"+CurSec;}
cTimeInt =CurHr*10000+CurMin*100+CurSec*1;
cTimePrint=CurHr+":"+CurMin+":"+CurSec;
BarYr = getValue("Year");
if(BarYr<10){
BarYr="0"+BarYr;}
BarMon = getValue("Month");
if(BarMon<10){
BarMon="0"+BarMon;}
BarDay = getValue("Day");
if(BarDay<10){
BarDay="0"+BarDay;}
BarYrMonDayPrint= BarYr+":"+BarMon+":"+BarDay;
BarYrMonDayInt= BarYr*10000+BarMon*100+BarDay*1;
BarHr = getHour();
if(BarHr<10){
BarHr="0"+BarHr;}
BarMin = getValue("Minute");
if(BarMin<10){
BarMin="0"+BarMin;}
BarSec = getValue("Second");
if(BarSec>=1&&BarSec<10){
BarSec="0"+BarSec;}
cBarTimePrint=BarHr+":"+BarMin+":"+BarSec;
cBarTimeInt =BarHr*10000+BarMin*100+BarSec*1;
return new Array(BarYrMonDayInt, BarYrMonDayPrint, BarYr, BarMon, BarDay, BarHr, BarMin, BarSec, cBarTimeInt, cBarTimePrint,cTimeInt,cTimePrint,cDateInt,cDatePr int, CurYr, CurMon, CurDay, CurHr, CurMin, CurSec);
}
line 25: ReferenceError: getvalue is not defined
I know it is something stupid, but I can't figure it out, and it is driving me nuts... Thanks in advance..
function preMain() {
setStudyTitle("9:00 High/Low");
setCursorLabelName("9:00 High/Low");
setPriceStudy(true);
}
/*
* This function returns a High and low for the pre nine o'clock hour
*
*/
function main() {
var nHigh = 0;
var nLow = 0;
var i;
var interval;
var indexer;
var hValue;
var lValue;
indexer = (30 / interval);
interval = getInterval();
getTime();
if(cTimeInt == 90000){
hValue = getValue("High",0,-indexer); //line 25
lValue = getValue("Low",0,-indexer);
//get the high for the first half hour
for(i=0; i<indexer-1; i++){
if(hValue[i] >= nHigh){
nHigh = hValue[i];
}
break;
}
//get the low for the first half hour
for (i = 0; i<indexer-1; i++){
if(lValue[i] <= nLow){
nLow = lValue[i];
}
break;
}
drawTextRelative(1, 80, "High is" + nHigh + "Low is" + nLow, Color.black, Color.red, Text.FRAME | Text.ONTOP | Text.BOLD, null, null, "OS");
}
}
/* This routine returns the following:
CurYr, Current year, YYYY
CurMon, Current month, MM
CurDay, Current Day, DD
cDateInt, Current Date, YYYYMMDD
cDatePrint, Current date YYYY:MMD
CurHr, Current Hour, HH
CurMin, Current Minute, MM
CurSec, Current Seconds, SS
cTimeInt, Current Clock Time, HHMMSS
cTimePrint, Current Clock Time, HH:MM:SS
BarYr, Current Bar Year, YYYY
BarMon, Current BAr Month, MM
BarDay, Current Bar Day, DD
BarYrMonDayInt, YYYYMMDD
BarYrMonDayPrint, YYYY:MMD
BarHr, Current Bar Hour, HH
BarMin, Current Bar Minute
BarSec, Current bar Seconds, SS
cBarTimeInt, Current Bar Time, HHMMSS
cBarTimePrint, Current Bar Time, HH:MM:SS
*/
function getTime(){
today =new Date;
CurYr= today.getYear()+1900;
if(CurYr<10){
CurYr="0"+CurYr;}
CurMon= today.getMonth()+1;
if(CurMon<10){
CurMon="0"+CurMon;}
CurDay= today.getDate();
if(CurDay<10){
CurDay="0"+CurDay;}
cDateInt =CurYr*10000+CurMon*100+CurDay*1;
cDatePrint=CurYr+":"+CurMon+":"+CurDay;
CurHr =today.getHours();
if(CurHr<10){
CurHr="0"+CurHr;}
CurMin =today.getMinutes();
if(CurMin<10){
CurMin="0"+CurMin;}
CurSec =today.getSeconds();
if(CurSec<10){
CurSec="0"+CurSec;}
cTimeInt =CurHr*10000+CurMin*100+CurSec*1;
cTimePrint=CurHr+":"+CurMin+":"+CurSec;
BarYr = getValue("Year");
if(BarYr<10){
BarYr="0"+BarYr;}
BarMon = getValue("Month");
if(BarMon<10){
BarMon="0"+BarMon;}
BarDay = getValue("Day");
if(BarDay<10){
BarDay="0"+BarDay;}
BarYrMonDayPrint= BarYr+":"+BarMon+":"+BarDay;
BarYrMonDayInt= BarYr*10000+BarMon*100+BarDay*1;
BarHr = getHour();
if(BarHr<10){
BarHr="0"+BarHr;}
BarMin = getValue("Minute");
if(BarMin<10){
BarMin="0"+BarMin;}
BarSec = getValue("Second");
if(BarSec>=1&&BarSec<10){
BarSec="0"+BarSec;}
cBarTimePrint=BarHr+":"+BarMin+":"+BarSec;
cBarTimeInt =BarHr*10000+BarMin*100+BarSec*1;
return new Array(BarYrMonDayInt, BarYrMonDayPrint, BarYr, BarMon, BarDay, BarHr, BarMin, BarSec, cBarTimeInt, cBarTimePrint,cTimeInt,cTimePrint,cDateInt,cDatePr int, CurYr, CurMon, CurDay, CurHr, CurMin, CurSec);
}
Comment