I have tried running the code and multiple times of the day and the week on weekdays. I have also tried putting the code in a script and an EA. Every time I get the same result. Is there an explanation for this? As alert 2 returns: true, then I would expect alert 3 and alert 4 to return true. Thanks.
Allow the use of cookies to log in to the MQL5.com website.
Please enable the necessary setting in your browser, otherwise you will not be able to log in.
You are signed in. Two-factor authentication has been disabled. Set it up again and scan a new QR code, or continue with two-factor authentication disabled.
Nungen,
try this - I think IsTradeAllowed("symbol", Time) is broker-time dependent - and not whether the market is open or not, whether you get ticks or not!
string dax1,dax2; void OnTick() { if ( StringFind(dax1,"TRUE @")<0 && IsTradeAllowed(".DE30Cash",TimeCurrent()) ) dax1 = "\n.DE30Cash changes to TRUE @ GMT: "+TimeToStr(TimeGMT(),TIME_DATE|TIME_SECONDS)+" TmeC: "+TimeToStr(TimeCurrent(),TIME_DATE|TIME_SECONDS); else if ( StringFind(dax1,"FALSE @")<0 && !IsTradeAllowed(".DE30Cash",TimeCurrent()) ) dax1 = "\n.DE30Cash changes to FALSE @ GMT: "+TimeToStr(TimeGMT(),TIME_DATE|TIME_SECONDS)+" TmeC: "+TimeToStr(TimeCurrent(),TIME_DATE|TIME_SECONDS); if ( StringFind(dax2,"TRUE @")<0 && IsTradeAllowed(".DE30CashXE",TimeCurrent()) ) dax2 = "\n.DE30CashXE changes to TRUE @ GMT: "+TimeToStr(TimeGMT(),TIME_DATE|TIME_SECONDS)+" TmeC: "+TimeToStr(TimeCurrent(),TIME_DATE|TIME_SECONDS); else if ( StringFind(dax2,"FALSE @")<0 && !IsTradeAllowed(".DE30CashXE",TimeCurrent())) dax2 = "\n.DE30CashXE changes to FALSE @ GMT: "+TimeToStr(TimeGMT(),TIME_DATE|TIME_SECONDS)+" TmeC: "+TimeToStr(TimeCurrent(),TIME_DATE|TIME_SECONDS); Comment("GMT: ",TimeToStr(TimeGMT(),TIME_DATE|TIME_SECONDS)," TmeC: ",TimeToStr(TimeCurrent(),TIME_DATE|TIME_SECONDS),"\n", "Just empty isTrdAllowd: ",IsTradeAllowed(),"\n", Symbol()," isTrdAllowd: ",IsTradeAllowed(Symbol(),TimeCurrent())," normal Forex\n", ".DE30Cash isTrdAllowd: ",IsTradeAllowed(".DE30Cash",TimeCurrent())," DAX\n", ".DE30CashXE isTrdAllowd: ",IsTradeAllowed(".DE30CashXE",TimeCurrent()), " DAX Xetra Trading Hours (9:00.17:30 Ffm == 7:00-15:30 GMT now!)", dax1,dax2 ); }Nungen,
try this - I think IsTradeAllowed("symbol", Time) is broker-time dependent - and not whether the market is open or not, whether you get ticks or not!
Could you clarify what you mean by: "broker-time dependent"? Please see the code below (I have activated auto trading):
This returns:
I have tried running the code and multiple times of the day and the week on weekdays. I have also tried putting the code in a script and an EA. Every time I get the same result. Is there an explanation for this? As alert 2 returns: true, then I would expect alert 3 and alert 4 to return true. Thanks.