MQL5 send order error with request method in the last version

MQL5 send order error with request method in the last version

Manage alerts

Loading saved threads...

Jose · External communityPost link
External question — Stack Overflow Stack Exchange Author: Jose Original post: https://stackoverflow.com/questions/79443156 License: CC BY-SA 4.0 — https://creativecommons.org/licenses/by-sa/4.0/ Adaptation: HTML converted to plain text; contact email addresses removed. I'm trying to send the simplest command that exists with a script in MQL5. I still have problems, it doesn't execute. I want to use Request, no CTrade. Could anyone tell me what the cause is? I don't know if since the last update this method is no longer possible. This is the code: void OnStart() { MqlTradeRequest requestt {}; MqlTradeResult resultss {}; double R2R = 2; double Ask = SymbolInfoDouble(_Symbol, SYMBOL_ASK); double Bid = SymbolInfoDouble(_Symbol, SYMBOL_BID); requestt.action = TRADE_ACTION_DEAL; requestt.symbol = Symbol(); requestt.volume = 1; requestt.sl = Ask - 100 * Point(); requestt.tp = Ask + R2R * 100 * Point(); requestt.type = ORDER_TYPE_BUY; requestt.price = Ask; OrderSend(requestt, resultss); }
Quote
Report
Salar Hamidi · External communityPost link
External answer — Stack Overflow Stack Exchange Author: Salar Hamidi Original post: https://stackoverflow.com/a/79529877 License: CC BY-SA 4.0 — https://creativecommons.org/licenses/by-sa/4.0/ Adaptation: HTML converted to plain text; contact email addresses removed. This function still works. Check your request before sending. MqlTradeCheckResult checkResult {}; if(OrderCheck(requestt, checkResult)) bool isSend = OrderSend(requestt, resultss);
Quote
Report

Post Reply

Checking account access…