Errors, bugs, questions - page 2962

 
Roman:

To make it hot, then use File Mapping with event timing.

Hint - in pure MQL, think... It just happened to occur to me

 
A100:

Hint - in pure MQL, think... It just happened to occur to me

Wrap the variable in a class and get the object descriptor.
Any way to pass the descriptor to the Expert Advisor, get it directly from the object. ))
I don't know, I haven't tried it, the idea came to me too. But I'm not a fan of classes, I would use mapping.
Everything is available in standard WinApi.

Документация по MQL5: Основы языка / Типы данных / Указатели объектов
Документация по MQL5: Основы языка / Типы данных / Указатели объектов
  • www.mql5.com
Указатели объектов - Типы данных - Основы языка - Справочник MQL5 - Справочник по языку алгоритмического/автоматического трейдинга для MetaTrader 5
 
Roman:

You create an int variable in the indicator, initialise it and store the number there.
In the indicator define a custom function that returns this variable.
Define the function with the export keyword.
Import this function in the Expert Advisor from name_indicator.ex4
Call the function when needed.
I have not measured the speed.

This scheme does not seem to work. Show an elementary example, please.

 
Nikolai Semko:

If using user32.dll is not critical, here's another option. I don't remember anything about measurements, but I wrote there below, that it seems to work fast. Also you've asked there - why I need speed :))
solution is universal (I can use it between terminals too), not event-driven. You will have to work with timer. However, minimum time between events inOnChartEvent cannot be less than 1/64 second either.

Thank you, but it doesn't work, because the following situation is possible.

Expert1 and Expert2 read data from Indicator1, Expert3 reads data from Indicator2.


The event-driven model is not needed. I.e., the Expert Advisor has to be able to read the number only when it needs to. It doesn't need to catch the moment when the indicator changes the number. So, the problem is very simple in its essence.


In the language of global variables, the solution is as follows

Indicator:

GlobalVariableSet(IndividualName, Number);


Expert Advisor:

Number = (int)GlobalVariableGet(IndividualName);


With this implementation, reading is terribly slow. A few hours of observing the variant on Resources shows that it is about 100 times faster.

 
A100:

Hint - in pure MQL, think... It just happened to occur to me.

I will wait for a solution.

 
fxsaber:

Thank you, but it doesn't fit, as this is a possible situation.

Expert1 and Expert2 reads data from Indicator1, Expert3 reads data from Indicator2.

You can put a small int array in the string, and then "divide and conquer".

 
Nikolai Semko:

You can put a small int array in the string, and then "divide and conquer".

Indicator1 and Indicator2 must then be synchronized in some way to be able to write both numbers in one common string.

This is a very complex solution.

 
fxsaber:

Indicator1 and Indicator2 must then be synchronised in some way so that both numbers can be written on the same common line.

This is a very complex solution.

Two indicators and an EA on one chart?

 
fxsaber:

Indicator1 and Indicator2 must then be synchronised in some way so that both numbers can be written on the same common line.

This is a very complex solution.

The function GlobalVariableSetOnCondition has long been invented for synchronisation
Документация по MQL5: Глобальные переменные терминала / GlobalVariableSetOnCondition
Документация по MQL5: Глобальные переменные терминала / GlobalVariableSetOnCondition
  • www.mql5.com
GlobalVariableSetOnCondition - Глобальные переменные терминала - Справочник MQL5 - Справочник по языку алгоритмического/автоматического трейдинга для MetaTrader 5
 
Slava:
GlobalVariableSetOnCondition function was invented long time ago to synchronize

I'm aware of that, I know how to use it. Trying to get away from the global ones, because they are terribly slow.