Asynchronous and multi-threaded programming in MQL - page 30

 
fxsaber:

We're talking about a five.

Did you have that result.order==0 && result.deal==0?

 
Andrey Barinov:

...

By the way, all of the above information does not cancel my advice to you to stop using EventChartCustom() and completely switch to resources. Believe me, this way is better and more universal. And the pattern can be applied to a regular chart, by setting CHART_SHOW 0 (so that it won't get unnecessary events).

 
Andrey Barinov:

Did you have that result.order==0 && result.deal==0?

&& no. But Result.deal == 0 - that's not enough. Moreover, it is dangerous to do something when the trading history has not yet had time to synchronise.

 
Of course, this multithreading option is costly, but if there is no other, it will solve the problem. Barely.)
 
fxsaber:

&& - no. But Result.deal == 0 - that's not enough. Moreover, it is dangerous to do something when the trading history has not yet had time to synchronise.

Give me an example of a problem. So far it has always been enough for me to know that the order has been sent.

 
Andrey Barinov:

Give me an example of a problem. So far I have always been satisfied with the information that the order has been sent.

There are a lot of nuances, I can't remember them all at once. At a glance

  • A market order is successfully placed. It got true and 10009. But it hasn't been executed yet.
  • The position is closed, but there is no mentioning of it in the trade history.
  • The order is executed and the position is opened. But the order has not been deleted from the terminal yet. Thus, the order and the position exist in the terminal simultaneously. Their labels are the same.
 
fxsaber:

There are a lot of nuances, I can't remember them all at once. At a glance

  • The market order is successfully placed. We got true and 10009. But it hasn't been executed yet.
  • The position is closed, but there is no mentioning of it in the trade history.
  • The order is executed and the position is opened. But the order has not been deleted from the terminal yet. Thus, the order and the position exist in the terminal simultaneously. Their labels are the same.

There are indeed a lot of nuances. You yourself solved many of these problems in MTOrders.

I build my trading logic in such a way that the result.order information is enough for me. For several years, there were no unsolvable tasks (problems).

P.S. Offtopic already.

 
Andrey Barinov:

Peter, you don't understand.

There is ONE advisor. It also runs itself additionally on an invisible chart, only in agent mode. There are NO events running on the agent. It means that the resource cannot be polled in any way, the timer is not started, ticks don't come.

The Expert Advisor can multiply as many of these agents as it wants. Each one becomes a separate thread.

Can you clarify this statement once again? If a template is applied to a regular chart and a copy of the EA is launched, all the events will normally arrive. Isn't it?

And if the template is applied to _OBJ_CHART, how can the EA even work on it if even the ticks don't come?

 
Andrey Barinov:

There really are a lot of nuances. You yourself have solved many of these problems in MTOrders.

I have solved everything there.

I build my trading logic in such a way that I have enough result.order information. For several years, there were no unsolvable tasks (problems).

You have to take certain servers.

P.S. Offtopic already.

Yes, let's finish.

 
Реter Konow:

Can you explain this statement again? After all, if you apply a template to a normal chart and run a copy of the EA, then all events will come in as normal. Isn't it?

And if a template is applied to _OBJ_CHART, how can it work there in full if even the ticks don't come?

The normal chart has all events. The OBJ_CHART has only OnChartEvent where the main EA sends OnTick and OnTimer if necessary.

Reason: