The task of searching for orders - page 2

 
Михаил:

Don't be ridiculous....

If something unexpected happens, no classes will save you!

If there is an unexpected server restart of 5 minutes or more, all variable data is erased...

During the restart on broker's servers orders may close on sl or тп or become market,

The only stable solution is to gather information at the moment of EA loading or when needed ...

Unfortunately this unforeseen happens very often, so in search of good/normal solutions I created this topic.

Thank you Michael for your suggestions ...

 
Михаил:

Don't be ridiculous....

If something unexpected happens, no classes will save you!

If the Windows or the terminal crashes, when the EA is re-initialised,

I just "look" at the active orders and close them, because there is no control over them.

Doesn't it make sense to regain control of them?
 
Vladimir Pastushak:
Doesn't it make sense to regain control over them?

I don't see the point. Why bother to look into what they have "done"?

It's much easier to "nail" them and look at the position, especially as you have to look at it anyway!

 
Михаил:

I don't see the point. Why bother to look into what they have "done"?

It's much easier to "nail" them and look at the position, especially as you have to look at it anyway!

No. There are orders which must be left in the market and there are orders for which a decision must be taken. All this is done by the Expert Advisor that "scans" its "workspace" and always has relevant data. And in really unexpected situations - here, too, the message is automatically sent to the mobile phone, so that I can interfere using my mind, not the robot. In my humble opinion, this is the most reasonable behaviour for an EA.

And there are no variables, in which the important environment is memorized - only the search for the latest, freshest state, only the extreme. That's money ;)

 
Artyom Trishkin:

Well no. There are orders that need to be left in the market, and then there are those for which a decision needs to be made. All this is done by the Expert Advisor by "scanning" its "workspace" and it always has the actual data. And in really unexpected situations - here, too, the message is automatically sent to the mobile phone, so that I can interfere using my mind, not the robot. In my humble opinion, this is the most reasonable behavior of EAs.

And no variables in which the important environment is memorized - only the search for the latest, most recent state, only the extreme. That's money ;)

These are general words.

Please give me an example (MT5) of an order which simply needs to be left in the market,

after a "crash" of the windows or the terminal?

Is it better and faster to analyze 100 unsupervised orders or to place the required orders after analyzing the position?

necessary?

 

When implementing different "grids" I came up with the following structure:

struct OrderInfo
{
   int            type;
   int            ticket;
   int            martinLeg;
   double         lots;
   double         openPrice;
   double         profit;
   datetime       openTime;
};

struct SeriesInfo
{
   int            ordersCnt;
   int            maxMartinLeg;                                                                    // Максимальный номер ордера в серии.
   
   double         lastOpenPrice;                                                                   // Минимальная для Buy-серии и максимальная для Sell-серии цена открытия ордера в серии
   double         totalProfit;                                                                                                   
   OrderInfo      order[MAX_ORDERS_IN_SERIES];
   
   void Init()
   {
      ordersCnt = 0;
      maxMartinLeg = 0;
      lastOpenPrice = 0.0;
      totalProfit = 0.0;
   }
};

The structure is filled in on each new tick based on the Magic Number value (it stores all the information needed to identify the order: order number, which grid it belongs to, etc.).

 
Михаил:

These are general words.

Give me an example ( MT5 ) when you just HAVE to leave a previously placed order in the market,

after a "crash" of the Windows or the terminal?

Is it better and faster to analyze 100 unsupervised orders or to place the required orders after analyzing the position?

necessary orders?

It's not the implementation (code), but the algorithm. The Expert Advisor must catch all of its orders and positions after restarting. If it loses them - this is a schoolboy trick, if it closes them after having seen them, that is also from the same field.

An EA should try to repeat the trader's actions, and believe me, as many customers as I have written codes for, all of them do not want an EA to stupidly close (if this is not part of the TS), but to catch them and draw conclusions from their condition in order to perform the necessary actions with them.

And why do you think that after the restart of the terminal, the orders opened by the EA five or ten minutes ago (or even an hour or two, etc., all depends on the TS), should suddenly become uncontrollable to the EA and obligatory to delete?

 
Artyom Trishkin:

It's not the implementation (code) but the algorithm. The Expert Advisor should pick up all of its orders and positions after the restart. If it loses them - it is a school trick, if it closes them after having seen them, out of harm's way, this is also from the same field.

The Expert Advisor should try to repeat trader's actions and, believe me, I have written every client, who needs the Expert Advisor not to stupidly close (if this is not part of the TS), but to pick them up and make conclusions from their condition in order to perform further actions with them.

And why do you think that after the restart of the terminal, the orders opened by the EA five or ten minutes ago (or even an hour or two, etc., all depends on the TS), should suddenly become uncontrollable to the EA and obligatory to delete?

You are engaged in verbiage (school handicrafts, etc.).

You do not need a mentor to explain how it should be!

You answer the question asked:

Give me an example ( MT5 ) when you simply NEED to leave a previously placed order in the market,

After a "crash" of the WIND or the terminal?

Which is better and faster to analyze 100 unsupervised orders, or to analyzea position and place the

necessary orders?

P/S Uncontrolled orders - because their tickets are lost!

A position cannot be lost :)

It ( position ) either exists or it does not!

 
Михаил:
...

P/S Uncontrolled warrants - because their tickets are lost!

And a position cannot be lost :)

Here's my answer to PS: they simply need to be found - that's what we're talking about, so why delete them? That's what the topicstarter was talking about, with which I fully agree. I repeat - this is purely my opinion. By the way, if you try to enter an EA in the market that will delete orders and positions if there is a connection failure or terminal restart - it will probably not be moderated. And there, believe me, moderators check everything and demand adequate behavior of programs in their requirements for products, which sometimes even appear to be moronic. Examples of harsh moderation can give you a lot of sellers, I'm not the only one (although I had complaints only on design) ...

As for the verbiage and other things that you "think" in my posts - that's just what you think. I am communicating with you in a very friendly manner, without admonitions and other seemingly negative things. I was simply expressing my IMHO (which I reported, and cited my observation that people are asking for).

By the way - if the Windows crashed, the Expert Advisor cannot delete orders - only manually, so this example cannot fully relate to autotrading.

 
Artyom Trishkin:

Here's my answer to PS: so they simply need to find it - that's what we're talking about, why delete it? About this and the topicstarter spoke, with which I fully agree. I repeat - this is purely my opinion. By the way, if you try to enter an EA in the market that will delete orders and positions if there is a connection failure or terminal restart - it will probably not be moderated. And there, believe me, moderators check everything and demand adequate behavior of programs in their requirements for products, which sometimes even appear to be moronic. Examples of harsh moderation can give you a lot of sellers, I'm not the only one (although I had complaints only on design) ...

As for the verbiage and other things that "seem" to you in my posts - it only seems to you. I am communicating with you in a quite friendly manner, without admonition or other seemingly negative things. I was simply expressing my IMHO (which I reported, and cited my observation that people are asking for).

By the way - if the Windows crashed, the Expert Advisor cannot delete orders - only manually, so this example cannot fully relate to autotrading.

I'm not saying it's not friendly communication...

But once again (as I believe), there is no point in digging into warrants!

By the way in response to this:

"By the way - if the wind is down, the EA can't delete the orders either - only manual here, so this example can't fully apply to autotrading."

POSSIBLE, you probably don't know how. If interested, I can post the code.

Reason: