Event stream. How to control and make the event idle ? (+ solved) - page 3

 

Yedelkin:

Similarly, if there is already an event ChartEventin queue of mql5-program or such event is being handled, then new event of such type is not queued".

Hmm. This is really bad. Theoretically it means that if say, an indicator and an Expert Advisor use events independently, then there can be skips in both cases.

Then there is no point in using the event as a reliable way of transferring data.

Pity.

 
sergeev:

Your question "at what approximate frequency should custom events be sent so they don't overflow the queue"

My answer on the first page is "with the frequency of OnChartEvent calls".

That is, one event is one OnChartEvent. There should not be more than two events in between.

That's all the maths.

Once again, read the first page. I showed how to avoid accumulation of user events when terminal event is processed instead of user event. It's as simple as that.

Once again, politely :) You solved your problem, I'm trying to solve mine, of a different plan. When reading the discussion, I didn't find an answer to my questions. You still haven't answered my main question (about memory usage) (if you choose to do so).

Let me explain. I do not have the task "to update some function, but faster than MQL suggests using a timer". All the more so in such a clever way that was suggested in the end. The custom events from several charts with variable frequency bombard a separate chart containing Expert Advisor and event handler function. Accordingly, the result of your narrowly focused task(EventChartCustom inside OnChartEvent) does not fit with my scheme of working with custom events at all.

 

Yedelkin:

To clarify. I don't have the task to "make some function update faster than MQL suggests by timer". Especially not in such a clever way, as suggested in the end. The custom events from several charts with variable frequency bombard a separate chart containing Expert Advisor and event handler function. Accordingly, the result of your narrowly focused task(EventChartCustom inside OnChartEvent) does not fit at all with my scheme of working with custom events.

it's not convoluted, it's simple. If you are unable to understand it, it's not my problem. that's one

It's not inside OnChartEvent, it's scattered all over the code. You're making up your own narrow constraints on its operation. that's two.

Similarly, if there is already an event ChartEvent in the queue of mql5-program or such an event is being handled, a new event of this type will not be placed in the queue.

This is either a bug or documentation error or missing conditions.

Events are successfully all queued up and no events are discarded. Otherwise my topic would not have appeared.

I'm trying to solve my other problem
what effect does event queue overflow have on RAM size? If the event queue turned out to be overflowing, where do the events that overflowed the queue go?

Have Renat and Rosh already answered this question?
 
Rosh:

If an event is discarded, then it is simply not queued up. The memory is not growing.

Phew! That's the main thing I wanted to understand. And since TheXpert said that only a few MB is spent on the queue itself, it's likely that the memory leak is elsewhere... Let's go with that statement until proven otherwise.

Rosh:

If this kind of problem occurs, then things are very bad. I think the overfilled event queue is the last place to look for memory problems.

Yes trying to look everywhere I can.

But note that of the three disqualified experts, at least two were working with a custom event stream (the author of the third does not respond to the request). Lizar (working with custom events) has high memory usage, too. And tol64 has extremely low memory consumption because the user events are used less frequently than once per minute, if I've got it right. So, it turns out that you will have to doubt the efficiency of implementing the concept of custom events willy-nilly. Until you get an exhaustive answer.

 
Yedelkin:

But note that of the three disqualified EAs, at least two were working with a stream of custom events (the author of the third does not respond to the request). Lizar (working with custom events) has high memory consumption too. And tol64 has extremely low memory consumption because the user events are used less frequently than once per minute, if I've got it right. So, it turns out that you will have to doubt the efficiency of implementing the concept of custom events willy-nilly, until you get an exhaustive answer.

And let's not forget that the EA has obtained the events from the indicators that have been run on many tools and timeframes, about 80 in total, if I remember correctly. Each indicator consumes resources for indicator buffers, that's where the dog is buried.
 
sergeev:

it's not complicated, it's simple. If you can't understand it, it's not my problem.

As I understood it, I wrote that it's complicated. Otherwise I wouldn't have touched it.

sergeev:

It's not inside OnChartEvent, it's in the whole code. You're making up your own narrow constraints on how it works. that's two.

Yes, yes, EventChartCustom is not inside OnChartEvent, but, like, outside. Now look at your own code:

void OnChartEvent(int iview, int id, long lparam, double dparam, string sparam)
{
    if (id==CHARTEVENT_CUSTOM+VM_IDLE)
    {
      ... 
    }
    EventChartCustom(m_chart, VM_IDLE, (long)event_idle, 0, ""); // отправили событие с указанием последнего счетчика
}

Obviously in this code EventChartCustom is not insideOnChartEvent, and I'm very wrong :)

sergeev:

it's either wrong or a bug or documentation error or an understated condition.

All the events successfully stay in the queue and no events are discarded. Otherwise my topic would not have appeared.

There is at least one more version: in your particular case, the queue simply doesn't overflow (due to code efficiency), so there are no facts of discarding events.

 
Yedelkin:

There is at least one other version: in your particular case, the queue simply does not overflow (due to code efficiency), so there are no events being discarded.

Here's my particular case I started demonstrating not discarding identical events

https://www.mql5.com/ru/forum/5091#comment_112780

I wrote there why the overflow occurs.

Yes, yes, EventChartCustom is not inside OnChartEvent, but, like, outside. Now look at your own code:

Get to the root! I showed a demonstration of the problem and its solution. This EventChart call could be anywhere in the code.

 
Rosh:
And let's not forget the fact that the Expert Advisor received the events from the indicators that were run on many tools and timeframes, about 80 in total, if I remember correctly. Each indicator consumes resources for indicator buffers, and therein lies the dog.
Are you talking about Japanese? Well, in my case it's easier: I have one universal indicator with 8 or 15 calculated indicator buffers running on 6 instruments at one timeframe. I.e. there are only 6 indicators. And, theoretically, such a scheme can consume 2 GB in a week?
 
Yedelkin:
Are you talking about the Japanese? Well, in my case it's simpler: one universal indicator with 8 or 15 calculation indicator buffers, running on 6 instruments at one timeframe. I.e. there are only 6 indicators. Theoretically, such a scheme can consume 2 GB in a week?
Read the article Reducing memory consumption for auxiliary indicators, it may be useful.
 
Rosh:
Read the article Reducing Memory Consumption of Auxiliary Indicators, it may be useful.

Thanks, I already have everything optimised there :) Including with this article in mind, as far as I remember. I'll have to wait for the next degree of enlightenment :)

Is it possible to determine the Expert Advisor and indicator separately, if they work together via custom events?