market is closed error

 

I'm getting this in weekdays and have put my codes inside if(IsTradeAllowed())

but my EA is still trying to open/close a trade

I've seen some post mentioning that the broker will close their service to do something for 5 mins or so.

 
Dua Yong Rew: I'm getting this in weekdays and have put my codes inside if(IsTradeAllowed()) but my EA is still trying to open/close a trade. I've seen some post mentioning that the broker will close their service to do something for 5 mins or so.
During end of day, beginning of next, there will be swap (roll-over) calculations and many brokers suspend trading during those minutes, probably to prevent last second trades just to take advantage of swaps on the roll-over.
 
Fernando Carreiro:
During end of day, beginning of next, there will be swap (roll-over) calculations and many brokers suspend trading during those minutes, probably to prevent last second trades just to take advantage of swaps on the roll-over.

Anyway to detect this? Istradeallowed is not working for this case

 
Dua Yong Rew: Anyway to detect this? Istradeallowed is not working for this case

This is usually a fixed time interval. So your broker probably has those times described on their website and if not, just ask them (or test it yourself, to see what the interval is).

In terms of the EA, just create two inputs for defining the time interval for this so as to prevent attempting to trade during that time interval.

 
Fernando Carreiro:

This is usually a fixed time interval. So your broker probably has those times described on their website and if not, just ask them.

In terms of the EA, just create two inputs for defining the time interval for this so as to prevent attempting to trade during that time interval.

Thanks for the input. Guess I just have to live with it

 
Dua Yong Rew: Thanks for the input. Guess I just have to live with it

Here is an example of a Broker's rollover details (I've removed the brokers name as per forum rules):

Market Opening Hours

Posted on: 01 March 2013 , by: XXXXXXXX Support , category: About Trading

Forex market opening hours are 24 hours a day and 5 days a week – outside of weekends and rollover. This opening time is based on GMT+2

MT4 Market open hours are detailed below:

Market Open = 00:01 MT4 Server Time (Monday)

Market Close = 23:55 MT4 Server Time (Friday)

These market opening hours correspond to the start of trading in Australasia, followed by Asia, Europe and finally the Americas.

Our servers are set to GMT +2 to match with the end of the trading day in the US – generally considered the close of the trading day. This means that when trading concludes in the United States at 5pm, the daily candle closes in Metatrader.

This time also corresponds to the beginning of XXXXXXXX’s roll-over period, in which swaps are applied to any trades held over the close of the trading day. During this time, trading is disabled for 2 minutes when XXXXXXXX and banks reset their servers and liquidity is very low.

As XXXXXXXX’s market opening hours are set to match the close of trading in New York, our server time may change if daylight savings hours change in the US. This means you should keep an eye out for notifications from us near the start of March and November – when daylight savings changes are likely to occur.

 
Fernando Carreiro:

Here is an example of a Broker's rollover details (I've removed the brokers name as per forum rules):


Thanks for the info

Reason: