The author of the idea: yyy999, the mq5 code author: barabashkakvn.
Calculation principle
MaxHigh (the highest high) and MinLow (the lowest Low) are determined in the specified KdjPeriod interval. Thus, MaxHigh minus MinLow will be equal to the height of the selected KdjPeriod interval. Next, we determine the distance between the Close price of the current bar and MinLow as a percentage of the height of the selected KdjPeriod interval. It is the base RSV line.
By averaging the base RSV line with the M1 period, we obtain a smoothed K line. By averaging the smoothed K line with the M2 period, we obtain a smoothed D line. The difference between the K line and the D line gives the KDC histogram.
Compare KDJ Indicator and MACD: