Discussion of article "MQL5 Cookbook: Handling Typical Chart Events"

 

New article MQL5 Cookbook: Handling Typical Chart Events has been published:

In my article I would like to describe the capabilities and hands-on practice of using OnChartEvent() with typical (standard) events predefined by MQL5 developers. The MQL5 articles and Code Base already contain examples of using this handler.

However, my purpose is to analyze this instrument in the context of Event-Oriented Programming (EOP). I believe that this handler can be successfully used for fully automatic and semi-automatic trading systems.


1. "ChartEvent" Event

So, first let's see what this type of event is.

According to the Documentation, the ChartEvent event may appear when working with a chart, in particular when:

  • pressing a key on the keyboard when a chart window is in focus.
  • creating a graphical object.
  • deleting a graphical object.
  • clicking on a graphical object.
  • dragging a graphical object with a mouse.
  • finishing to edit text in a text field of a LabelEdit graphical object.

Thus, this event brings interactivity and allows interacting with a chart. Moreover, such an interaction may be a result of manual trading, as well as of some algorithmic operations (automated trading).

MQL5 developers classify the ChartEvent event by types specified in the ENUM_CHART_EVENT enumeration.

It is important to note that this list has a range of user-defined events, that act as a hidden reserve to serve the programmer. MQL5 developers provide 65535 IDs for custom events.

To work with custom events, a special generator function EventChartCustom() is available for programmer's needs. However, this article does not consider custom events.


Author: Dennis Kirichenko

 

Can double click event be handled in MQL5?

I tried with standard library in MQL4, but it always return single click event. 

 

Thanks for this useful article and for the whole cookbook's serie.

Only I've noticed that ,in this artcle, all the string comment in the code are in Russian...:(

[Deleted]  
robualdo:

Thanks for this useful article and for the whole cookbook's serie.

Only I've noticed that ,in this artcle, all the string comment in the code are in Russian...:(

Sorry, it is fixed, now the code is with English comments.
 
konung:
Sorry, it is fixed, now the code is with English comments.
Great. Thanks!
 

Sir.

Please help !

I need to synchronize between 3 charts. use what event and how to set ?

now I use global object setted in one chart, and use one timer for one chart, and then use OnTimer() to check the value of globe object, but there are some delay. but there are some delay.


Is it possible use only one global timer and then response it on multi-charts with OnTimer() ?

必应词典 - 中国领先的中英文在线词典
  • cn.bing.com
必应词典为您提供synchronized的释义,美[ˈsɪŋkrəˌnaɪz],英[ˈsɪŋkrənaɪz],v. 同时化;【物】同步;【影视】声;使同时; 网络释义: 同步的;同步化;同步方法;
 
okwh #:

Sir.

Please help!

I need to synchronize between 3 charts. use what event and how to set ?

now I use global object setted in one chart, and use one timer for one chart, and then use OnTimer() to check the value of globe object, but there are some delay. but there are some delay.


Is it possible use only one global timer and then response it on multi-charts with OnTimer() ?

I know, use CharEvent.... not timer

 
Many thanks for your hard work and examples with codes. I am very grateful. I decided to learn MQL5 for my needs. Your article is very useful here. I am surprised that there are so few views and comments to such a high-quality article. It opened my eyes to working with events of the chart, mouse, keyboard and others. Thank you very much and good health!