Please help me to get the EA to place the trade at certain time.
externint Srvr.To.UTC.Hours = 0;
datetime now = TimeGMT();
datetimeTimeGMT(){ // TimeCurrent to GMTdatetime now = TimeCurrent(); // Under tester, TimeLocalreturn (now + Srvr.To.UTC.Hours*3600);
}
//placing a trade is not workingvoid AtCertainTime() {
Print(TimeToStr(TimeGMT(), TIME_MINUTES|TIME_SECONDS), " UTC");
datetime now = TimeGMT();
if (now == 2) //want trade to execute at this time
IfOrderDoesNotExistDoPlaceTrade();
}
Do you know what the code is to get the trade to execute at a certain time, e.g. 2:00
Do I replace
TimeCurrent();
with
TimeHour(TimeCurrent())
externint Srvr.To.UTC.Hours = 0;
datetime now = TimeGMT();
datetimeTimeGMT(){ // TimeCurrent to GMTdatetime now = TimeHour(TimeCurrent()); // Under tester, TimeLocalreturn (now + Srvr.To.UTC.Hours*3600);
}
//placing a trade is not workingvoid AtCertainTime() {
Print(TimeToStr(TimeGMT(), TIME_MINUTES|TIME_SECONDS), " UTC");
datetime now = TimeGMT();
if (now == 2:00:00) //want trade to execute at this time
IfOrderDoesNotExistDoPlaceTrade();
}
I have the following:
Please help me to get the EA to place the trade at certain time.
I have the following:
Please help me to get the EA to place the trade at certain time.
Now is a datetime, and a datetime of 2 is Thu, 01 Jan 1970 00:00:02 GMT I think you missed your chance.
haha nice one!
Do you know what the code is to get the trade to execute at a certain time, e.g. 2:00
Do I replace
TimeCurrent();with
what does y hour + x*3600 sec/hr mean?
Think first, then code.
I opted for an easier and more flexible solution: