You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
Check out the new article: From Basic to Intermediate: Function Pointers.
In the previous article From Beginner to Intermediate: Objects (II), we began working with the first type of event that can be used to manipulate an object displayed on the chart.
However, that article used an event type that MetaTrader 5 always triggers by default when the user interacts with the chart. In this case, we are talking about a key press. Since this event is easy to intercept with the OnChartEvent handler, you may be thinking that there is no other way to use the keyboard except by intercepting that event. Well, dear reader, that is not quite the case. Although scripts do not use and do not allow the use of the OnChartEvent handler, we can enable mechanisms for controlling certain object properties with the keyboard and a script, even if this is a somewhat unusual approach.
So, before looking at mouse event handling, let us see how to handle keyboard events when using scripts. Although MetaTrader 5, and therefore MQL5, is not designed for this kind of operation, since it was developed to work with price charts, it is important for you to know what can and cannot be done. There are limitations that must be understood.
Author: CODE X