• 概要
  • レビュー (2)
  • コメント (31)
  • 最新情報

ClusterSMA

This is the first public MQL5 indicator using the cluster filtering. The advanced smoothing effect allows the digital filter to transform an ordinary moving average into a new faster indicator providing fewer false signals. At least, that is the purpose of the new experimental project. The project stages and ClusterSMA features are described in the author's blog (in Russian).

The indicator is based on the cluster digital filter that is successfully used in another area. At the time of publication, only the first filter calculation module has been rewritten. Conversion of the entire project into MQL5 is on its initial stage. However, it is already possible to evaluate the entire idea by testing ClusterSMA. The indicator does not repaint, except for the very last (zero) bar.


Parameters

1. General settings. This section includes the parameters for the appearance and calculation of the main line of the ClusterSMA indicator:

  • Max bars in chart - the maximum number of bars, that are calculated and displayed in the indicator's window during the product's start or re-calculation. The default value is 256 bars. This greatly speeds up the preparation of the indicator for trading and testing. If 0, the indicator is calculated at the entire available history. The minimum amount of displayed bars is three.
  • Recalculation of the last bar - select the re-calculation mode of the last unfinished bar. The 'Every tick' mode is set by default. There are three options:
    • Every tick - the indicator is re-calculated at every tick on the last unfinished bar. Use this mode if the indicator readings are important on this bar.
    • Every new minute bar - the indicator is re-calculated on the last unfinished bar only when a new bar arrives on the M1 timeframe. It is recommended to use the mode on timeframes exceeding M1. This reduces the load on CPU and allows tracking changes in the indicator readings once per minute.
    • Every new bar - the indicator is re-calculated at the last unfinished bar only when a new bar arrives on the current timeframe. The indicator values on a new bar are often disregarded when defining a signal for a trading system. By selecting the option, you can significantly reduce the indicator calculation time in actual trading, as well as during strategy tests.
  • Color ClusterSMA up - the ClusterSMA up line color.
  • Color ClusterSMA down - the ClusterSMA down line color.
  • Width ClusterSMA - width of the ClusterSMA line.
  • Style ClusterSMA - style of the ClusterSMA line. When the "Width ClusterSMA" is set to 1, apart from the Solid line, you can also select Dash, Dotted, Dash-dot, or Dash - two dots.

2. SMA settings. This section includes the calculation and appearance settings of the SMA indicator line:

  • Line SMA - enable/disable display of the SMA indicator line in the terminal window and the indicator's values in the data window This option does not disable SMA calculation in the indicator since its values are necessary for operation.
  • Period SMA - period, valid values 1 to 255. It has the same physical meaning as the N parameter in the standard Simple Moving Average (SMA) indicator. The default value is 14. The maximum limitation of 255 has been introduced due to the "heavy" calculation part of the cluster filter.
  • Color SMA up - the SMA up line color.
  • Color SMA down - the SMA down line color.
  • Width SMA - width of the SMA line.
  • Style SMA - style of the SMA line. When the "Width SMA" is set to 1, apart from the Solid line, you can also select Dash, Dotted, Dash-dot, or Dash - two dots.

3. Settings of transform. This section includes the settings that affect the conversion of the source series (price):

  • Line of transform - enable/disable the conversed price line in the terminal window and its values in the data window. This option does not disable the conversion calculation in the indicator. To disable conversion use the "Transform" parameter.
  • Transform - select the method for the source series (price) conversion before the use in the ClusterSMA algorithm. The following options can be selected for this parameter:
    • No - no conversion, the source series (price) is used;
    • Haar wavelet - Haar wavelet is used for converting the source series (price).
    • Modified SMA - a modified simple moving average from the article Technical Analysis: How Do We Analyze? (fig.2) is used for converting the source series (price).

Haar wavelet and Modified SMA are plotted as dotted lines for clarity, their values are then used in the ClusterSMA algorithm. Despite the fact that the last few values ​​of these lines are redrawn, ClusterSMA is not redrawn (except for the zero bar). With these options, you can get earlier trend reversal signals, while maintaining acceptable stability on flat periods.

4. Alerts (Signals).

  • Bar of alert - the number of the bar on which the signal is checked (0 - the last unfinished bar). Signals are generated when the trend of the ClusterSMA indicator line changes. If "Bar of alert" is greater than 0, then the signal will be generated only if the indicator moves in the same direction on the specified bar and all the subsequent bars. Thus, the signals are only generated during a steady trend and are ignored in all other cases, to reduce false triggers.
  • Sound - enable/disable sound alert.
  • Log - prints the signal message into the log.
  • Alert - generates a sound alert, prints a message about the signal to the dialog box and to the log.
  • Mail - sending an email using an address specified on the Email tab of the options window.
  • Notification - sends a notification to mobile terminals which have their MetaQuotes IDs specified in the "Notifications" tab of the terminal settings.


Appearance

