G'day Folks,
I'm trying to do something quite simple and it seems i'm missing something somewhere. The following bit of script gets me the day ( 0 to 6 ) of the week.
var vTime = new Date();
var gBarDay;
var txtFlags = Text.ONTOP | Text.RELATIVETOLEFT | Text.RELATIVETOBOTTOM;
function preMain(){
setPriceStudy(true);
setShowTitleParameters(false);
setShowCursorLabel(false);
}
function main(){
vTime = getValue("Time",0)
gBarDay = vTime.getDay();
drawTextAbsolute(5, 520, "gBarDay " + gBarDay + ", vTime is " + vTime, Color.blue, null, txtFlags, null, 22, ("test"));
}
This works and returns a value for gBarDay of 1 on Monday (lower image). Now I wish to do something (print the line for example) in particular given that the day returned is 5 as in the following....
if(gBarDay == 5) drawTextAbsolute(5, 520, "gBarDay " + gBarDay + ", vTime is " + vTime, Color.blue, null, txtFlags, null, 22, ("test"));
and as you can see in the upper image, it merely changes the returned values and prints anyways, even though, in reality - this is done on Day 1 or Monday.
Any ideas ?
Chris
I'm trying to do something quite simple and it seems i'm missing something somewhere. The following bit of script gets me the day ( 0 to 6 ) of the week.
var vTime = new Date();
var gBarDay;
var txtFlags = Text.ONTOP | Text.RELATIVETOLEFT | Text.RELATIVETOBOTTOM;
function preMain(){
setPriceStudy(true);
setShowTitleParameters(false);
setShowCursorLabel(false);
}
function main(){
vTime = getValue("Time",0)
gBarDay = vTime.getDay();
drawTextAbsolute(5, 520, "gBarDay " + gBarDay + ", vTime is " + vTime, Color.blue, null, txtFlags, null, 22, ("test"));
}
This works and returns a value for gBarDay of 1 on Monday (lower image). Now I wish to do something (print the line for example) in particular given that the day returned is 5 as in the following....
if(gBarDay == 5) drawTextAbsolute(5, 520, "gBarDay " + gBarDay + ", vTime is " + vTime, Color.blue, null, txtFlags, null, 22, ("test"));
and as you can see in the upper image, it merely changes the returned values and prints anyways, even though, in reality - this is done on Day 1 or Monday.
Any ideas ?
Chris
Comment