Asynchronous and multi-threaded programming in MQL - page 29

 
Реter Konow:

Will communication via resources with copies on regular charts (not OBJ_CHART) work? Or is there some kind of limitation there?

Not sure. If you do such an experiment, let me know the results here.

 
Andrey Barinov:

Do I understand correctly that with this implementation the OnTrade approach is out of the question? You should wait for the result of trade orders in a slave?

 
fxsaber:

Do I understand correctly that with this implementation the OnTrade approach is out of the question? And it is necessary to wait for the result of trade orders in the slave?

I don't use OnTrade (I write cross-platform code and MT4 doesn't have it). But I'm not waiting much either (I don't use sleep and while). I have enough of what OrderSend() returns

 
Реter Konow:

Will communication via resources with copies on regular charts (not OBJ_CHART) work? Or are there any restrictions there?

Each EA agent-copy only needs to know its own number to create a unique resource name.

 
Andrey Barinov:

What OrderSend() returns is enough for me

Result.deal = 0 - enough? And the quirks with unsynchronised trading history right after OrderSend in MT5.

OnTrade seems to work in 4.

 
fxsaber:

Result.deal = 0 - is that enough?

I have not yet had (result.order ==0 && result.deal==0)

https://docs.mql4.com/ru/runtime/running
Выполнение программ - Программы MQL4 - Справочник MQL4
Выполнение программ - Программы MQL4 - Справочник MQL4
  • docs.mql4.com
Каждый скрипт и каждый эксперт работает в собственном отдельном потоке. Все индикаторы работают в одном интерфейсном потоке терминала. Обработка тиков и синхронизация истории также производится в интерфейсном потоке. Если пользовательский индикатор вызван при помощи функции iCustom(), то этот индикатор работает в потоке вызвавшей его программы...
 
Andrey Barinov:

Not aware of it. If you do such an experiment, let me know the results here.

I will.

In general, this is a strange situation. When reading data via resources, you need to specify the address of the program in which the resource is located. But since there will be copies of the same EA running, they have the same address. How will reading/writing of data be performed in this case? Curious...

 
fxsaber:

Each EA agent copy only needs to know its own number to create a unique resource name.

Agreed.
 
Andrey Barinov:

I haven't yet had (result.order ==0 && result.deal==0)

It's about a five.

 
fxsaber:

It's about a five.

That's what I'm talking about.

I gave the link to four as an answer to the comment that OnTrade works in four.

Reason: