Hi, basically in my EA i'm trying to make it avoid news times which i manually put in for the week, and then it won't trade an hour before or after. So I thought i was being smart by doing:
extern datetime newstime;
datetime news = StrToTime(newstime);
datetime timenow = TimeCurrent();
and then just before the trade logic
if((timenow < news - 3600 || timenow > news + 3600 ))
{
}
effectively i wanted to have an extern datetime where i can set the date and time of news. I then wanted the ea to convert this into the number of seconds passed since 1970. Then i wanted to compare TimeCurrent (also in seconds passed since 1970) and if it was less than news - 3600 seconds (one hour) or greater than news + 3600 seconds then it could trade. If it wasn't, that would mean it's in between the news time and it shouldn't trade
everything is fine and dandy, the external datetime comes up, i can select the date/time for the news i want it to avoid, but it's completely ignored and trades no matter what the time!!
any help would be appreciated, massive apologies for the noob code lol!
extern datetime newstime;
datetime news = StrToTime(newstime);
datetime timenow = TimeCurrent();
and then just before the trade logic
if((timenow < news - 3600 || timenow > news + 3600 ))
{
}
effectively i wanted to have an extern datetime where i can set the date and time of news. I then wanted the ea to convert this into the number of seconds passed since 1970. Then i wanted to compare TimeCurrent (also in seconds passed since 1970) and if it was less than news - 3600 seconds (one hour) or greater than news + 3600 seconds then it could trade. If it wasn't, that would mean it's in between the news time and it shouldn't trade
everything is fine and dandy, the external datetime comes up, i can select the date/time for the news i want it to avoid, but it's completely ignored and trades no matter what the time!!
any help would be appreciated, massive apologies for the noob code lol!