Download MetaTrader 5
To add comments, please log in or register
You can test an application before buying it. Find out how to do that!
MetaQuotes Software Corp.
Moderator
177091
MetaQuotes Software Corp. 2014.10.13 11:38 

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

Drazen Penic
2403
Drazen Penic 2014.10.15 05:20  

Can double click event be handled in MQL5?

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

robualdo
21
robualdo 2014.10.22 18:53  

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...:(

Alex Key
Admin
1440
Alex Key 2014.10.27 09:06  
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.
robualdo
21
robualdo 2014.11.06 13:23  
konung:
Sorry, it is fixed, now the code is with English comments.
Great. Thanks!
/
To add comments, please log in or register