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?
ZeroMemory(mRequest);
mRequest.action = TRADE_ACTION_DEAL; // immediate order execution
mRequest.price = NormalizeDouble(latestPrice.ask,_Digits); // latest ask price
mRequest.sl = NormalizeDouble(latestPrice.ask + STP*_Point,_Digits); // Stop Loss
mRequest.tp = 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);
ZeroMemory(mResult);
if(mResult.retcode ==10009 || mResult.retcode == 10008){
Alert("Order has been placed ",mResult.order);
} else {
Alert(" The sell order could not be completed ",GetLastError());
ResetLastError();
return;
}