Discussion of article ""New Bar" Event Handler"

 

New article "New Bar" Event Handler is published:

MQL5 programming language is capable of solving problems on a brand new level. Even those tasks, that already have such solutions, thanks to object oriented programming can rise to a higher level. In this article we take a specially simple example of checking new bar on a chart, that was transformed into rather powerful and versatile tool. What tool? Find out in this article.

Author: Константин

 
oh god... I couldn't get through it... I wish the developers had just introduced the isNewBar function as standard.... the clutter of errors is staggering... and this in a primitive function of new bar appearance
Обработчик события "новый бар"
Обработчик события "новый бар"
  • 2010.10.04
  • Konstantin Gruzdev
  • www.mql5.com
Язык программирования MQL5 позволяет решать задачи на совершенно новом уровне. Даже те задачи, которые уже вроде имеют решения, благодаря объектно-ориентированному программированию могут подняться на качественно новый уровень. В данной статье специально взят простой пример проверки появления нового бара на графике, который был преобразован в достаточно мощный и универсальный инструмент. Какой? Читайте в статье.
 
I would say that
 

Thank you, very good article.

На форуме как-то проскользнула мысль о том, что было бы хорошо иметь стандартный обработчик события «новый бар». Быть может когда-то разработчики придут к этому, а может и нет.

Why it slipped through. Right here it says in big letters https://www.mql5.com/ru/forum/2176/page21/#comment_26385 that isNewBar() is necessary and can be programmed.

Further you can play the game "find ten differences". Besides the oddities of the Expert Advisor's work on the demo account, it is obvious that there are differences on the demo account and in the tester, and they are visible to the naked eye... I will leave it for passions on the forum or for the next article, if there is a need for it.

You can't see the passions, I'm afraid many people didn't even see it. The passions in the championship will start when the councillors start falling out....

Now we can go further and make a multicurrency NewBar event handler. But this is the subject of a whole article.

And to this I can only add a great poem by a great poet.

Oh how many wonderful discoveries

Prepare the spirit of enlightenment

And experience, the son of difficult mistakes,

And genius, the friend of paradoxes,

And chance, God's inventor....

 
Prival:

Thank you, very good article.

Why it slipped through. Right there in big letters it says https://www.mql5.com/ru/forum/2176/page21/#comment_26385 that isNewBar() is needed and can be programmed.

Oops, something I missed that. Could have thrown in a few more ideas. By the way, I've posted an EA based on point 5. It's raw, though.

You can't see the passions, I'm afraid many people didn't even see it.

Yes, it seems that many people are still in shock from the start of the championship.

And to that I can only add a great poem, a great poet.

A poem to the theme. I wish someone would offer real solutions.

 
maryan.dirtyn:
it would be better if developers just introduced isNewBar function as a standard one...
As I see it, it makes no sense for developers to introduce a standard isNewBar function, as it is a special case of OnTick. And I agree with Prival that this is a programmable event.
 
Lizar:
As I see it, it makes no sense for developers to introduce a standard isNewBar function, as this is a special case of OnTick. And I agree with Prival that this is a programmable event.

It is probably even necessary to introduce a standard processing of this event. At least at the expert level.

At least it is more expedient from the point of view of multithreading in work. After all, any processing at the terminal level can be organised in several threads, but in MQL we will get only one thread.

In my opinion, standard processing will be especially advantageous for multicurrency work.

PS

In general, developers should think about changing the existing event handlers, the same OnTrade() and OnTick().

I would personally prefer to see them at least a symbol as a parameter...

 

I would also change OnTick(), or rather its logic. Now this event is generated if a new tick on the currency pair on which the Expert Advisor is hanging. From the point of view of multi-currency analysis, it would be better (I think so) to generate this event if there is a new tick on any instrument.

I.e. the matrix has changed (review of the market) the newTick() event is generated with indicating what has changed in the matrix. It would be more convenient to synchronise everything .

Rarely, but there are situations when quotes for one instrument freeze for a long time (I saw such a situation in the yen). And if the Expert Advisor hangs on this pair, you are in trouble if you have not translated all the code into OnTime().

 
Interesting:

It is probably even necessary to introduce standard processing of this event. At least at the expert level.

At least it is more expedient from the point of view of multithreading in work. After all, any processing at the terminal level can be organised in several threads, and from MQL we will get only one thread.

Yes, I agree with the issue of multithreading. But this is a general issue of processing any events, not specifically NewBar.
 
Prival:

I.e. the matrix has changed ( market overview), the newTick() event is generated with indicating what has changed in the matrix. It would be more convenient to synchronise everything.


Such an event can be received using TimeCuurent(), but what to do with it further, how to synchronise it is a question.
 
Prival:

I would also change OnTick(), or rather its logic. Currently, this event is generated if a new tick on the currency pair on which the Expert Advisor is hanging. From the point of view of multi-currency analysis, it would be better (I think so) to generate this event if a new tick for any instrument.


Well, I mean the same thing, in OnTick() and OnTrade() at least you need to add the symbol name as a parameter (in OnTrade() it is also desirable to add the event type).

In this case OnTick(), for example, can be generated whenever a new tick on one of the symbols (instruments) present in the overview.

Документация по MQL5: Стандартные константы, перечисления и структуры / Константы графиков / Типы событий графика
Документация по MQL5: Стандартные константы, перечисления и структуры / Константы графиков / Типы событий графика
  • www.mql5.com
Стандартные константы, перечисления и структуры / Константы графиков / Типы событий графика - Документация по MQL5