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
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.
You can try this code:
// Define your "now" variable:
// the code for opening trades:
if( now != iTime(NULL,PERIOD_D1,0) )
now = iTime(NULL,PERIOD_D1,0);
else Print("Error opening SELL STOP order : ",GetLastError());
Forum on trading, automated trading systems and testing trading strategies
Please use the SRC button when you post code. Thank you.
This time, I edited it for you.
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
Please do a little research about recent news involving the Alpari broker.
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
Trying to find an answer I came across
this similar thread at strategyquant.
lead to this explanation of the problem and a possible solution.
will be trying this out next week to see if it is a fix.