How to check if an order is selected - page 11

 
tara:
Would it make it easier if I said it did?)
I don't know if it gets easier or not, but they took me from my first year, such was the time, or I would never have served!
 
Ant_TL:

Yep. Right there:

int li_LastTicket = OrderTicket();

Your code will generate a 4105 execution error if there was no OrderSelect call before it was made. Just put a GetLastError check at the end of each tick and you will find this error.

In my code this error will not occur, as this function is called AFTER OrderSelect(). This check is inherited from the time when codes were written without a common structure of all executable EA functions.

In addition, most of my functions contain error handling functions and I am very careful to avoid them. And there are also a number of functions that generate an error, like the answer you were looking for:"Order selected earlier, or not?"

P.S. By the way, I remembered one peculiarity (may be useful for someone) of working with OrderSelect() functions from compiled libraries: we have selected an order (how - not principally), OrderTicket() - returns number of selected order. But if we want to get the properties of this selected order from the function which is located in the compiled library, we will get nothing. We have to select that order again (again).

 
borilunad:
I don't know if it's easier or not, but they took me from my first year, such was the time, or I would never have served!
I liked it:)
 
Are ticket and magik no longer identifiers? Or is it principled to work with two or three orders at once? There are arrays, there are functions that process and update these arrays. Or is it principled not to get caught in the mistake? So, do not get into mistakes. But do not whine that excessive order selections slow down testing. Everything has its time and place. When getting from one function to another, be a priori sure that you will have to select the order once again and store the processing data from the previous function in an array.
 
TarasBY: If we want to retrieve the properties of this selected order from a function in the compiled library, it will do NOTHING. We have to select that order again (all over again).
This is because MQL4 is not a compiler, but an interpreter. Library functions are attached as you go along:)
 
grell:
Are ticket and magik no longer identifiers? Or is it principled to work with two or three orders at once? There are arrays, there are functions that process and update these arrays. Or is it principled not to get caught in the mistake? So, do not get into mistakes. But do not whine that excessive order selections slow down testing. Everything has its time and place. When getting from one function to another, be a priori sure that you will have to select the order once again, while storing the processing data from the previous function in an array.
Dmitry, even without leaving the boundaries of one function, you can't be sure that the order selection sign won't change.
 
tara:
I liked it:)
Probably like "cheese in butter...? The army should be professional, as it requires special training, and we have been fed more politics! The army should serve the fatherland, the people, not the ruling party!
 
No, not like cheese in butter, but I did my fair share of service as a lieutenant colonel. Sorry if I offended you :(
 
tara:
Dimitri, even without leaving the confines of one function, you cannot be sure that the order selection sign will not change.


That's what I mean. My functions have no universality, each one is strictly engaged in its own business. Even buy and sell are separate. Slosewall does not leave the function until the entire order is executed. So, let the order numbers change, let the stops creep, but the ticket and the magician will stay.
 
I don't even hope that all order data is saved when the function is called. Therefore, there is no hope for this in any function.