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 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?

               mRequest.action = TRADE_ACTION_DEAL;                                // immediate order execution
               mRequest.price = NormalizeDouble(latestPrice.ask,_Digits);          // latest ask price
      = NormalizeDouble(latestPrice.ask + STP*_Point,_Digits); // Stop Loss
      = NormalizeDouble(latestPrice.ask - TKP*_Point,_Digits); // Take Profit
               mRequest.symbol = _Symbol;                                         // currency pair
               mRequest.volume = Lots;                                            // number of lots to trade
               mRequest.magic = EA_Magic;                                        // Order Magic Number
               mRequest.type = ORDER_TYPE_SELL;                                     // Buy Order
               mRequest.type_filling = ORDER_FILLING_FOK;                          // Order execution type
               mRequest.deviation=200; //Point size                                            // Deviation from current price
               //--- send order
               ticket = OrderSend(mRequest,mResult);
               Print("ticet: ",ticket);
               if(mResult.retcode ==10009 || mResult.retcode == 10008){
                  Alert("Order has been placed ",mResult.order);
               } else {
                  Alert(" The sell order could not be completed ",GetLastError());

You are using ORDER_FILLING_FOK where it’s not allowed apparently. But it’s only seeing your code, we can be sure.

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

Hi tflecknell1q, 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:


any idea why ORDER_FILLING_IOC is not allowed on Market Orders?

is it a broker-specific thing? or a metatrader thing?

Broker/market dependent, not related to MT specifically.