Error 1 on OrderSend - page 2

 

Right Gentlemen,

The mystery deepens.

I got another error ... still trying to place orders at 0.000

This is from Experts:

2013.10.31 12:35:00 JagLibrary GBPJPYi,M15: dir: 1 Symb: GBPJPYiAsk: 157.75800000 Lots: 1.20000000 Slippage: 2 Slip & pips2points: 20.00000000 StopLossLevel: 157.26900000 TakeProfitLevel: 158.50900000 tradeCom: BUY Jag CCI252 v1.11 LIB MagicNumber: 100 arrowColor: 13434880

This is from Journal:

2013.10.31 12:35:00 '86049303': order buy 1.20 GBPJPYi opening at 0.000 sl: 157.269 tp: 158.509 failed [Trade timeout]

It's correctly getting the Ask price, but still tries to open a trade at 0.000

Any suggestions?

 
  1. Your question concerns Error 1 but the message says "Trade timeout" two different problems
  2. Perhaps this is an ECN problem with a different symptom. Previously trying to set TP/SL with opening gave error 130. Try opening and then setting them.
 
bentbawer:

Right Gentlemen,

The mystery deepens.

I got another error ... still trying to place orders at 0.000

This is from Experts:

2013.10.31 12:35:00 JagLibrary GBPJPYi,M15: dir: 1 Symb: GBPJPYiAsk: 157.75800000 Lots: 1.20000000 Slippage: 2 Slip & pips2points: 20.00000000 StopLossLevel: 157.26900000 TakeProfitLevel: 158.50900000 tradeCom: BUY Jag CCI252 v1.11 LIB MagicNumber: 100 arrowColor: 13434880

This is from Journal:

2013.10.31 12:35:00 '86049303': order buy 1.20 GBPJPYi opening at 0.000 sl: 157.269 tp: 158.509 failed [Trade timeout]

It's correctly getting the Ask price, but still tries to open a trade at 0.000

Any suggestions?

Show your error reporting from the experts log file, we need to know the error number.
 

Hi,

I don't know whether it helps, but I have got this Error #1 in the StrategyTester from OrderModify(..) after I tried to change ProfitTarget to 0.0 which was already set to 0.0.

So it could be Error #1 means stupid parameters has been send, but nothing bad happens?

 
bentbawer: Error 1 on ordermodify is an old issue with a well known cause, but i'm getting error 1 on opening an order.
You said you already know about that. Why are you modifying the order with no changes? Stay on topic - your OP was about orderSend.
 

RaptorUK:

From experts window:

2013.11.01 11:35:13 JagLibrary GBPJPYi,M15: dir: 2 Symb: GBPJPYi Bid: 156.90600000 Lots: 0.37000000 Slippage: 2 Slip & pips2points: 20.00000000 StopLossLevel: 157.40600000 TakeProfitLevel: 155.94900000 tradeCom: SELL LIB MagicNumber: 13 arrowColor: 255

2013.11.01 11:35:13 JagLibrary GBPJPYi,M15: Error opening SELL order. 1 = no error

From journal window:

2013.11.01 11:35:13 '86049297': order sell 0.37 GBPJPYi opening at 0.000 sl: 157.406 tp: 155.949 failed [Trade timeout]

The above shows that the EA fails to open a trade at price 0.0000 but when asked again, in my print statement, it manages to get the BID/ASK. As i'm running out of ideas, i might put an error handling function to sleep for a couple of seconds and then try again, but this is not ideal.

WHRoeder:

Yes, the message is timeout, but i'm assuming this is because MT4 cannot open an order with price 0.000

You probably got confused with the post from Gooly (above). My post was and still is about error 1 in Ordersend. From the extra bits of error reporting i added, we can now see that MT4 is throwing error 1 because it's unable to open a trade with price 0.000 and ends up giving a Trade timeout error.

 
Did you try what I suggested?
 

Hi WHRoeder,

Not yet, but there are a couple of reasons for that. Firstly, the problem i'm having only happens in a few symbols (mainly NZDJPY and GBPJPY) and i'm assuming that if the broker was ECN and didn't allow SL and TP within ordersend, i'd get the same error with all pairs. It's currently trading 16 pairs as a test, to spot problems like the one i'm having now. Secondly i have demo accounts from the same broker but with different settings, and only demos from a specific group (with different spread) that give that error.

I contacted the broker support to ask about the differences between the two groups, but i was informed that only the spread changes between them.

As a test i decided to get the BID and ASK inside variables and then pass them to OrderSend. As soon as i get those values i print them in the terminal. Check the lines below:

From Experts:

2013.11.04 15:13:17 JagLibrary NZDJPYi,M15: dir: 2 Symb: NZDJPYi Bid: 81.68100000 Lots: 0.71000000 Slippage: 2 Slip & pips2points: 20.00000000 StopLossLevel: 81.93900000 TakeProfitLevel: 81.23100000 tradeCom: SELL v1.9 MagicNumber: 13arrowColor: 255

2013.11.04 15:13:17 JagLibrary NZDJPYi,M15: Error opening SELL order. 1 = no error

2013.11.04 15:03:07 JagLibrary NZDJPYi,M15: Symbol: NZDJPYi Ask: 81.71400000 Bid: 81.68100000

From Journal:

2013.11.04 15:09:50 '86049297': order sell 0.71 NZDJPYi opening at 0.000 sl: 81.939 tp: 81.231 failed [Trade timeout]

As you can see above, i can get the BID and ASK values, but when the trade goes through, the price given is 0.000.

I just noticed the time stamps of the above msgs. They are up to 10 minutes apart. Clearly MT4 and/or VPS is struggling to send trades fast enough. I'll do some tests.

 

Firstly i would like to thank RaptorUK and WHRoeder for their help in improving my error reporting code and out-of-the-box thinking.


Conclusion

Error 1 is typically an OrderModify error. All the official documentation only mention this particular error in relation to OrderModify and that made me think, with the help of the above mentioned users, that having Error 1 on OrderSend was probably an error in itself.

The first mind blowing aspect of the error was that it would only happen with two specific pairs, NZDJPY and GBPJPY.

After some tweaks i started to get the real error code and message. Error 128: trade time out.

My now improved error reporting code showed that i could not obtain an ASK or BID prices (they showed as 0.0000) and hence the trade would time out. Strangely enough, i was able to Print() the values immediately before OrderSend(). Or so i thought ...

A few more days were spent on this problem until my last msg (above), where i noticed the time stamps of the log and decided to manually place trades. The youtube link (http://youtu.be/ZAPlmxQ1rg8) shows a screen recording of the moment i placed an order on AUDUSD and then NZDJPY. I made the video to show the problem to the broker's support team. They have since given me a VPS on the same server where they run their MT4 Server to further test the problem, which was on their side all along.

 
bentbawer:


I made the video to show the problem to the broker's support team. They have since given me a VPS on the same server where they run their MT4 Server to further test the problem, which was on their side all along.

Thanks for the update and well done for keeping at it