By default, this indicator displays nine values of two different Moving Averages (МА) for the current timeframe, a difference between previous sequential МА values and a difference between MAs in points. You can set the data display with positive or negative offsets and/or rounded to required decimal digits. Displaying the values for zero (current) bar is not supported.
This indicator, as its version for MetaTrader 4, can be used for displaying not only a difference between sequential values, but also a distance in points, without extending the source code:
As shown on the screenshots below, a table is displayed on a 3-digit chart with values, rounded to 2 decimal digits, and also "extended" to 4 decimal digits.
Other than that, the indicator is identical to its version for MetaTrader 4:
In the indicator table, the colors change automatically for МА (or bars) marks and differences between adjacent sequential values. Different colors apply when values change to greater, lesser and/or equal. Changing color for difference between two moving averages (and/or bars or offsets) displayed in the fifth table row is not supported.
The calculations and changing the table values occur when:
If nine values in each table row by X axis is too much or too low, then to change the number of cells and thus the amount of calculated and displayed data, you need to change 9 to a positive number >= 2 in this line of code:
#define ARRAY_SIZE_X 9
Note: The table heading shows the bar numbers the values of which are displayed by the indicator. In the indicator parameters, you can change the starting bar number to any positive non-zero value.
The reason for not including the zero bar is that I wrote the indicator for personal needs and I didn't require to display constantly changing data for the current (zero) bar. However, if you require to display data (results) changing with every tick for a currently forming bar, you need to implement a slightly different code structure.
In fact, the limitation for current (zero) bars applies only to values in the table. So you can, if required, add lines to the code, for example, to implement notifications (alerts etc.) triggering when the current price breaks through certain values from the table. You can also trigger the notifications when certain "new" values from the table are less than/greater than or equal to certain "old" values. Also, you can replace the existing MA or bar mark calculations with some other required calculations.
Note: Tooltips with parameter values will display only if "Show object descriptions" option is turned on in the chart properties.
Note: To make the indicator display Open and/or High and/or Low and/or Close of adjacent bars and differences between them instead of MA calculations, you need to set the following MA values in the input parameters:
With this set of parameters, the indicator will calculate directly by bar marks, without getting the iMA handle.
- Period Moving Averages... = 1;
- MA method...= MODE_SMA;
- Apply to... = PRICE_OPEN, PRICE_HIGH, PRICE_LOW or PRICE_CLOSE.
Note: Line colors depend on direction of first calculated bar value, which is set in the line Shift (bar for first value):. Plotted lines are 1 bar longer deep into the chart, than the number of МА values in the table (this allows to see which mark the last bar in the table is compared with).
Fig.1. Indicator lines, marks and differences in points between High and Low prices, rounded to 2 decimal digits, on a 3-digit chart
Fig.2. Marks and differences in points between 2 moving averages, "extended" to 4 decimal digits, on a 3-digit chart
Note: If you have added this indicator on a chart along with standard Moving Average(s) and you haven't set offsets and/or rounding in the ID Lite Info MA input parameters, but the lines of this indicator don't match the standard MAs (with the same parameters), then please do not jump to conclusions about the accuracy of calculation.
Open the Data Window and check the number of displayed digits for the standard Moving Average (for example, it may use 4 decimal digits on a 3-digit chart).
This is normal and convenient in my opinion because moving averages are calculated by average values. Example: (1.2052 + 1.2057 + 1.2073)/3 = 1.2060667. Therefore, calculated values with rounded or extended digits increase the number of possible use scenarios.
If the lines should perfectly match (with other parameters identical), you can choose a greater number of decimal digits in Decimal digits drop-down list in the ID Lite Info MA input parameters.
Fig.3. Built-in Moving Average and ID Lite Info MA (with Decimal digits=current chart) on a 3-digit chart
Version 1.11 from 25.09.2015:
bool CheckInput(int period,string text)
Translated from Russian by MetaQuotes Software Corp.
Original code: https://www.mql5.com/ru/code/13356
The ColorZerolagX10MA indicator with additional trend strength indication using colored dots based on the standard deviation algorithm.Exp_ColorZerolagX10MA
The Exp_ColorZerolagX10MA Expert Advisor is based on the ColorZerolagX10MA moving average change of direction.