Questions from Beginners MQL5 MT5 MetaTrader 5 - page 1059

 
leonerd:

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.

After "Code (Alt+S)" comes "Style". Click on the arrow and see "Quote (Ctrl+3)"

 
Artyom Trishkin:

After "Code (Alt+S)" comes "Style". Click on the arrow and see "Quote (Ctrl+3)"

That's terrible :)

 
leonerd:

There is obviously some kind of logical error here. MqlTradeResult is the result of trade operation.

I.e. if Result.price was called Result.dealprice, everything would be logical?

 
fxsaber:

I.e. if Result.price was called Result.dealprice, it would be all logical?

The field

Description

retcode

Returncode of the trade server

deal

Deal ticket, if a deal has been performed. Reported in theTRADE_ACTION_DEAL trade operation

order

Order ticket, if a ticket has been placed. Notified during aTRADE_ACTION_PENDING trade operation

volume

Volume of the trade confirmed by the broker. It depends onthe order filling type

price

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

bid

Current market bid price (requote price)

ask

Current market bid price (requote prices)

comment

Broker's comment to the operation (by default it is filled with the decoding of the trade server's return code)

request_id

Request ID to be filled in by the terminal when sending it to the trade server

retcode_external

Code of the error returned by the external trade system. Stating and types of these errors depend on a broker and an external trade system, into which the trade operations are output


There are deal and order. There is volume for both. Why is price only for deal? Well, we can do dealprice, but then we need a dealorder field as well. It seems to me that price should simply be the price of the order, if the trade is not made and the order is set.

 
leonerd:

Field

Description

retcode

Returncode of the trade server

deal

Deal ticket, if a deal has been performed. Reported in theTRADE_ACTION_DEAL trade operation

order

Order ticket, if a ticket has been placed. Notified during aTRADE_ACTION_PENDING trade operation

volume

Volume of the trade confirmed by the broker. It depends onthe order filling type

price

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

bid

Current market bid price (requote price)

ask

Current market bid price (requote prices)

comment

Broker's comment to the operation (by default it is filled with the decoding of the trade server's return code)

request_id

Request ID to be filled in by the terminal when sending it to the trade server

retcode_external

Code of the error returned by the external trade system. Stating and types of these errors depend on a broker and an external trade system, into which the trade operations are output


There are deal and order. There is volume for both. Why is price only for deal? Well, we can do dealprice, but then we need a dealorder field as well. It seems to me that price should simply be the price of the order if the trade has not been executed and an order has been set.

Create a petition to include Result.price for orders. And make it complete - demand to include Result.expiration, second price for STOP_LIMIT orders, etc.


// Пока петиция не прошла
bool OrderSend_leonerd( const MqlTradeRequest &Request, MqlTradeResult &Result )
{
  const bool Res = OrderSend(Request, Result);
  
  if (Res && !Result.order)
    Result.order = Request.order;
    
  return(Res);
}

// Делаем за разработчиков их работу
#define OrderSend OrderSend_leonerd
 

Hello

Sometimes when I open an order the error 4754-Ordernot found appears

That's all the EA hangs because it tries to open an order

Reinstalling the EA helps

I use CTrade class to open an order

Please, advise what may be wrong?

 
Mikhail Rudyk:

Hello

Sometimes when I open an order the error 4754-Ordernot found appears

That's all the EA hangs because it tries to open an order

Reinstalling the EA helps

I use the CTrade class to open an order

Please, advise what it may be?

Can you be more precise? MQL5 Code, symbol, timeframe. This is the place where the error is shown.

It is hard to say something definite without these data.

 
Does Codebase have an EA with "one trade per bar" function? (Excluding EAs working on bar opening)
 

In MQL5 I call the indicator handle in OnInit like this

diver_handle=iCustom(NULL,0,"ao_diver");

This call hangs the terminal completely.
The indicator is located in Indicators and does not require any additional input parameters.
What can be wrong with this call?

 
Evgeny Dyuka:

In MQL5 I call an indicator handle in OnInit like this

This call hangs the terminal completely.
The indicator lies in Indicators and does not require any additional input parameters.
What can be wrong with this call?

".ex5" specify.

Reason: