LM009:12:51.596Core 12023.05.08 04:24:20 ===== ERROR - failed to open sell position with error code 4756 and trade result error 10016 = invalid stops =====
DG009:12:51.596Core 12023.05.08 05:10:20 ===== ERROR - failed to open sell position with error code 4756 and trade result error 10016 = invalid stops =====
Allow the use of cookies to log in to the MQL5.com website.
Please enable the necessary setting in your browser, otherwise you will not be able to log in.
You are signed in. Two-factor authentication has been disabled. Set it up again and scan a new QR code, or continue with two-factor authentication disabled.
Having trouble to opening sell trade on all currency that the second currency is JPY (AUDJPY, NZDJPY, etc).
The error code is 4756 and the trade server error is 10016 which is invalid stops. Here's the log of the problem trade,
LH 0 09:12:51.596 Core 1 2023.05.08 04:24:20 ===== TRADE PARAMETER >>>>> Symbol: AUDJPY, Volume: 0.15, Price: 90.997, sl: 91.0015, tp: 90.98350000000002, magic number: 2090
MQ 2 09:12:51.596 Core 1 2023.05.08 04:24:20 failed market sell 0.15 AUDJPY sl: 91.002 tp: 90.984 [Invalid stops]
FN 0 09:12:51.596 Core 1 2023.05.08 04:24:20 CTrade::OrderSend: market sell 0.15 AUDJPY sl: 91.001 tp: 90.984 [invalid stops]
LM 0 09:12:51.596 Core 1 2023.05.08 04:24:20 ===== ERROR - failed to open sell position with error code 4756 and trade result error 10016 = invalid stops =====
KP 0 09:12:51.596 Core 1 2023.05.08 04:24:20 request result: Direction=buy Price=90.99700 SL=91.00150 TP=90.98350 TypeFilling=fill or kill
DM 0 09:12:51.596 Core 1 2023.05.08 05:10:20 ===== TRADE PARAMETER >>>>> Symbol: NZDJPY, Volume: 0.13, Price: 84.915, sl: 84.92, tp: 84.90500000000002, magic number: 2090
PD 2 09:12:51.596 Core 1 2023.05.08 05:10:20 failed market sell 0.13 NZDJPY sl: 84.920 tp: 84.905 [Invalid stops]
ND 0 09:12:51.596 Core 1 2023.05.08 05:10:20 CTrade::OrderSend: market sell 0.13 NZDJPY sl: 84.920 tp: 84.905 [invalid stops]
DG 0 09:12:51.596 Core 1 2023.05.08 05:10:20 ===== ERROR - failed to open sell position with error code 4756 and trade result error 10016 = invalid stops =====
QK 0 09:12:51.596 Core 1 2023.05.08 05:10:20 request result: Direction=buy Price=84.91500 SL=84.92000 TP=84.90500 TypeFilling=fill or kill
Here's the code to open the trade,
I think I've check all the things that will resulting in 'invalid stops' error, do I missed something here?
NB: 1. Sl and Tp using bid price to have equal distance, and it still close at close price.
2. Adding NormalizeDouble() doesn't help since the price already normalize on trade server.