[Market is closed]

 

My EA work at day time. It opens orders at the begining of the day. In jounal field:

"2014.08.29 04:02:57.736    '8043706': instant order buy 0.01 EURUSD at 1.3183

2014.08.29 04:02:58.161    '8043706': order buy 0.01 EURUSD opening at 1.3183 failed [Market is closed]"

It means market closed so the order cancelled.

How to code to reopen the same order when the market open?

 
Makeprofitsuper:

My EA work at day time. It opens orders at the begining of the day. In jounal field:

"2014.08.29 04:02:57.736    '8043706': instant order buy 0.01 EURUSD at 1.3183

2014.08.29 04:02:58.161    '8043706': order buy 0.01 EURUSD opening at 1.3183 failed [Market is closed]"

It means market closed so the order cancelled.

How to code to reopen the same order when the market open?

Hello Makeprofitsuper, please take a look at the following functions:

1) Date and time functions

2) GetLastError 

So, the idea is: according to the error message you get, you can set your expert advisor to retry to send the order at a given specific time, when the market is not closed.

I hope it helps you somehow.

Regards,
Malacarne 

Documentation on MQL5: Date and Time
Documentation on MQL5: Date and Time
  • www.mql5.com
Date and Time - Reference on algorithmic/automated trading language for MetaTrader 5
 
Malacarne:

Hello Makeprofitsuper, please take a look at the following functions:

1) Date and time functions

2) GetLastError 

So, the idea is: according to the error message you get, you can set your expert advisor to retry to send the order at a given specific time, when the market is not closed.

I hope it helps you somehow.

Regards,
Malacarne 

You can try this code:

// Define your "now" variable:

Datetime now;

// the code for opening trades: 

int start()

  { 

  if( now != iTime(NULL,PERIOD_D1,0) )

   {

   now = iTime(NULL,PERIOD_D1,0);

  

    if(iOpen(NULL,PERIOD_D1,0)<ma)

     {

         ticket=OrderSend(...........);

                 

         if(ticket>0)

           {

            Comment("Trade Opened");

           }

         else Print("Error opening SELL STOP order : ",GetLastError()); 

         return(0); 

        }
 

Forum on trading, automated trading systems and testing trading strategies


Hello,

Please use the SRC button when you post code. Thank you.


This time, I edited it for you.


 
Makeprofitsuper:

My EA work at day time. It opens orders at the begining of the day. In jounal field:

"2014.08.29 04:02:57.736    '8043706': instant order buy 0.01 EURUSD at 1.3183

2014.08.29 04:02:58.161    '8043706': order buy 0.01 EURUSD opening at 1.3183 failed [Market is closed]"

It means market closed so the order cancelled.

How to code to reopen the same order when the market open?

Hi I am getting this error message [Market is closed] during the week at 22:00:00 when I had an Alpari live account and now at 23:00:00 with ActivTrades, so it seems to be a MT4 related issue.

The EURAUD trade was placed Tuesday 24/02/2015 at 23:00:06.331 and the error [Market is closed].

Before my EA opens a trade I use, while(IsTradeConyextBusy)) Sleep(10); So I am not expecting a conflict between trades being placed on the server.

I only place trades on the new daily bar opening or update the trailing stop on already open trades. I do use the same EA on many different pairs. However, all EA's have different Magic numbers.

At the time of the order failure I had two open trades on USDJPY and GBPJPY, but they did not update their stops, so this was my only action.

I should point out that the two open trades were placed days ago with the same EA and without any problem. I would add that the problem seems to effect EURAUD more than any other pair, but I realise that would be crazy.

Would adding a time delay to avoid what must be a busy sever time help or add IsTradeAllowed==true to the trading loop.

Trader_9.

 
Trader_9:

Hi I am getting this error message [Market is closed] during the week at 22:00:00 when I had an Alpari live account and now at 23:00:00 with ActivTrades, so it seems to be a MT4 related issue.

The EURAUD trade was placed Tuesday 24/02/2015 at 23:00:06.331 and the error [Market is closed].

Before my EA opens a trade I use, while(IsTradeConyextBusy)) Sleep(10); So I am not expecting a conflict between trades being placed on the server.

I only place trades on the new daily bar opening or update the trailing stop on already open trades. I do use the same EA on many different pairs. However, all EA's have different Magic numbers.

At the time of the order failure I had two open trades on USDJPY and GBPJPY, but they did not update their stops, so this was my only action.

I should point out that the two open trades were placed days ago with the same EA and without any problem. I would add that the problem seems to effect EURAUD more than any other pair, but I realise that would be crazy.

Would adding a time delay to avoid what must be a busy sever time help or add IsTradeAllowed==true to the trading loop.

Trader_9.

Please do a little research about recent news involving the Alpari broker.

Regards,
Malacarne 

 

I know this thread is a bit old now but the problem is still there. I was having this error 132 Market is closed mid week on my Alpari account before they became insolvent and it has just happened to me again on ActivTrades on the D1 charts on wednesday.

Trying to find an answer I came across this similar thread at strategyquant.

http://www.strategyquant.com/forum/topic/1405-mt4-error-132-market-is-closed/

Which lead to this explanation of the problem and a possible solution.

https://www.currencysecrets.com/633/error-132-market-is-closed-pepperstone-at-1700-ny-est

I will be trying this out next week to see if it is a fix.

Regards Trader9.

MT4 error 132: market is closed
MT4 error 132: market is closed
  • 2014.02.20
  • strategyquant.com
I've made a SQ EA and wanted to use it in MT4. It's an EA for the daily timeframe. Last week it tried to open two trades. Both times the error 132 occured. But the market was not closed so I assume no tick was sent at that time. Any hints how to solve this problem?
 
Hello everyone,
I'm new in the community and I am writing because I too have the same problem of "Makeprofitsuper".
For example with the DJI, the first bar daily after the close of the market opens at 00:00, but my broker opens 01: 00.
The problem is that I use an EA that opens only at the beginning of a bar, then tries to open the position at 00:00, but finding the market closed metatrader me returns error [market closed].
Assuming that I can not write in mql4 wanted to ask you if you could help me out to solve this problem.
Thanks in advance