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?!
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.
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
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?