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

 
Yedelkin:

OK, I see.TheXpert made a wave and the problem started.

It's a real bummer for you. Is it my fault that you can't communicate with people?

The Expert Advisor has a fixed memory consumption, if

(1) no buffer emulation

(2) no drawing of objects on the history.

(3) no memory allocation bugs. But this is usually seen with deinit.

(4) there are no bugs working with the indices. If an indicator has a full size buffer, it is a bug.

If there is (1) or (2) burning is easy to track with tester + dispatcher. It is treated by size control.

The events by themselves do not eat memory at all (in ascending order). Therefore, if there is no problem in the Expert Advisor, the problem is definitely in the indicator.

Документация по MQL5: Основы языка / Переменные / Создание и уничтожение объектов
Документация по MQL5: Основы языка / Переменные / Создание и уничтожение объектов
  • www.mql5.com
Основы языка / Переменные / Создание и уничтожение объектов - Документация по MQL5
 
TheXpert:

In an EA, the memory consumption is fixed if

(1) there is no buffer emulation

(2) there is no drawing of objects on the history.

(3) no memory allocation bugs. But this is usually seen with deiniteration.

(4) no bugs of working with indulators. If an indicator has a full size buffer, it's a bug.

If you have (1) or (2), it is easy to trace the overloading with the tester and the dispatcher. It may be treated with size control.

The events themselves do not consume memory at all (ascending). Therefore, if the Expert Advisor has no problem, the problem is definitely in the Insulator.

Thank you very much for such a detailed reply. I will think it over. (1) - (3) is definitely not.

About (4) please explain: what does it mean "if the indicator takes the buffer to the full size", not to get lost in conjecture.

About "If there is (1) or (2) burning it is easy to trace by tester + manager" I ask to specify: i.e. you suggest to use the tester not only for measurement of speed of the program, but also for measurement of consumed volume? Yep; such a simple solution, never even occurred to me!

Further. It turns out that if an Expert Advisor is built using dynamic objects, it cannot have fixed memory. On the other hand, there are no reports of incorrect operation with dynamic objects; how many times have I deleted and launched the Expert Advisor...

Anyway, my brainstorming suggested a trivial idea: if I cannot separate the volumes of programs running together, I have to run them separately and see how their consumption increases. The Expert Advisor should be launched not from its custom indicator, but, suppose, from ticks on its own chart. Considering your hint concerning the tester measuring the volume, everything appears to be fine. Maybe that's what Roche meant by referring to the article...? But all the same, on re-reading the article such a thought did not occur to me. Not without a clue!

TheXpert :

You make me crazy. Am I also to blame for the fact that you can not communicate with people?

Guilt is guilt, the wave is guilt :)

And I have already grasped your point of view about my extreme ill-manneredness and apologized in advance :) Even so, my ill-manneredness tells me that it is more productive to speak for myself, rather than for people :) We are not in the State Duma :)

 
Yedelkin:

About (4) please explain: what does it mean "if the indicator has a full size buffer" in order not to get lost in guesses.

What I mean here is that if the chart has, say, 100000 bars and the Expert Advisor is pulling a buffer for all 100000 bars - that's not right.

About "If there is (1) or (2) it is easy to trace burning by tester + dispatcher" I ask to specify: i.e. you propose to use tester not only for measuring speed of program, but also for measuring consumed volume? Yep; such a simple solution, never even occurred to me!

Well... You mean to run the tester and somewhere (in Windows Task Manager for example) monitor memory allocation. Not a very reliable way, but if the problem is in EA, the memory burn is likely to be very high.

So, brainstorming resulted in a seemingly trivial idea: if we can't divide volumes of programs running together, we have to run them separately and see who has higher consumption.

Well, that's how it was actually developed...
Документация по MQL5: Основы языка / Переменные / Создание и уничтожение объектов
Документация по MQL5: Основы языка / Переменные / Создание и уничтожение объектов
  • www.mql5.com
Основы языка / Переменные / Создание и уничтожение объектов - Документация по MQL5
 
sergeev:
...

That is, for example, when you click on the object - event CHARTEVENT_OBJECT_CLICK will not come immediately, but only after withdrawal of all previous events from the queue.
And as you understand, the queue is stuffed tightly with the EventChartCustom.

...

Alex, I have a slightly similar problem now. That is, right after EA initialisation everything works fine. For some time I don't enter the terminal at all, I try to switch from one user information panel to another and the program "stalls". It may even freeze for a few seconds until the switch happens. Is it the same case?

Haven't tried your solution yet, busy with another issue, but I will definitely try it, as I haven't found the solution myself. There is one question for now.

In your example there are five parameters in the OnChartEvent () function. What's theiview?

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

    /*
        обработка остальных событий
    */
  }
 
tol64:

Alex, I have a slightly similar problem now. That is, right after EA initialisation everything works fine. For some time I don't enter the terminal at all, I try to switch from one user information panel to another and the program "stalls". It may even freeze for a few seconds until the switch happens. Is it the same case?

Yes, that's the one. You have more than one EventChart sent between OnChartEvent calls. Make that add-on I suggested to analyze the event number that came in and the problem goes away.

Your example has five parameters in the OnChartEvent () function. What isiview?

Accidentally got it in the function header. Ignore it.

Документация по MQL5: Основы языка / Функции
Документация по MQL5: Основы языка / Функции
  • www.mql5.com
Основы языка / Функции - Документация по MQL5
 
I can't believe how much energy people have.) Eh, where are my 17 years!
 

tol64:

sergeev:
.
..

So, for example, when you click on an object, the CHARTEVENT_OBJECT_CLICK event won't come right away, but only after all the previous events are removed from the que ue.
And as you understand, the event queue is clogged with EventChartCustom.

Folks, come on, read point 1.1 of this post. The information discussed there was presented today, we can consider it official. Well now there can't be (in this case) such phenomena as "previous" events and "deaf blocking" of queue by EventChartCustom function . ...Or we need an official refutation of new information from the Handbook.

TheXpert, thanks for the clarification.

 
Yedelkin:

Folks, come on, read point 1.1 of this post. The information discussed there was presented today, we can consider it official. Well there can not (in this case) now be in the queue such phenomena as "previous" event-events and "deaf blocking" the queue by EventChartCustom function . ...Or an official refutation of the new information from the Handbook is needed.

is this like a circus going on?
 
sergeev:
Is this some kind of circus going on?

If you see it as a circus, feel free to delete it, or try to answer it on its own merits.

 
and have you asked a new question yet?
Reason: