Hi Folks,
I'm running exactly the same script in two different places, one in Toronto, Canada and one in Dallas, Texas on two of the same type of computers which, by the way are both set to Toronto time.
I fill my time variables in the following manner,
vTime = getValue("Time",0)
gBarDay = vTime.getDay();
gBarHour = vTime.getHours();
if(getSymbol() != "$PLAYBACK"){
vBarYear = getYear(0);
vBarMonth = getMonth(0);
vBarMonths = vBarMonth-1;
vBarDay = getDay(0);
vBarHour = getHour(0);
vBarMinutes = getMinute(0,inv("1"));
vBarSeconds = getSecond(0,inv("5s"));
myDate = new Date(vBarYear,vBarMonths,vBarDay,vBarHour,vBarMinu tes,vBarSeconds);
}
At 6 am in the morning, I set a global variable to "0" and print to a report by
if ( getBarState( ) == BARSTATE_NEWBAR){
if(gBarHour == 6){
setGlobalValue("TotalIsDone",0);
ActionStats = vBarHour + ":" + vBarMinutes + ":" + vBarSeconds + " " + "\t" + GoCurr + "\t\tGlobal set to 0"
ReportDate = vBarDay + "-" + vBarMonth + "-" + vBarYear;
ActionReport(ActionStats,ReportDate)
}
}
The following function prints the report
function ActionReport(ActionStats,ReportDate)
{
if(isLastBarOnChart()){
fr = new File(GoCurr + " " + ReportDate+" Action.report");
fr.open("at+")
fr.writeln(ActionStats);
fr.close();
return;
}
}
Now here's the where the issue lies ... in the reports. I can see the times being out by a few seconds but at the beginning of a new bar in Texas, I get minutes ALWAYS equal to 59 and seconds about the same (regardless of which hour i choose to print to the report). In the texas report, time is reported incorrectly when "Global set to 0" is printed to the report.
In Canada the report looks like...
1:42:40 AUD Chart Loaded
5:20:0 AUD Brit Exit is true, setting Buy and Sell to False
6:0:0 AUD Global set to 0
6:05:35 AUD Setting initial SellDate to Wed Dec 17 2008 06:25:35 GMT-0500 (Eastern Standard Time) at chart price of 0.672
9:15:35 AUD Setting initial BuyDate to Wed Dec 17 2008 09:25:35 GMT-0500 (Eastern Standard Time) at chart price of 0.691
9:32:15 AUD Entered Long for 1 lots, entry at chart price of 0.6926
In Texas the report looks like...
1:42:0 AUD Chart Loaded
5:21:20 AUD Brit Exit is true, setting Buy and Sell to False
6:59:55 AUD Global set to 0
6:05:32 AUD Setting initial SellDate to Wed Dec 17 2008 06:25:35 GMT-0500 (Eastern Standard Time) at chart price of 0.671
9:15:35 AUD Setting initial BuyDate to Wed Dec 17 2008 09:25:35 GMT-0500 (Eastern Standard Time) at chart price of 0.691
9:32:15 AUD Entered Long for 1 lots, entry at chart price of 0.6927
Any help or thoughts would be greatly appreciated,
Chris
I'm running exactly the same script in two different places, one in Toronto, Canada and one in Dallas, Texas on two of the same type of computers which, by the way are both set to Toronto time.
I fill my time variables in the following manner,
vTime = getValue("Time",0)
gBarDay = vTime.getDay();
gBarHour = vTime.getHours();
if(getSymbol() != "$PLAYBACK"){
vBarYear = getYear(0);
vBarMonth = getMonth(0);
vBarMonths = vBarMonth-1;
vBarDay = getDay(0);
vBarHour = getHour(0);
vBarMinutes = getMinute(0,inv("1"));
vBarSeconds = getSecond(0,inv("5s"));
myDate = new Date(vBarYear,vBarMonths,vBarDay,vBarHour,vBarMinu tes,vBarSeconds);
}
At 6 am in the morning, I set a global variable to "0" and print to a report by
if ( getBarState( ) == BARSTATE_NEWBAR){
if(gBarHour == 6){
setGlobalValue("TotalIsDone",0);
ActionStats = vBarHour + ":" + vBarMinutes + ":" + vBarSeconds + " " + "\t" + GoCurr + "\t\tGlobal set to 0"
ReportDate = vBarDay + "-" + vBarMonth + "-" + vBarYear;
ActionReport(ActionStats,ReportDate)
}
}
The following function prints the report
function ActionReport(ActionStats,ReportDate)
{
if(isLastBarOnChart()){
fr = new File(GoCurr + " " + ReportDate+" Action.report");
fr.open("at+")
fr.writeln(ActionStats);
fr.close();
return;
}
}
Now here's the where the issue lies ... in the reports. I can see the times being out by a few seconds but at the beginning of a new bar in Texas, I get minutes ALWAYS equal to 59 and seconds about the same (regardless of which hour i choose to print to the report). In the texas report, time is reported incorrectly when "Global set to 0" is printed to the report.
In Canada the report looks like...
1:42:40 AUD Chart Loaded
5:20:0 AUD Brit Exit is true, setting Buy and Sell to False
6:0:0 AUD Global set to 0
6:05:35 AUD Setting initial SellDate to Wed Dec 17 2008 06:25:35 GMT-0500 (Eastern Standard Time) at chart price of 0.672
9:15:35 AUD Setting initial BuyDate to Wed Dec 17 2008 09:25:35 GMT-0500 (Eastern Standard Time) at chart price of 0.691
9:32:15 AUD Entered Long for 1 lots, entry at chart price of 0.6926
In Texas the report looks like...
1:42:0 AUD Chart Loaded
5:21:20 AUD Brit Exit is true, setting Buy and Sell to False
6:59:55 AUD Global set to 0
6:05:32 AUD Setting initial SellDate to Wed Dec 17 2008 06:25:35 GMT-0500 (Eastern Standard Time) at chart price of 0.671
9:15:35 AUD Setting initial BuyDate to Wed Dec 17 2008 09:25:35 GMT-0500 (Eastern Standard Time) at chart price of 0.691
9:32:15 AUD Entered Long for 1 lots, entry at chart price of 0.6927
Any help or thoughts would be greatly appreciated,
Chris
Comment