I believe I am doing the exact same as in the MQl5 guide, 820 and 1517.
Could someone tell me what I am doing wrong?
//--- Preparing the request
double BuyAsync(double volume)
{MqlTradeRequest request={};
request.price = SymbolInfoDouble(_Symbol(),SYMBOL_ASK); // Long
request.magic = EXPERT_MAGIC; // EA magic number so you can track trades
request.action = TRADE_ACTION_DEAL; // Market order
request.symbol = "EURUSD"; // Symbol
request.type = ORDER_TYPE_BUY; // Long
request.order = "OrderTicketBuy"; // The orderticket so you can trace the individual trade
request.deviation = 5; // Maximum price deviation
request.volume = 0.25; // This should be €25.000
request.tp = tpLong; // Take profit long
request.sl = slLong; // Stoploss long
request.comment = "Buy using OrderSendAsync()";
MqlTradeResult result={};
if(!OrderSendAsync(request,result))
{
Print(__FUNCTION__,": error ", GetLastError(),", retcode = ", result.retcode);
}
}
Thanks in advance!