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

 
evillive:

What do you mean "doesn't work"? You're shoving double data less than 1 into the int array, of course the output will be zeros. And the loop was a messed up one.

This is the kind of code that should work:

Of course you are absolutely right aboutdouble Mas[] (I've considered that ATP counts points in integer values for some reason). The point was that it didn't appear even after I'd changed the array type, but I've realized my mistake. Thank you very much for your help!
 
I don't want to create a separate topic, so I'll ask here. The documentation for the OrderSelect function states that all order data is copied to the "program environment" . Does it only refer to the current chart or to the whole terminal? I am asking this question because I have a problem with working simultaneously with several orders from different charts which have the same EA installed.
 
.roman.:
I don't want to create a separate topic, so I'll ask here. The documentation for the OrderSelect function states that all order data is copied to the "program environment" . Does it only refer to the current chart or to the whole terminal? I am asking this question because I have a problem simultaneously working with several orders from different charts with the same EA installed.
These orders are available to all user applications running in the terminal where this order is open.
 
evillive:
These orders are available to all user programmes running in the terminal where the order is open.
How can we then guard against the false copying into the software environment of the data of another order which was at the same time selected from a different chart?
 
.roman.:
How can we then guard against false copying into the software environment of data of another order which was at the same time selected from a different chart?
The data of different orders do not overlap in any way, there is nothing to protect against.
 
evillive:
The data of different orders do not overlap in any way and there is nothing to be protected from.

We are talking about different things then. I was originally referring to the question of what is the "software environment" that is described in the documentation. Does it mean the whole terminal?

Specifically, my problem was that in spite of exclusive comparison of OrderSymbol and Symbol in OrderSelect function, there was a problem when data (order open time, open price, etc.) could appear from a chart of one pair. That is, I am wondering, is it possible that during the OrderSelect function of the EA on EURUSD, for example, the EA will also start working with the OrderSelect function on another currency pair and the data of the order from the last call of this function will be loaded into the "program environment"?

 
.roman.:

We are talking about different things then. I was originally referring to the question of what is the "software environment" that is described in the documentation. Does it mean the whole terminal?

Specifically, my problem was that in spite of exclusive comparison of OrderSymbol and Symbol in OrderSelect function, there was a problem when data (order open time, open price, etc.) could appear from a chart of one pair. So, I am wondering, is it possible that while the OrderSelect function is running, for example, on EURUSD, the EA will also start working with the OrderSelect function on another currency pair and the order data from the last call of this function will be loaded into the "program environment"?

I need the code. There is an error in it
 
.roman.:

We are talking about different things then. I was originally referring to the question of what is the "software environment" that is described in the documentation. Does it mean the whole terminal?

Specifically, my problem was that in spite of exclusive comparison of OrderSymbol and Symbol in OrderSelect function, there was a problem when data (order open time, open price, etc.) could appear from a chart of one pair. That is, I am wondering, is it possible that during the OrderSelect function of the EA on EURUSD, for example, the EA will also start working with the OrderSelect function on another currency pair and the data of the order from the last call of this function will be loaded into the "program environment"?

Each order has unique parameters which clearly distinguish it from other orders. These are the ticket and the time of opening (or closing, if you search the history). They are unique for only one trading account, just like the retina pattern.

It is not sufficient to select the orderusing the OrderSelect function but we have to check if it is the right order or if we have to select the next one.

 
Vinin:
You need a code. There is an error in it
for(int i=OrdersTotal()-1;i>=0;i--)
        {
            if(OrderSelect(i,SELECT_BY_POS) && OrderSymbol()==Symbol() && OrderMagicNumber()==magic)
               {
                  if(OrderType()==OP_BUY)
                     {
                        double openPrice = 0;
                        openPrice = OrderOpenPrice();
                        if(Ask>openPrice)
                           {
                              Print("OrderSymbol ",OrderSymbol()," OrderTicket ",OrderTicket()," OrderOpenPrice ",OrderOpenPrice());
                           }
                     }
                  if(OrderType()==OP_SELL)
                     {
                        double openPrice = 0;
                        openPrice = OrderOpenPrice();
                        if(Bid<openPrice)
                           {
                              Print("OrderSymbol ",OrderSymbol()," OrderTicket ",OrderTicket()," OrderOpenPrice ",OrderOpenPrice());
                           }
                     }
               }
        }

Unnecessary calculations (irrelevant to the problem) have been removed. The printers were added to the code specifically to show the problem. Despite the comparison of the order symbol with the symbol, on which the EA is open, it can display this (from the osi chart take the data of the order on the euro, for example, as in this case):


 
.roman.:

Unnecessary calculations (irrelevant to the problem) have been removed. The printers were added to the code specifically to show the problem. Despite the comparison of the order symbol with the symbol where the EA is open, it may show the following (from the Ozi chart take the order data on euros, for example, as in this case):

                        if(Ask>openPrice)
                           {
                              Print("OrderSymbol ",OrderSymbol()," OrderTicket ",OrderTicket()," OrderOpenPrice ",OrderOpenPrice());
                           }
                     

This could not be the case, there is no way the Ask on the kangaroo could be higher than any open price on the Eurodollar in 2015...

And all checks for the selected order are better done after the selection, with a separate if() clause.

Reason: