How to check if an order is selected - page 3

 
FAQ:

order by select and nothing else.

The order selector does not know at all whether an order is currently selected, and which order is currently selected if it is selected, so you are completely wrong.

 
Ant_TL:

The order selector does not know if an order is currently selected at all, so you are quite wrong.

Look at any EA! You are the first to try to select on your own! Learn! Why are you so embarrassed at the whole forum?
 

For those in the tank :

1) a long time ago, in a distant function, you selected an order and did some work on it.

2) After a very long time, you want to access it again and find out more about its fate.

3) you contact the order and the terminal says: there is no order (i.e. the order has not been already selected, you have placed it, and you have successfully forgotten its name (ticket)). == error

What prevents you from selecting the order, at the moment you have already chosen it, to store its name (ticket) in a global variable, and then, instead of reverting to it using a long-forgotten name (ticket), select it using the value of this global variable.

If it contains the order name, then you'll get a positive answer that you haven't forgotten it, and you can learn its fate or make any actions with it.

But if you have forgotten its name, you just get a negative response from the order select function, and realize that the order must be searched in the list again.

Whew... that's a lot of text...

 
borilunad:
Look at any EA! You are the first to try to select it at your own discretion! Learn! Why are you so ashamed of yourself on the entire forum?

It's not me who is embarrassed, it's those who don't understand the basic things I write about (yet are quite aggressively trying to "lecture").

What does it mean to "check if an order is selected"?

It means that at any given moment of time in the execution of a program in mql4, there is such an internal construction, as the currently selected order. Just using OrderSelect, we can make selected any open/closed order by ticket or number in the list.

However, we cannot check whether an order is currently selected and what its number is via OrderSelect, but only select an order using the data we already know, such as its ticket or its number in the list.

 
FAQ:

for those who are in the tank :

For those who are in the tank, of course I can write my own function OrderSelect, which in addition to selecting an order will write its ticket to the global and then determine this ticket if I need to know whether the order is selected, but this is called a simple problem solving through the ...

 
FAQ:

For those in the tank :

1) A long time ago, in a distant function, you selected an order and did some work on it.

2) After a very long time, you want to access it again and find out more about its fate.

3) you contact the order and the terminal says: there is no order (i.e. the order has not been already chosen, you have placed it, and you have successfully forgotten its name (ticket)). == error

If this message actually prevents you from selecting the order, its name (ticket) will be stored in a global variable, and then instead of reverting to it (search) using a long forgotten name (ticket),

If it has the order name, you will receive a positive answer that you haven't forgotten it, and you can find out what happened to it or do something with it.

But if you have forgotten its name you get just a negative answer from the order select function, and you find out that the order has to be searched in the list again.

Whew... that's a lot of text...

He probably thinks we should look for the ticket by the number the DC gives us and we see on the chart?
 
Ant_TL:

The error is "scary" because there should be no error

The order may execute, and may return an error, and you can't avoid this error.

 
Figar0:

But it's not a programming error, and worse, you can't do without such "errors" in MQL. The order may execute, but it may return an error, and you can't avoid this error.

That's right. But I do not agree that we cannot go anywhere without such errors. Leaving such errors in code is just bad code. It is a situation when you cannot do without generating errors - a toolkit's defect. Errors of execution are quite a different thing, they are not really errors of the Expert Advisor, but it is an indication to the Expert Advisor of further actions to be taken.

 

In fact, there's been a lot of demagoguery.

bool OrderSelect( int index, int select, int pool=MODE_TRADES)
The function selects an order to work with it. Returns TRUE if the function completes successfully. Returns FALSE if the function fails. Call GetLastError() to get information about the error.

All you need to know whether an order is chosen or not.

Ant_TL:

If you say so, justify your point of view

void SomeFunс()

{

int tick=OrderTicket(); // Поразумевает ордер выбраный посредством OrderSelect  (ну или ошибку)

// ..... 

if(tick>0) OrderSelect(tick,SELECT_BY_TICKET);  // Так зачем его еще раз выбирать??? 
} 
 
borilunad:
He probably thinks we should look for the ticket by the number the DC gives us and we see on the chart?

No, he's really in the tank.