Error 132 (market closed)
8 replies
Tomáš Dušek
4 years ago #257226
I am testing the demo account of the first strategy (D1 strategy) generated by SQX to detect the first errors and to encounter error 132 (market closed). When I researched this, the strategy is trying to place orders at the broker server downtime. In our time, I think it’s 23: 00-23: 05CET, how do you handle it? Is there any script that watches and sends commands again or another solution?
Here in the forum I found advice to use EA Wizard, which no longer works with SQX strategies
I’ve already given advice on using OpenBarDelay. For D1 strategy this may not matter, but for strategy H4 and below, there will be a big difference between real and backtest
extern int OpenBarDelay = 0; // open bar delay in minutes
// it can be used for Daily Strategies to trigger trading a few minutes later –
// because brokers sometimes have a technical delay after midnight and we have to postpone order execution
The solution would be to check the placement of the order and try again if it is not
tomas262
4 years ago #257245
Thanks for your feedback. As you mentioned for the daily chart simply the OpenBarDelay parameter can be set to 5 or 6 but for H1 or H4 strategies this would cause some issues with not optimal entry fills. We will look into this how this could be improved
Tomáš Dušek
4 years ago #257248
I found the exact market opening times in the MT4 market specification.
I searched for the solution and found this thread
https://www.mql5.com/en/forum/35805
https://www.forexfactory.com/showthread.php?t=548770
Tomáš Dušek
4 years ago #257260
I found the exact market opening times in the MT4 market specification. I searched for the solution and found this thread https://www.mql5.com/en/forum/35805 https://www.forexfactory.com/showthread.php?t=548770
I found this. Would it not help to place orders only at the time of opening the markets? Everyone could set the clock according to their broker
https://robottradingsystem.com/mql4-simple-time-based-entry/
tomas262
4 years ago #257300
Yes, that seems useful. I have forwarded it to developers so the order execution can be improved
hankeys
4 years ago #257302
its not user friendly to add 2 another variables to the EAs, where user will need to set this manually, because for every broker the “technical pause” of no trading is different, there are brokers with no pause, with 5 minute pause, etc.
solution is simple – you get error “market is closed” – RETRY
and i dont think that this is a big issue, i dont see any bigger differences on the lower TFs with my real trading so far
You want to be a profitable algotrader? We started using StrateQuant software in early 2014. For now we have a very big knowhow for building EAs for every possible types of markets. We share this knowhow, apps, tools and also all final strategies with real traders. If you want to join us, fill in the FORM.
hankeys
4 years ago #257377
in the old SQ3 code we made also the changes, so our tuned MQL code will take care about these basic errors
case ERR_TRADE_CONTEXT_BUSY:
msg = “Trade context busy”;
wait = true;
break;
case ERR_BROKER_BUSY:
msg = “Broker busy”;
wait = true;
break;
case ERR_SERVER_BUSY:
msg = “Server busy”;
wait = true;
break;
case ERR_MARKET_CLOSED:
msg = “Market closed”;
minWaitTime = 5000;
wait = true;
break;
for market closed error we have set to wait some time after next retry…. SIMPLE and it WORKS
You want to be a profitable algotrader? We started using StrateQuant software in early 2014. For now we have a very big knowhow for building EAs for every possible types of markets. We share this knowhow, apps, tools and also all final strategies with real traders. If you want to join us, fill in the FORM.
Tomáš Dušek
4 years ago #257383
in the old SQ3 code we made also the changes, so our tuned MQL code will take care about these basic errors case ERR_TRADE_CONTEXT_BUSY: msg = “Trade context busy”; wait = true; break; case ERR_BROKER_BUSY: msg = “Broker busy”; wait = true; break; case ERR_SERVER_BUSY: msg = “Server busy”; wait = true; break; case ERR_MARKET_CLOSED: msg = “Market closed”; minWaitTime = 5000; wait = true; break; for market closed error we have set to wait some time after next retry…. SIMPLE and it WORKS
I searched for strategy code “case ERR_MARKET_CLOSED:” but it’s not there. I added it and I will see how it goes in the test.
Tomáš Dušek
4 years ago #257475
Thanks for your feedback. As you mentioned for the daily chart simply the OpenBarDelay parameter can be set to 5 or 6 but for H1 or H4 strategies this would cause some issues with not optimal entry fills. We will look into this how this could be improved
in the old SQ3 code we made also the changes, so our tuned MQL code will take care about these basic errors case ERR_TRADE_CONTEXT_BUSY: msg = “Trade context busy”; wait = true; break; case ERR_BROKER_BUSY: msg = “Broker busy”; wait = true; break; case ERR_SERVER_BUSY: msg = “Server busy”; wait = true; break; case ERR_MARKET_CLOSED: msg = “Market closed”; minWaitTime = 5000; wait = true; break; for market closed error we have set to wait some time after next retry…. SIMPLE and it WORKS
So it looks like the error will be in the missing error code “case ERR_MARKET_CLOSED:”
I just added “case ERR MARKET CLOSED:” to the strategy and the strategy repeatedly sent the order until the broker opened the market again.
Viewing 8 replies - 1 through 8 (of 8 total)