MQL5 Place Market order with tp and sl
Running through strategy tester
I have the following snippet of code which returns 0 into ticket.
The journal shows:
2014.05.06 19:16:48.519 2014.01.22 01:42:00 failed market sell 0.01 EURUSD sl: 1.35770 tp: 1.35570 [Unsupported filling mode]
2014.05.06 19:16:48.519 2014.01.22 01:41:00 Alert: The sell order could not be completed 4756
The following is contained in my mRequest and mResult:
MqlTradeRequest mRequest;
MqlTradeResult mResult;
MqlTradeRequest{ action:TRADE_ACTION_DEAL magic:12345678 order:0 symbol:"EURUSD" volume:0.01 price:1.39296 stoplimit:0 sl:1.39396 tp:1.39196 deviation:200 type:ORDER_TYPE_SELL type_filling:ORDER_FILLING_FOK type_time:ORDER_TIME_GTC expiration… }
MqlTradeResult{ retcode:0 deal:0 order:0 volume:0 price:0 bid:0 ask:0 comment:NULL request_id:0 reserved:[128] }
Does Anyone know what Im doing wrong here - Im new to MT4 and MT5?
OK - I got it to execute by using ORDER_FILLING_IOC in place of ORDER_FILLING_FOK
Can I ask how did you know that was the problem is that a known issue/experiece or did you see something in what I posted to indicate that?
I also moved the
ZeroMemory(mRequest);
ZeroMemory(mResult);
If anyone else reads the post!
Many Thanks
OK - I got it to execute by using ORDER_FILLING_IOC in place of ORDER_FILLING_FOK
Can I ask how did you know that was the problem is that a known issue/experiece or did you see something in what I posted to indicate that?
I also moved the
If anyone else reads the post!
Many Thanks
Your log reported :
failed market sell 0.01 EURUSD sl: 1.35770 tp: 1.35570 [Unsupported filling mode]
and you show the content of your MqlTradeRequest with ORDER_FILLING_FOK. So, with my little experience
OK - I got it to execute by using ORDER_FILLING_IOC in place of ORDER_FILLING_FOK
Can I ask how did you know that was the problem is that a known issue/experiece or did you see something in what I posted to indicate that?
I also moved the
If anyone else reads the post!
Many Thanks
Hi robertbaptie, as you changed your filling mode, take care about your result processing (mResult.retcode), since now you can have partial deal volume filling, for instance:
10010 | TRADE_RETCODE_DONE_PARTIAL | Only part of the request was completed |
Hi robertbaptie, as you changed your filling mode, take care about your result processing (mResult.retcode), since now you can have partial deal volume filling, for instance:
10010 | TRADE_RETCODE_DONE_PARTIAL | Only part of the request was completed |

any idea why ORDER_FILLING_IOC is not allowed on Market Orders?
is it a broker-specific thing? or a metatrader thing?
any idea why ORDER_FILLING_IOC is not allowed on Market Orders?
is it a broker-specific thing? or a metatrader thing?

- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Running through strategy tester
I have the following snippet of code which returns 0 into ticket.
The journal shows:
2014.05.06 19:16:48.519 2014.01.22 01:42:00 failed market sell 0.01 EURUSD sl: 1.35770 tp: 1.35570 [Unsupported filling mode]
2014.05.06 19:16:48.519 2014.01.22 01:41:00 Alert: The sell order could not be completed 4756 = Account Error - send order?
The following is contained in my mRequest and mResult:
MqlTradeRequest{ action:TRADE_ACTION_DEAL magic:12345678 order:0 symbol:"EURUSD" volume:0.01 price:1.39296 stoplimit:0 sl:1.39396 tp:1.39196 deviation:200 type:ORDER_TYPE_SELL type_filling:ORDER_FILLING_FOK type_time:ORDER_TIME_GTC expiration… }
MqlTradeResult{ retcode:0 deal:0 order:0 volume:0 price:0 bid:0 ask:0 comment:NULL request_id:0 reserved:[128] }
Does Anyone know what Im doing wrong here - Im new to MT4 and MT5?