I must have missed something in OOP self-training. I take a function to modify a pending order:
OrderModify
Изменяет параметры отложенного ордера.
bool OrderModify(
ulong ticket, // тикет ордера double price, // цена исполнения double sl, // цена stop loss double tp, // цена take profit
ENUM_ORDER_TYPE_TIME type_time, // тип по истечению
datetime expiration, // истечение double stoplimit // цена Limit ордера
)
Параметры
ticket
[in] Тикет ордера.
price
[in] Новая цена, по которой ордер должен быть исполнен (либо предыдущее значение, если изменение не нужно).
sl
[in] Новая цена, по которой сработает Stop Loss (либо предыдущее значение, если изменение не нужно).
tp
[in] Новая цена, по которой сработает Take Profit (либо предыдущее значение, если изменение не нужно).
type_time
[in] Новый тип ордера по истечению из перечисления ENUM_ORDER_TYPE_TIME (либо предыдущее значение, если изменение не нужно).
expiration
[in] Новый срок истечения отложенного ордера (либо предыдущее значение, если изменение не нужно).
stoplimit
[in] Новая цена, по которой будет выставлен Limit ордер при достижении ценой значения price. Указывается только для StopLimit ордеров.
Возвращаемое значение
true - в случае успешной базовой проверки структур, иначе false.
Примечание
Успешное окончание работы метода OrderModify(...) не всегда означает успешное совершение торговой операции.
Необходимо проверять результат выполнения торгового запроса (код возврата торгового сервера) вызовом метода ResultRetcode().
and I specify only ticket, price, sl and tp values. The compiler generates an error that the number of parameters is incorrect. As far as I remember, if other parameters are not needed to modify a pending order, they could be omitted. Or am I confused with something?
But when I fill the parameters type_time and expiration that I do not need with zeros, then there is no error.
and I specify only ticket, price, sl and tp values. The compiler generates an error that the number of parameters is incorrect. As far as I remember, if other parameters are not needed to modify a pending order, they could be omitted. Or am I confused with something?
But when I fill the parameters type_time and expiration that I don't need with zeros, then there is no error.
Regards, Vladimir.
OOP has nothing to do with it, you should observe syntax when calling a function
//+------------------------------------------------------------------+//| Script program start function |//+------------------------------------------------------------------+voidOnStart()
{
//---
OrderModify(0,0,0,0,0,0,0);
}
//+------------------------------------------------------------------+bool OrderModify(
ulong ticket, // тикет ордера double price, // цена исполнения double sl, // цена stop loss double tp, // цена take profit ENUM_ORDER_TYPE_TIME type_time, // тип по истечению datetime expiration, // истечение double stoplimit // цена Limit ордера
)
{
//тело функцииreturn(true);
}
and I specify only ticket, price, sl and tp values. The compiler generates an error that the number of parameters is incorrect. As far as I remember, if other parameters are not needed to modify a pending order, they could be omitted. Or am I confused with something?
But when I fill the parameters type_time and expiration that I don't need with zeros, then there is no error.
Regards, Vladimir.
Hi Vladimir. You should zeroise the structure before filling it. There is rubbish stuck in these fields and the compiler considers it as entered values.
Hi Vladimir. You should zeroise the structure before filling it. There is rubbish stuck in these fields and the compiler considers it as entered values.
He has an error in compilation, not in sending the order.
Hi Vladimir. You should zeroise the structure before filling it. There is rubbish stuck in these fields and the compiler considers it as entered values.
Allow the use of cookies to log in to the MQL5.com website.
Please enable the necessary setting in your browser, otherwise you will not be able to log in.
You are signed in. Two-factor authentication has been disabled. Set it up again and scan a new QR code, or continue with two-factor authentication disabled.
I'm sure it'll be a lot better now. And I won't be draining as fast as I used to.
Good luck in trading!
Regards, Vladimir.
Good luck with your trading!
Regards, Vladimir.
Thank you! Likewise.
Good morning everyone!
I must have missed something in OOP self-training. I take a function to modify a pending order:
and I specify only ticket, price, sl and tp values. The compiler generates an error that the number of parameters is incorrect. As far as I remember, if other parameters are not needed to modify a pending order, they could be omitted. Or am I confused with something?
But when I fill the parameters type_time and expiration that I do not need with zeros, then there is no error.
Regards, Vladimir.
and I specify only ticket, price, sl and tp values. The compiler generates an error that the number of parameters is incorrect. As far as I remember, if other parameters are not needed to modify a pending order, they could be omitted. Or am I confused with something?
But when I fill the parameters type_time and expiration that I don't need with zeros, then there is no error.
Regards, Vladimir.
OOP has nothing to do with it, you should observe syntax when calling a function
and I specify only ticket, price, sl and tp values. The compiler generates an error that the number of parameters is incorrect. As far as I remember, if other parameters are not needed to modify a pending order, they could be omitted. Or am I confused with something?
But when I fill the parameters type_time and expiration that I don't need with zeros, then there is no error.
Regards, Vladimir.
Hi Vladimir. You should zeroise the structure before filling it. There is rubbish stuck in these fields and the compiler considers it as entered values.
Hi Vladimir. You should zeroise the structure before filling it. There is rubbish stuck in these fields and the compiler considers it as entered values.
He has an error in compilation, not in sending the order.
I agree with the zeros.OOP has nothing to do with it, you have to respect the syntax when calling a function
In procedural programming in MQL5 to modify a pending order the use of
is not required at all. This may be the reason for misunderstanding how the OrderModify() function works in OOP.
Regards, Vladimir.
Hi Vladimir. You should zeroise the structure before filling it. There is rubbish stuck in these fields and the compiler considers it as entered values.
Hi Alexey, thanks for the hint.
Regards, Vladimir.
In MQL5 procedural programming to modify a pending order the use of
is not required at all. This may be the reason for misunderstanding how the OrderModify() function works in OOP.
Regards, Vladimir.
can you insert a function from the procedural variant?
can you insert a function from the procedural version?
I can. Taken from MetaEditor 5 Reference Manual
Regards, Vladimir.