New article: MQL5 Cookbook - Programming sliding channels

Back to topics list To post a new topic, please log in or register
MetaQuotes 2016.04.11 17:45

New article MQL5 Cookbook - Programming sliding 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 sliding 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

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:

  1. m_date — the point's time coordinate on the chart;
  2. m_value — the point's price coordinate on the chart;
  3. m_extreme_type –  extremum type;
  4. m_idx – index.

Author: Dennis Kirichenko

Back to topics list  

To add comments, please log in or register