How to check if an order is selected - page 5

 
borilunad:
Exactly! It's about you and there's also, "the priest had a dog..."

That would be fine, but I created this thread to discuss a specific problem, not Kim's functions. You want to talk about his functions, create a thread and talk to like-minded people.

 
borilunad:
... Where was he before?!
Distracted by nonsense: https://www.mql5.com/go?link=http://www.alpari.ru/ru/cnews/34227.html
 
Ant_TL:

That would be fine, but I created this thread to discuss a specific problem, not Kim's functions. If you want to talk about his functions, create a thread and talk to like-minded people.

There is no problem if you program by logic. Why create a thread if you are not interested in the opinion of others? There is nothing here to discuss! Many newbies have long since learned what you do not want to understand. You prevent yourself from thinking.
 
borilunad:
There is no problem if you program logically. Why create a thread if you're not interested in the opinions of others? There's nothing here to discuss! Many newbies learned long ago what you don't want to understand. You prevent yourself from thinking.

I have been writing complex trading systems on thousands of lines for several years and you claim that I don't understand the platitudes. It seems to me that you rather do not understand the subject.

 
Well, you really can't make it up! How come he doesn't pick a ticket in his TS? It's like a miracle in a sieve!
 
borilunad:
You really can't make it up as you go along! How come he doesn't choose a ticket in his TS? It's like miracles in a sieve!

Boris, today you also talked to FantasYGold:) A year ago he increased his deposit ten times faster on a bet right here :)
 
borilunad:
Well, you really can't make it up by design! How come he doesn't select a ticket in his TC? It's like a miracle in a sieve!

So let's say a ticket is selected, what do you propose to do next? Save it in a separate special variable, to know in another function that it was selected last, and then restore it?

That's A) redundant data and B) unnecessary complication of code, because you have to add code every time a ticket is selected somewhere

 
Ant_TL:

So let's say a ticket is selected, what do you propose to do next? Save it in a separate special variable, to know in another function that it was selected last, and then restore it?

This is A) redundant data and B) an unnecessary complication of the code, because you have to add code every time a ticket is selected somewhere

I did not suggest that to you! Every time you have to go through and recheck positions, because the situation changes. One position has closed and you have to recalculate it again, not you, of course, but the program.
 
borilunad:
I did not suggest that to you! Every time you have to go through and re-check positions, because the situation changes. One position has closed and you have to recalculate it again, not for you, of course, but for the program.

You might think that I'm trying to save a ticket value between different starts of the start function (between different ticks). If so, you're wrong: I'm talking about saving the value of a ticket within the same tick. Reread my explanation carefully.

 
Ant_TL:

How can I do this without generating a 4105 error if the current order is not selected?

if you have one position open

//+------------------------------------------------------------------+
//|                                          танковый программер.mq4 |
//|                        Copyright 2012, MetaQuotes Software Corp. |
//|                                        http://www.metaquotes.net |
//+------------------------------------------------------------------+
#property copyright "Copyright 2012, MetaQuotes Software Corp."
#property link      "http://www.metaquotes.net"
int ticket;
//+------------------------------------------------------------------+
//| expert initialization function                                   |
//+------------------------------------------------------------------+
int init()
  {
//----
   
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| expert deinitialization function                                 |
//+------------------------------------------------------------------+
int deinit()
  {
//----
   
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| expert start function                                            |
//+------------------------------------------------------------------+
int start()
  {
//----
    for (int i=0; i<OrdersTotal(); i++) 
        {
          if (OrderSelect(i, SELECT_BY_POS, MODE_TRADES)) 
             {
              if (OrderSymbol()==Symbol()) 
                {
                   ticket = OrderTicket();
                }
             }
        }
     if(OrderSelect(ticket,SELECT_BY_TICKET)==true)
       {
        Alert(ticket);
       }
//----
   return(0);
 }
//+------------------------------------------------------------------+