fxea729:
Is the current price and the stop price too closed?
Probably, especially as you are getting the Bid price when BuyStop orders are at Ask
Thank you very much. You are right, the problem is related to ask price
PS 0 16:16:51.389 Core 1 2018.08.30 19:25:00 bitPrice: 1198.500000, askPrice: 1198.730000, Point: 0.001000, Digits: 3 RJ 0 16:16:51.389 Core 1 2018.08.30 19:25:04 sell stop 0.01 XAUUSD at 1197.840 sl: 1202.840 tp: 1197.340 (1198.500 / 1198.730 / 1198.500) EI 0 16:16:51.389 Core 1 2018.08.30 19:25:04 retcode=10009 deal=0 order=782 HL 0 16:16:51.389 Core 1 2018.08.30 19:30:00 bitPrice: 1197.800000, askPrice: 1198.000000, Point: 0.001000, Digits: 3 CH 2 16:16:51.389 Core 1 2018.08.30 19:30:00 failed sell stop 0.01 XAUUSD at 1197.840 sl: 1202.840 tp: 1197.340 [Invalid price] EK 0 16:16:51.389 Core 1 2018.08.30 19:30:00 OrderSend error 4756 IR 0 16:16:51.389 Core 1 2018.08.30 19:30:00 retcode=10015 deal=0 order=0

You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
I have a EA which will place buy stop or sell stop.
I find that there are some orders cannot be set due to error, TRADE_RETCODE_INVALID_PRICE.
Here is the log, from the same EA, one trade is success and the other is not:
lastPrice is come from this code:
Is the current price and the stop price too closed?