Welcome Forex EA downloads & MT4/MT5 auto-trading resources — EAs, Gold EAs, quant tools and real-world automation.
Sign In Sign Up

ms - candle index. Indicator of directional strength of candles. -MetaTrader 5 Script | Forex Indicator Download - MT4/MT5 Resources

author EAcpu | 5 reads | 0 comments |

ms-Candle-Index. Indicator of the strength of the direction of the candle. - indicator for MetaTrader 5

ms-Candle-Index. Indicator of the strength of the direction of the candle. - indicator for MetaTrader 5

ms-Candle-Index. Indicator of the strength of the direction of the candle. - indicator for MetaTrader 5

ms-Candle-Index. Indicator of the strength of the direction of the candle. - indicator for MetaTrader 5

This indicator determines price and bar direction index of gaps/breaks.
This is the logical continuation of the Lady Candlestick indicator.

Comparison of open and close prices often does not correctly assess the direction of the candle.
If the body size exceeds 2/3 of what it would otherwise be, they can be constructed differently to assess. This indicator adopts the author's empirical approach to this problem.

During the calculation of the indicator, some statistical characteristics of some quotes are evaluated. The result description structure TCandlesStats. Calculate the size of the boundary minimum and maximum candles, as well as the approximate size of the "average" or "normal" candle. Assessment is based on the height of the candle and the height of its body.
The results of the calculation are displayed in the terminal log. The calculation is performed on a fixed-size window of data and is repeated when passing at least 1/3 of its size.
This ensures that the results are up to date at the time of calculation.

Quotation gaps (large gaps) are estimated using statistical estimates of the size of the largest candle.
It would be more correct to use a price deviation channel and open prices beyond that channel.
However, defining this channel correctly is much more difficult.

When calculating the indicator, the TCandleInfo structure is calculated for each bar.
The meaning of the fields is clear from the comments. Calculations are implemented in the form of macros.

Information about the directional strength of the bar - Directional Index is displayed in the indicator window (Fig. 1-2).
A positive indicator indicates an increase in prices, a negative indicator indicates a decrease in prices.
The indicator is dimensionless and is standardized relative to the statistics estimated by the largest candle size.
The inclusion of additional normalization (additional normalization parameter CI = true Figure 3-4) allows adjusting the index values ​​to the -1..1 interval. The larger the index, the more obvious the price changes.
Module 1 Large values ​​(0.6321 mode extra normalized) are talking about strong impulse prices towards movement.

ms-Candle-Index. Indicator of the strength of the direction of the candle. - indicator for MetaTrader 5

ms-Candle-Index. Indicator of the strength of the direction of the candle. - indicator for MetaTrader 5


Visually, each bar is described by two states of the histogram column:
1. According to the index sign of the candle - appearance color (red/green)
2. Bar of exponential change (light green/light red) excluding the current symbol relative to the value on the previous bar.


Therefore, for an upward candle (the index is in the "+" zone), the bar will be green. If this is relative exponential growth, the inner columns will be colored light green, if the index is decreasing, the inner columns will be colored light red.
For falling candles, the principle is similar. If the relative index change is 0, the inner column is not drawn and the color of the index becomes full green or red.

ms-Candle-Index. Indicator of the strength of the direction of the candle. - indicator for MetaTrader 5

ms-Candle-Index. Indicator of the strength of the direction of the candle. - indicator for MetaTrader 5

Candle index value can be smoothed with a small set of MA. This is done using this
Library (author Nikolai Kosichin). Two changes were made to it for use in MQL4.
The modified SmoothAlgorithms45.mqh library should be placed in the Include folder of the terminal.
Available for MT4 and MT5.

The yellow line is the MA of the CI value, and the blue line is the MA of the CI change (1st derivative).

What is the difference with ms-Candle indicator? What's the point?
In some cases it is important to "see" at a certain moment that the direction of the price movement has begun to change, but not only his fact has changed.

To use in MT4, change the extension of the file ms-candle-index to mq4 and paste MQL5\Include\SmoothAlgorithms45.mqh into the folder MQL4\include or download it here .


Version changes:

1.00 Normalization is introduced in the direction estimation algorithm and the structure of TCandleInfo is expanded.
1.01 Add input option to hide histograms
1.02 additional normalization by the square of the direction coefficient, which allows a denser filling of the interval -1..1 without losing the ratio of CI to quote window statistical evaluation.
Levels added. Assessment I recommend discussion.
1.03 Fixed description. Changed the level of each mode (normalized on/off).
Logically correspond to each other. Added simple information panel.

Fixed SmoothAlgorithms45. mqh code for compilation in latest MT5 version


Attachment download

📎 ms-candle-index.mq5 (70.71 KB)

📎 smoothalgorithms45.mqh (261.67 KB)

Source: MQL5 #24232

Verification code Refresh