I am migrating from MQL4 to 5 and having a bump ride.
This order placement function I wrote isn't working.
I get this error message: '61059710': failed market buy 0.01 BTCUSD [Unsupported filling mode]
Can someone please help me get it right?
Why not to google before submitting a new topic?!
Btw Your code is not correct. Read the Documentation.
if (action == "buy") {request.type = ORDER_TYPE_BUY; request.price = SymbolInfoDouble(Symbol(),SYMBOL_ASK);} if (action == "sell") {request.type = ORDER_TYPE_SELL; request.price = SymbolInfoDouble(Symbol(),SYMBOL_BID);}
There are other successful retcodes.

- www.mql5.com
I am migrating from MQL4 to 5 and having a bump ride.
This order placement function I wrote isn't working.
I get this error message: '61059710': failed market buy 0.01 BTCUSD [Unsupported filling mode]
Can someone please help me get it right?
Hello,
you may use this way :
ENUM_ORDER_TYPE_FILLING fillMode = (ENUM_ORDER_TYPE_FILLING) SymbolInfoInteger(_Symbol,SYMBOL_FILLING_MODE); fillMode-=1; ... request.type_filling=fillMode; ...
Kind regards.
My works:
MqlTradeRequest Zlecenie;
if(TypZlec=="K"){
Zlecenie.action=TRADE_ACTION_DEAL; // Trade operation type
Zlecenie.magic=0; // ulong Expert Advisor ID (magic number)
Zlecenie.order=0; // ulong Order ticket
Zlecenie.symbol=Symbol(); // string Trade symbol
Zlecenie.volume=IleLotow; // double Requested volume in lots
Zlecenie.price=0; // double Price
Zlecenie.stoplimit=0; // double StopLimit level of the order
Zlecenie.sl=CenaSL; // double Stop Loss level of the order
Zlecenie.tp=CenaTP; // double Take Profit level of the order
Zlecenie.deviation=10; // ulong Max possible deviation in Points
Zlecenie.type=ORDER_TYPE_BUY; // ENUM Order type
Zlecenie.type_filling=ORDER_FILLING_FOK; // ENUM Order execution type
Zlecenie.type_time=ORDER_TIME_GTC; // ENUM Order expiration type
Zlecenie.expiration=0; // datetime Order expiration time
Zlecenie.comment=Komentarz; // string Order comment
Zlecenie.position=0; // Position ticket
Zlecenie.position_by=0;} // The ticket of an opposite position
if(TypZlec=="S"){
Zlecenie.action=TRADE_ACTION_DEAL; // Trade operation type
Zlecenie.magic=0; // ulong Expert Advisor ID (magic number)
Zlecenie.order=0; // ulong Order ticket
Zlecenie.symbol=Symbol(); // string Trade symbol
Zlecenie.volume=IleLotow; // double Requested volume in lots
Zlecenie.price=0; // double Price
Zlecenie.stoplimit=0; // double StopLimit level of the order
Zlecenie.sl=CenaSL; // double Stop Loss level of the order
Zlecenie.tp=CenaTP; // double Take Profit level of the order
Zlecenie.deviation=10; // ulong Max possible deviation in Points
Zlecenie.type=ORDER_TYPE_SELL; // ENUM Order type
Zlecenie.type_filling=ORDER_FILLING_FOK; // ENUM Order execution type
Zlecenie.type_time=ORDER_TIME_GTC; // ENUM Order expiration type
Zlecenie.expiration=0; // datetime Order expiration time
Zlecenie.comment=Komentarz; // string Order comment
Zlecenie.position=0; // Position ticket
Zlecenie.position_by=0;} // The ticket of an opposite position
MqlTradeResult Zwrot;
Zwrot.retcode=0; // uint Operation return code
Zwrot.deal=0; // ulong Deal ticket, if it is performed
Zwrot.order=0; // ulong Order ticket, if it is placed
Zwrot.volume=0; // double Deal volume, confirmed by broker
Zwrot.price=0; // double Deal price, confirmed by broker
Zwrot.bid=0; // double Current Bid price
Zwrot.ask=0; // double Current Ask price
Zwrot.comment=""; // string Broker comment to operation (dft. server return code)
Zwrot.request_id=0; // uint Request ID set by the terminal during the dispatch
Zwrot.retcode_external=0; // Return code of an external trading system
Wynik=OrderSend(Zlecenie,Zwrot);
OdpSerw=Zwrot.retcode;
if(Wynik==true){
if(OdpSerw==TRADE_RETCODE_DONE){
ObjectDelete(0,"sl");
MessageBox(Komentarz,NULL,MB_ICONASTERISK);
return;}}

- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
I am migrating from MQL4 to 5 and having a bump ride.
This order placement function I wrote isn't working.
I get this error message: '61059710': failed market buy 0.01 BTCUSD [Unsupported filling mode]
Can someone please help me get it right?