How to avoid [market closed] message by MQL code?

 

Dear 

I have problem to backtest EA with some broker It give me error message like below -

2022.01.23 22:03:50.459 Core 1 2021.03.22 00:00:00 CTrade::OrderSend: market buy 0.04 position #1048 EURUSD [market closed]

and backtest going too slow and it give me lot of message - 


Is this possible any MQL code so i can check is market close or not. or how can i solve this problem 


Thanks in advanced  

 

For such questions I use: https://www.mql5.com/en/docs/function_indices

to search with Ctrl+F for keywords in you case "session" and I found this: https://www.mql5.com/en/docs/marketinformation/symbolinfosessiontrade

 

you are backtesting EURUSD.

in backtesting, this messages does not make sense to me. During backtesting it should not give the message as "market closed"

Backtesting works fine even over the weekends when the market is closed.


In all possibility, the trade which you are referring above is placed on Sunday ie 23rd Jan. On Sunday the market is closed and hence the message. I do not suspect the above message to be form backtesting. 

 
Satyam Shivam #:

you are backtesting EURUSD.

in backtesting, this messages does not make sense to me. During backtesting it should not give the message as "market closed"

Backtesting works fine even over the weekends when the market is closed.


In all possibility, the trade which you are referring above is placed on Sunday ie 23rd Jan. On Sunday the market is closed and hence the message. I do not suspect the above message to be form backtesting. 

That could be possible.

Many Forex-brokers open the market already on Sunday night. If you have now a Custom Symbol with imported prices from another timezone, such errors can occur.

Reason: