The task of searching for orders - page 11

 
Dmitry Fedoseev:
An array of structures containing all the data of all the orders.

type ?

   struct str
     {
      string            Sym;                                // Символ ордера
      string            Com;                                // Коммент ордера
      int               Tic;                                // Тиккет ордера
      int               Typ;                                // Тип ордера
      int               Mag;                                // Меджик номер ордера
      double            Lot;                                // Лот ордера
      double            Pri;                                // Цена открытия ордера
      double            SL_;                                // Стоп лосс ордера
      double            TP_;                                // Тейк профит ордера
      datetime          Tim;                                // Время открытия ордера
      double            Pro;                                // Профит ордера
     };
     
     str mass[];
 
Vladimir Pastushak:

like ?

Yes. And then we sort by some field, we sift by some field. For example, we sort by opening price and we know where the top order is and where the bottom order is.
 
Dmitry Fedoseev:
Yes. And then we sort by some field, sift by some field. For example, we sort by opening price and know where the upper order is and where the lower one is.

So we have multiple loop calls to fill structure and multiple loop calls to filter structure...

This variant is not suitable...

 
Vladimir Pastushak:

You get multiple loop calls to fill the structure and multiple loop calls to filter the structure...

This variant is not suitable...

I offered you a simple and fast option at the very beginning.

Add to that the code, in case of emergency (change of settings).

 
Vladimir Pastushak:

You get multiple loop calls to fill the structure and multiple loop calls to filter the structure...

This option is not suitable...

For filling, there is a single loop call. Who knows if it is worse or better, no one has compared it.

If we need to find only top or only bottom order, it may be easier to do it directly, without redundancy.

It is better to simply assemble functions for different tasks specifically sharpened for these tasks, rather than try to do something universal.

 
Dmitry Fedoseev:

To fill in a single pass through the cycle. Who knows if it's worse or better, no one has compared it.

If we need to find only top or only bottom order, it may be easier to do it directly, without unnecessary stuff.

It's better to just collect functions for different tasks specifically sharpened for these tasks than try to make something universal.

I'm not looking for something universal. I made a code which finds all required order tickets in one loop, and then, depending on method call, the structure is filled in. As a result, on each tick I have current data on required 8-16 orders...

If there is interest I can post my work to get valuable lessons ...

 
Vladimir Pastushak:

I am not looking for universal, I made a code which in one loop finds all required ticket orders, and then depending on the call of the method the structure is filled, as a result, on each tick I have the current data on the required 8-16 orders ...

If there is interest I can post my work to get valuable lessons ...

Just now wrote that this method is not suitable.
 
Vladimir Pastushak:

I'm not looking for a universal one, I made a code which in one loop finds all required order tickets and then, depending on method call, the structure is filled in, as a result, on each tick I have current data on the required 8-16 orders...

If you are interested I can post my work to get valuable lessons ...

In the procedural style, I made the first variant with 8-16 loops per one tick; in the tester, even the turtle outruns this code...

In the end I did everything for one loop but, again, the code did not inspire my trust,

Now I am doing it again with new experience, but I want to do it well, that's why I am writing it

 
Dmitry Fedoseev:
You just wrote that this method is not suitable.

Yes, because only one cycle fills the structure and then you have to run the cycle to find the required element again, if you need more than 1 element, then the number of cycles will be more than 1

And it slows down the program.

 
Vladimir Pastushak:

In procedural style I made the first variant where there were 8-16 cycles per one tick, such code in the tester even the turtle overtook...

In the end I did everything for one loop, but again, the code did not inspire me with confidence,

now i am doing it again with new experience, but i want to do it well thats why i am writing

Know what you are doing. At first, you seem to have just decided to classify everything you have, to find a universal approach to working with orders. But you are solving a particular narrow problem.
Reason: