Help to get a ticket for a single pending order. It doesn't work like this:
Why don't you do a check to see exactly what you've retrieved?
Run the example from the help OrderGetTicket is a script:
voidOnStart()
{
//--- переменные для получения значений из свойств ордера ulong ticket;
double open_price;
double initial_volume;
datetime time_setup;
string symbol;
string type;
long order_magic;
long positionID;
//--- количество текущих отложенных ордеров uint total=OrdersTotal();
//--- пройдем в цикле по всем ордерам for(uint i=0;i<total;i++)
{
//--- получим тикет ордера по его позиции в списке if((ticket=OrderGetTicket(i))>0)
{
//--- получим свойства ордера
open_price =OrderGetDouble(ORDER_PRICE_OPEN);
time_setup =(datetime)OrderGetInteger(ORDER_TIME_SETUP);
symbol =OrderGetString(ORDER_SYMBOL);
order_magic =OrderGetInteger(ORDER_MAGIC);
positionID =OrderGetInteger(ORDER_POSITION_ID);
initial_volume=OrderGetDouble(ORDER_VOLUME_INITIAL);
type =EnumToString(ENUM_ORDER_TYPE(OrderGetInteger(ORDER_TYPE)));
//--- подготовим и выведем информацию об ордере printf("#ticket %d %s %G %s at %G was set up at %s",
ticket, // тикет ордера
type, // тип
initial_volume, // выставленный объем
symbol, // символ, по которому выставили
open_price, // указанная цена открытия TimeToString(time_setup)// время установки ордера
);
}
}
//---
}
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.
Help to get a ticket for a single pending order. It doesn't work like this:
Help to get a ticket for a single pending order. It doesn't work like this:
The numbering of the order list starts with zero, not one.
I have tried zero as well.
Help to get a ticket for a single pending order. It doesn't work like this:
Why don't you do a check to see exactly what you've retrieved?
Run the example from the help OrderGetTicket is a script: