How to Fix error [Market is closed] error = 132

 

I make an EA, on D1 timeframe, sometimes when Open Order or Pending Order Error: failed [Market is closed] error = 132

I know Market is Closed can be caused by various things, but as we know, that the EA is run if there is a new candle that is formed so the EA certainly will not be run if it is a holiday, but the problem occurred at the beginning of the day.

  1. When a new Candle is formed, when the broker opens at the new day, Hour () == 0, Market at Low volume so that the order cannot be opened.
    2… Some brokers limit in the new Day, can open an order after 5-30 minutes.

The question:

  1. How do I deal with Market is Closed, I run EA on Timeframe D1, For example for the
    algorithm if I find Pinbar on D1 , if not executed it will be a long time waiting for the
    opportunity come again, maybe a few days or even weeks.

  2. My idea is that if I can use (Repeat Order or Loop) until Market Open (maybe after 5- 30
    minutes) and can accept order, can Repeat be run on Timeframe D1,
    to execute Repeat for up to 5 minutes to 30 minutes after the market open.
    How syntax the Repeat Order?

  3. I don’t need a way to check Market is Closed but rather how orders ensure can be executed.

Just for info, the same EA at the same broker, on the same day and hour can run on a Demo Account, maybe the demo account does not have a Real Volume Order.


Here are some examples of Market is Closed Errors in some Pairs, at beginning of the Day

2019.12.10 05:00:01.644 ‘xxx20xxxx’: order sell 0.09 GBPCAD opening at market sl: 1.74776 tp: 1.70923 failed [Market is closed]
2019.12.10 05:00:01.644 ‘xxx20xxxx’: pending order sell limit 0.09 GBPCAD at 1.73973 sl: 1.74776 tp: 1.71013
2019.12.10 05:00:01.816 ‘xxx20xxxx’: modification of order #1132350109 sell 0.11 EURUSD at 1.10807 sl: 1.10791 tp: 1.07807 -> sl: 1.10774 tp: 1.07807 failed [Market is closed]
2019.12.10 05:00:01.832 ‘xxx20xxxx’: modify order #1132350110 sell 0.11 EURUSD at 1.10900 sl: 1.10792 tp: 1.07897 -> sl: 1.10774 tp: 1.07897
2019.12.10 05:00:01.941 ‘xxx20xxxx’: order sell limit 0.09 GBPCAD opening at 1.73973 sl: 1.74776 tp: 1.71013 failed [Market is closed]
2019.12.10 05:00:01.941 ‘xxx20xxxx’: order sell market 0.09 GBPUSD sl: 1.31809 tp: 1.28383
2019.12.10 05:00:01.941 ‘xxx20xxxx’: pending order sell limit 0.09 GBPCAD at 1.74013 sl: 1.74776 tp: 1.71013
2019.12.10 05:00:02.066 ‘xxx20xxxx’: modification of order #1132350110 sell 0.11 EURUSD at 1.10900 sl: 1.10792 tp: 1.07897 -> sl: 1.10774 tp: 1.07897 failed [Market is closed]
2019.12.10 05:00:02.066 ‘xxx20xxxx’: modify order #1132367977 sell 0.15 EURUSD at 1.10901 sl: 1.10796 tp: 1.07908 -> sl: 1.10774 tp: 1.07908
2019.12.10 05:00:02.207 ‘xxx20xxxx’: order sell limit 0.09 GBPCAD opening at 1.74013 sl: 1.74776 tp: 1.71013 failed [Market is closed]
2019.12.10 05:00:02.207 ‘xxx20xxxx’: order sell 0.09 GBPUSD opening at market sl: 1.31809 tp: 1.28383 failed [Market is closed]
2019.12.10 05:00:02.207 ‘xxx20xxxx’: modification of order #1132367977 sell 0.15 EURUSD at 1.10901 sl: 1.10796 tp: 1.07908 -> sl: 1.10774 tp: 1.07908 failed [Market is closed]
2019.12.10 05:00:02.207 ‘xxx20xxxx’: pending order sell limit 0.06 GBPCAD at 1.74123 sl: 1.74776 tp: 1.70923
2019.12.10 05:00:02.207 ‘xxx20xxxx’: pending order sell limit 0.06 GBPUSD at 1.31433 sl: 1.31809 tp: 1.28473
2019.12.10 05:00:02.207 ‘xxx20xxxx’: modify order #1132367978 sell 0.15 EURUSD at 1.10958 sl: 1.10794 tp: 1.07998 -> sl: 1.10774 tp: 1.07998
2019.12.10 05:00:02.441 ‘xxx20xxxx’: order sell limit 0.06 GBPCAD opening at 1.74123 sl: 1.74776 tp: 1.70923 failed [Market is closed]
2019.12.10 05:00:02.457 ‘xxx20xxxx’: modification of order #1132367978 sell 0.15 EURUSD at 1.10958 sl: 1.10794 tp: 1.07998 -> sl: 1.10774 tp: 1.07998 failed [Market is closed]
2019.12.10 05:00:02.457 ‘xxx20xxxx’: order sell limit 0.06 GBPUSD opening at 1.31433 sl: 1.31809 tp: 1.28473 failed [Market is closed]
2019.12.10 05:00:02.457 ‘xxx20xxxx’: pending order sell limit 0.06 GBPCAD at 1.74203 sl: 1.74776 tp: 1.71013
2019.12.10 05:00:02.457 ‘xxx20xxxx’: modify order #1132367979 sell 0.15 EURUSD at 1.11050 sl: 1.10794 tp: 1.07998 -> sl: 1.10774 tp: 1.07998
2019.12.10 05:00:02.457 ‘xxx20xxxx’: pending order sell limit 0.09 GBPUSD at 1.31473 sl: 1.31809 tp: 1.28473
2019.12.10 05:00:02.691 ‘xxx20xxxx’: order sell limit 0.06 GBPCAD opening at 1.74203 sl: 1.74776 tp: 1.71013 failed [Market is closed]
2019.12.10 05:00:02.691 ‘xxx20xxxx’: modification of order #1132367979 sell 0.15 EURUSD at 1.11050 sl: 1.10794 tp: 1.07998 -> sl: 1.10774 tp: 1.07998 failed [Market is closed]
2019.12.10 05:00:02.691 ‘xxx20xxxx’: order sell limit 0.09 GBPUSD opening at 1.31473 sl: 1.31809 tp: 1.28473 failed [Market is closed]
2019.12.10 05:00:02.691 ‘xxx20xxxx’: pending order sell limit 0.06 GBPCAD at 1.74263 sl: 1.74776 tp: 1.71013
2019.12.10 05:00:02.691 ‘xxx20xxxx’: modify order #1132367981 sell 0.11 EURUSD at 1.11000 sl: 1.10794 tp: 1.07998 -> sl: 1.10774 tp: 1.07998
2019.12.10 05:00:02.691 ‘xxx20xxxx’: pending order sell limit 0.09 GBPUSD at 1.31583 sl: 1.31809 tp: 1.28383
2019.12.10 05:00:02.957 ‘xxx20xxxx’: order sell limit 0.06 GBPCAD opening at 1.74263 sl: 1.74776 tp: 1.71013 failed [Market is closed]
2019.12.10 05:00:02.957 ‘xxx20xxxx’: modification of order #1132367981 sell 0.11 EURUSD at 1.11000 sl: 1.10794 tp: 1.07998 -> sl: 1.10774 tp: 1.07998 failed [Market is closed]
2019.12.10 05:00:02.957 ‘xxx20xxxx’: order sell limit 0.09 GBPUSD opening at 1.31583 sl: 1.31809 tp: 1.28383 failed [Market is closed]
2019.12.10 05:00:02.957 ‘xxx20xxxx’: pending order sell limit 0.06 GBPCAD at 1.74343 sl: 1.74776 tp: 1.71013
2019.12.10 05:00:02.957 ‘xxx20xxxx’: pending order sell limit 0.06 GBPUSD at 1.31663 sl: 1.31809 tp: 1.28473
2019.12.10 05:00:03.175 ‘xxx20xxxx’: order sell limit 0.06 GBPCAD opening at 1.74343 sl: 1.74776 tp: 1.71013 failed [Market is closed]
2019.12.10 05:00:03.175 ‘xxx20xxxx’: order sell limit 0.06 GBPUSD opening at 1.31663 sl: 1.31809 tp: 1.28473 failed [Market is closed]
2019.12.10 05:00:03.207 ‘xxx20xxxx’: pending order sell limit 0.06 GBPCAD at 1.74573 sl: 1.74776 tp: 1.71013
2019.12.10 05:00:03.207 ‘xxx20xxxx’: pending order sell limit 0.09 GBPUSD at 1.31723 sl: 1.31809 tp: 1.28473
2019.12.10 05:00:03.394 ‘xxx20xxxx’: order sell limit 0.06 GBPCAD opening at 1.74573 sl: 1.74776 tp: 1.71013 failed [Market is closed]
2019.12.10 05:00:03.394 ‘xxx20xxxx’: order sell limit 0.09 GBPUSD opening at 1.31723 sl: 1.31809 tp: 1.28473 failed [Market is closed]
2019.12.10 05:00:03.425 ‘xxx20xxxx’: pending order sell limit 0.06 GBPUSD at 1.31803 sl: 1.31809 tp: 1.28473
2019.12.10 05:00:03.613 ‘xxx20xxxx’: order sell limit 0.06 GBPUSD opening at 1.31803 sl: 1.31809 tp: 1.28473 failed [Market is closed]

