Questions from Beginners MQL5 MT5 MetaTrader 5 - page 1058

 

InMqlTradeResult result.price I get 0 when a limit order is executed (BUY STOP in my case).

The rest of the fields, such as volume, order, etc. come with data. Why price is 0? Or what is the correct way to do it?

p.s. I am watching in debugger on history.

 
leonerd:

InMqlTradeResult result.price I get 0 when a limit order is executed (BUY STOP in my case).

The rest of the fields, such as volume, order, etc. come with data. Why price is 0? Or what is the correct way to do it?

p.s. I'm looking in the debugger on the history.

Well it does. When ORDER_TYPE_BUY in result.price I get price, but when ORDER_TYPE_BUY_STOP there I get 0. Why?

 
The price in the trade confirmed by the broker. Depends on thedeviation field inthe trade request and/or the type oftrade


I.e. this is for a transaction only. And how to get the order price after setting it through OrderSend()? I mean throughMqlTradeResult response and not through any transaction handlers. We don't understand why if there is a deal, the response will contain the price but if there is a limit order, the price won't be there.

 
leonerd:

I.e. this is for a transaction only. And how to get the order price after setting it through OrderSend()? I mean throughMqlTradeResult response and not through any transaction handlers. It is somehow unclear why if there is a trade, the response will contain the price but if there is a limit order, we won't see its price.

Request.price.

 
fxsaber:

Request.price.

Hypothetically the request price can be changed on the server and the order can be set with a different price than the price in the order.

 
leonerd:

Hypothetically the request price could be changed on the server and the order could be set with a different price than the price in the order.

This is only possible if a market order is sent with Request.price = 0.

ZZY On MT4 this issue has never bothered anyone. Why should it be an issue on MT5?
 
fxsaber:

This is only possible if a market order is sent with Request.price = 0.

ZS On MT4 this issue never bothered anyone. For what reason should it arise on MT5?

There is obviously some kind of logical error here. MqlTradeResult is the result of a trade operation. A limit order is a trade operation? Yes. The volume and other parameters come to this structure. But why not the price? It is not clear.

 
leonerd:

There is obviously some kind of logical error here. MqlTradeResult is the result of a trade operation. A limit order is a trade operation? Yes. The volume and other parameters come to this structure. But why not the price? It is not clear.

A pending order is not a trade operation. It is an order to execute at the price specified in the order. A trade will occur upon execution of the order - a trade that will generate a position or modify an existing position, depending on the type of account (hedge, netting).

 
Artyom Trishkin:

A pending order is not a trade operation. It is an order to execute at the price specified in the order. A trade will happen upon the order being executed - a trade which will either originate or modify an existing position depending on the type of account (hedge, netting).

OK, I misspoke. Let's quote the original source:

Structure of trade request result (MqlTradeResult)

Inresponse toa trade request to place an order into the trading system, the trading server returns data containing the information about the trade request processing result as a special predefined structure MqlTradeResult.


p.s. Where is the quotation in the editor? Do I have to go into html? How inconvenient.

 

p.s. где ж тут цитирование в редакторе? Мне в хтмл что ли лезть? Как неудобно-то.

found
Reason: