![MQL5 - Language of trade strategies built-in the MetaTrader 5 client terminal](https://c.mql5.com/i/registerlandings/logo-2.png)
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
New article MQL5 Cookbook - Programming moving channels has been published:
This article presents a method of programming the equidistant channel system. Certain details of building such channels are being considered here. Channel typification is provided, and a universal type of moving channels' method is suggested. Object-oriented programming (OOP) is used for code implementation.
It is known that the channel is constructed on three points, and each of them has price and time coordinates. To start with, we will pay attention to the time coordinates, as their sequence affects the channel type. We will use the channel with a main line built on two local minimums as an example. A third point will be in charge of the local maximum. The position of points can be used as criteria for channel typification.
The first type refers to a case when minimum appears first, followed by maximum, and then minimum again. A schematic view of this situation is presented in Fig.1.
Fig.1 First type of set of points, a scheme
Points that are used for drawing channel's trend lines are usually fractals. This way, a point is simultaneously a fractal and a base for drawing a straight line.
We will now attempt to summarize and code the fractal points with OOP.
2.1 Class of the fractal point
The feature of this class involves being in charge of the point that is among the points used for building the equidistant channel. We will name the indicated class as CFractalPoint, and, in the best traditions of the MQL5 language, we will link it to the CObject interface class with a relation of inheritance.
The class has 4 members for transferring data:
Author: Dennis Kirichenko