The indicator plots two lines. One of them is a simple moving average (SMA), while the second one is a result of the cluster filter operation (SMA+Cluster).

Check out the Comments and What's new tabs, as well as my blog (in Russian) for the news about the project.
Pascal Wetzel
1212
2016.07.30 03:13 
 

Good work!

Nikolay Moskalev
2506
2015.10.12 14:48 
 

Спасибо!

バージョン 1.7 - 2016.01.07
1. Added settings for color, thickness and style of the ClusterSMA indicator line to the section "1. General settings" of the input parameters.
2. Added settings for color, thickness and style of the SMA indicator line to the section "2. SMA settings" of the input parameters.
3. Added an option to enable/disable the following alerts about a trend change to the section "4. Alerts" of the input parameters.
Log - prints a message about the signal in the log;
Alert - generates a sound alert, displays a message about the signal in the log and the opened dialog;
Mail - sends an email about the signal to the address, specified in the "Email" tab of the terminal settings window.
Notification - sends a notification to the mobile terminals, which have their MetaQuotes ID specified in the "Notifications" tab of the terminal settings window.
バージョン 1.6 - 2015.12.02
1. Indicator calculation time reduced, code optimized.
2. Improved indicator reaction in the areas of possible trend change, lag reduced. Please see the Comments section for details
3. Section 4 "Alerts" is added in inputs - configuration of indicator signals:
"Bar of alert" - the number of the bar to check the signal (0 - last incomplete bar);
"Sound" - enable/disable sound alert.
Alerts are generated in case of change of the indicator line trend. If "Bar of alert" is above 0, the signal is only generated if the indicator shows the same direction on the specified bar and all the following bars. So the alerts are generated only on the stable trend, and are ignored in all other cases to reduce false signals.
バージョン 1.5 - 2015.10.19
1. The inputs are divided into three groups in the indicator settings window.
2. Added the 'Max bars in chart' parameter - maximum amount of bars calculated and displayed in the indicator window during the product's start or re-calculation. The default value is 256 bars. This greatly speeds up the preparation of the indicator for trading and testing. If 0, the indicator is calculated at the entire available history. The minimum amount of displayed bars is three.
3. Added the 'Recalculation of the last bar' parameter - select the last unfinished bar re-calculation mode. The 'Every tick' mode is set by default. There are three options in the current version:
'Every tick' - the indicator is re-calculated at every tick at the last unfinished bar. Use this mode if the indicator readings are important on this bar.
'Every new minute bar' - the indicator at the last unfinished bar is re-calculated only when a new bar arrives on M1 timeframe. It is recommended to use the mode on timeframes exceeding M1. This reduces the load on CPU and allows tracking changes in the indicator readings once per minute.
'Every new bar' - the indicator at the last unfinished bar is re-calculated only when a new bar arrives on the current timeframe. The indicator values on a new bar are often disregarded when defining a signal for a trading system. By selecting the option, you can significantly reduce the indicator calculation time in actual trading, as well as during strategy tests.
4. Added the Line SMA - enable/disable the SMA indicator line in the terminal window and the indicator's values in the data window. This option does not disable SMA calculation in the indicator since its values are necessary for operation.
5. Added the 'Line of transform' parameter - enable/disable the transformed price line in the terminal window and its values in the data window. This option does not disable transformation calculation in the indicator.
6. Fixed the cluster filter errors that can affect the final indicator line. I recommend re-checking the strategies applying the indicator.
バージョン 1.4 - 2015.09.15
Fixed an error occurred when selecting No in the Transform parameter. The indicator line was not displayed, though the calculation was performed correctly.
バージョン 1.3 - 2015.09.11
New option "Modified SMA" in the Transform parameter. The option applies a modified Simple Moving Average (from the article "Technical Analysis: How do we analyze?" at Fig.2 at https://www.mql5.com/en/articles/174) to convert the source series (price).

For clarity, Modified SMA is plotted as a dotted line. Its values are then used in the ClusterSMA algorithm. Although the last few values of the line may be redrawn, ClusterSMA does not repaint (except for the last bar). This option provides advanced trend reversal signals while preserving stability in flat periods. For details see the Comments page.
バージョン 1.2 - 2015.09.01
Added the new Transform parameter allowing you to select initial series (price) transformation method before being used in the ClusterSMA algorithm. Currently, the parameter has two values:
"No" - no transformations are performed, the initial series (price) is used;
"Haar wavelet" - Haar wavelet (https://en.wikipedia.org/wiki/Haar_wavelet) is used for the initial series (price) transformation. The wavelet is displayed as a dashed line for more visibility. After that, its values are used in the ClusterSMA algorithm. Despite the fact that a few last wavelet line values are repainted, ClusterSMA is not repainted (except for a zero bar). The details can be found in the Comments tab.
バージョン 1.1 - 2015.08.17
Operation of the built-in filter has been changed in spots of possible trend reversal.
See details in comments.