Thank You.

 
 
 

My account is not started.

My Trading are problem create.

 
MOHAMMAD AFNAN KHAN:

My account is not started.

My Trading are problem create.

Be specific about any problem and maybe somebody wil be able to assist.

 
It is not give the signal to profit and loss.No earning profit but help this trading.
 
William Roeder:

Remember it. Return from OnTick. When OnTick is called again, the market is open.

I Used D1 Timeframe, when On Tick is called again is tomorrow.
 
Fabio Cavalloni:
Why you don't use MarketInfo(Symbol(),MODE_TRADEALLOWED) ?
Trade is always Allowed, i used D1 Timeframe, but i loss oportunity if cannot open in New D1 thick.
 
Fabio Cavalloni:
Why you don't use MarketInfo(Symbol(),MODE_TRADEALLOWED) ?

Perhaps

SymbolInfoInteger(Symbol(),SYMBOL_TRADE_MODE)==SYMBOL_TRADE_MODE_DISABLED
 

Hi everyone, I am currently using Oanda as a broker on MT4 and it has been perfect for me with no issues. However for some reason todsy (Monday) it hasn’t let me place any trades or close some of my current trades because ‘the market is closed’, yet the market is still moving up and down???

Please help

 

I'm also getting the same thing. Market is moving, terminal trailing stop is trying and fails with market closed.

2021.11.22 14:53:41.407    '7236030': modification of order #285058919 buy 0.34 USDCZK at 22.30401 sl: 22.34259 tp: 0.00000 -> sl: 22.41169 tp: 0.00000 failed [Market is closed]
2021.11.22 14:53:41.203    '7236030': modify order #285058919 buy 0.34 USDCZK at 22.30401 sl: 22.34259 tp: 0.00000 -> sl: 22.41169 tp: 0.00000
2021.11.22 14:53:41.203    '7236030': trailing stop #285058919 -> 22.41169

We can not help you. This is a user's forum. You must contact the broker.
Reason: