Any rookie question, so as not to clutter up the forum. Professionals, don't pass by. Nowhere without you - 6. - page 883

 

I still don't understand - according to the tutorial, the index 10in theOrderSelect(10,SELECT_BY_POS)function parameters is the index number of the order in the list. In what list? What does the list look like and how is it formed?

To clarify the purpose: I'm trying to fix the "return value of 'OrderClose' should be checked" warning.

 
rapid_minus:
I still don't understand - according to the tutorial, the index 10 in theOrderSelect(10,SELECT_BY_POS) function parameters is the index number of the order in the list. In what list? What does the list look like and how is it formed?
From 0 to OrdersTotal()-1, where 0 is the oldest order. It would be better to loop the order by comparing each selected order with the required criteria (symbol, magician, type, etc.).
 
evillive:
From 0 to OrdersTotal()-1, where 0 is the oldest order. It is better to cycle through the orders, comparing each selected order with the required criteria (symbol, magik, type, etc.).

I'm having trouble with the cycle: with a certain combination of indicator values, only one specific position is opened. And then there is an analysis of indicator values on the condition of closing this position. How do I compare this single order with a symbol, magik, type of what? On the contrary, I need to compare the combination of indicator values formed at the moment (on the given tick) to find out if this combination is suitable to close this open order or not.

 

If you forbid to work with pending orders, to work with several symbols in parallel, or worse, several Expert Advisors in parallel with manual trading, it does not mean that it will continue the same way. Therefore, we should take everything into account to avoid being hurt and confused later.

The list may look like 0 - BuyStop at 1.1000 EUR; 1 - Sell at 120.17 Yen; 2 - Buy at 0.9500 CHF - a total of three orders and you need to process only one of them, in the loop to find and "defuse" it. You wait for instructions from your indicator and as soon as there is a signal, the necessary order is searched for and closed. There is no universal code, everyone writes his own preferences and TS, but there are different variants in kodobase.

 
rapid_minus:

I'm having trouble with the cycle: with a certain combination of indicator values, only one specific position is opened. And then there is an analysis of indicator values on the condition of closing this position. How do I compare this single order with a symbol, a magik, a type of what? On the contrary, I need to compare the combination of indicator values formed at the given moment (on the given tick) to see if this combination is suitable to close this open order or not.

It makes sense. If you trade a single order, just remember its Ticket when it is opened and then close this order when all the conditions for closing are fulfilled.
 
evillive:
From 0 to OrdersTotal()-1, where 0 is the oldest order. It's better to loop through the orders, comparing each selected order with the required criteria (symbol, magician, type, etc.).

Actually I don't quite understand the meaning of the warning "OrderClose return value must be checked".
 
tara:
It makes sense. If you trade a single order, just remember the Ticket when you open it and then close that order when all closing conditions are met.
I can't find in the tutorial how to technically remember the order's Ticket, and how to call it.
 
rapid_minus:
I can't find in the tutorial how to technically do this - remember the Order Ticket, and how to call it.

x=OrderSend(...

int x>0 - Order Ticket, a unique number generated by the server in response to a valid order.

 
tara:

x=OrderSend(...

int x>0 - order ticket, unique number generated by server in response to correct order.

Thanks for the specifics. What remains unclear is how to make this ticket returned by OrderSend() visible to the OrderClose() function? After all, I don't know it beforehand to insert it in the OrderClose() function.
 
rapid_minus:
Thanks for the specifics. What remains unclear is how to make this ticket, returned by OrderSend() function, visible to OrderClose() function? After all, I don't know it beforehand to insert it into the OrderClose() function.
The content of global variable in the terminal is stored throughout its lifetime, it shouldn't change before the new order. And it means that the ticket can be read and the order can be selected. And you can close it after that - like two fingers...
Reason: