EA didn't execute trade?

 

I'm not sure why, but my EA is acting a little funny. I back test it, it executes the orders, and gernerates the "Pending Order Alert". However, when it is live, all it does is generate the alert, saying, "Pending order Alert".

I checked in the properties and along the program bar that the EA was authorized to make trades - and it was. I checked the journal and didn't see any errors on generating the error. So, if the EA works on a backtest, but not in a live test, what is going wrong?

 

Do you have access to the mq4?

Show the code and we'll have a look.

Have you checked the Experts tab for errors?

Are you sure that the EA is written to report any errors it encounters?


CB

 

I added the getlasterrror to the code, and it returned "129" Invalid Price?! Why would it throw off an invalid price error if I am use Bid/Ask?!

 
Calpurnia:

I added the getlasterrror to the code, and it returned "129" Invalid Price?! Why would it throw off an invalid price error if I am use Bid/Ask?!

It could be because the contents of Ask/Bid have gone a bit stale due to a fast moving market.

Try implementing a RefreshRates() call immediately before your OrderSend() - or moving it closer if you already have implemented it.


CB

 

I put the refreshrates right in front of the order send, and it didn't work...Not sure why its happening...could it be bad data coming in for the stop loss or take profit? I didn't think so, because that would throw off error code 130 instead of 129, wouldn't it?

I think i figured it out...The price was set at bid instead of ask, so it was only willing to execute at 2 pips under the price. DUUHH!!!!!!

Thanks for the help though cloudy...you got the wheels turnin :)

 

Try the same by setting the takeprofit and stoploss to 0. I had the same issue and on doing this it got resolved. I'm not too experienced with mql4 but this is what I did - followed by a modify order to update the SL and TP for the order.

Reason: