Which prevents the advisor from making money. - page 5

 
Roman.:

BEFORE TALO. Until selected in the cycle:



I don't think that's right, because it might already be closed. And you will hang in the loop. And after these hangs, the terminal often has to be reinstalled.
 
valenok2003:

it all makes sense

just these two reasons or could there be something else?
An order can be closed partially, reopened with a different ticket, change type... for this you need to keep track of them - correctly. Through arrays.
 
valenok2003:


I don't think this is right, because it might already be closed. And you'll be stuck in a loop. And after such hiccups the terminal often has to be reinstalled.

never happened - if it's closed, it won't go into a programme execution loop...

for (int orderIndex = (OrdersTotal() - 1); orderIndex >= 0; orderIndex--)
 
Roman.:
The order can be closed partially, re-opened with a different ticket, change the type... For this you need to keep track of them - correctly. Through arrays.

I have a slightly different approach to accounting, although you can't do without arrays, that's true

However, let's get down to business...

If the order is not selected, what will the OrderType() or OrderTicket() be equal to, for example?

 
valenok2003:

However, to our rams...

if an order is not selected, what does OrderType() or OrderTicket() equal, for example? is this somehow provided for in MocL?


Oh, dear! It goes in the annals!

 
valenok2003:

I have a slightly different approach to accounting, although you can't do without arrays, that's true

However, let's get down to business...

If an order is not selected, what does OrderType() or OrderTicket() equal, for example?

You're not looking for a catch where there is none. Put this code in your owl and enjoy your life.

I checked it myself - in online (not to mention in tester) everything works fine and without failures, even without arrays...

With arrays - also traded - everything works.

 
Roman.:

never happened - if it's closed, it won't enter the programme execution loop...



Roma, don't lie, the first time you wrote

while(OrderSelect(ticket,SELECT_BY_TICKET)==false)
 
PapaYozh:


Oh, my God! It's going in the annals!

Let me rephrase, when you try to select a non-existent order, what happens to the data?
 

This construct was originally in someone's post with the question: How do I know the price of an order? the answer I used in this loop - see above.

Here is that answer to that question:

    int ticket=OrderSend(Symbol(),OP_SELL,0.01,Bid,5,0,0,"OrderOpenOne",14774,0,CLR_NONE);
    if (ticket>0)                                               // Если позиция открылась
    {
       while(OrderSelect(ticket,SELECT_BY_TICKET)==false)       // Если ордер выбран
       {
          Sleep(100);
       }
       double OpenPrice=OrderOpenPrice();
    }

 
valenok2003:



Roma, don't lie, the first time you wrote

As I have done on all subsequent occasions. I'm as honest as I've ever been. :-)

This construction is used in the loop - see carefully - it's all there... the first, second and third time - everything is the same everywhere!

Reason: