XMA-XN - MetaTrader 5 Script | Forex Indicator Download - MT4/MT5 Resources - MetaTrader 5 Resources

A fan formed by one hundred XMA moving averages.
Indicator buffers are declared with the simplest class for code optimization:
//+------------------------------------------------------------------+ //| Array of variables for creating indicator buffers | //+------------------------------------------------------------------+ ClassCIndicatorsBuffers { People : Double IndBuffer[]; }; //+------------------------------------------------------------------+ //|Indicator buffer creation | //+------------------------------------------------------------------+ CIndicatorsBuffers Ind[LINES_TOTAL];
If you want to change the number of lines on the chart, you should only change the value of the LINES_TOTAL constant:
//+------------------------------------------------+ //| Constant declaration | //+------------------------------------------------+ #Define LINES_TOTAL 100 // Constant number of indicator lines
The indicator allows choosing a smoothing type from ten possible versions:
It should be noted that the Phase type parameters of different smoothing algorithms have completely different meanings. For JMA, it is an external phase variable that varies from -100 to +100. For T3, it is the smoothed ratio multiplied by 100 for better visualization; for VIDYA, it is the CMO oscillation period; for AMA, it is the slow EMA period. In other algorithms, these parameters do not affect smoothing. For AMA the fast EMA period is a fixed value, equal to 2 by default. For AMA, the ratio of raised powers is also equal to 2.
Indicator input parameters:
//+------------------------------------------------+ //| Indicator input parameters | //+------------------------------------------------+ Input integer steps = 10 ; // interval step size Input Smooth_Method xMA_Method=MODE_JJMA; // Average method Input integer x length = 3 ; // smooth depth Input integer x phase = 100 ; // smoothing parameter Input Application_Price_IPC= PRICE_CLOSE ; // Price constant Enter integer shift = 0 ; // horizontal movement of the indicator in bars Input integer price movement = 0 ; // vertical movement of the indicator in points input integer color width = 40 ; // palette width (changed from 0 to 131)
The indicator uses the SmoothAlgorithms.mqh library class (must be copied to terminal_data_folder\MQL5\Include). The use of the class "Average price series for intermediate calculations without using additional buffers" is described in detail in the article.

Attachment download
📎 smoothalgorithms.mqh (133.8 KB)
📎 xma-xn.mq5 (10.6 KB)
📎 xma-xn_.mq5 (10.6 KB)
Source: MQL5 #686
💡 Featured Recommendations
✍️ Latest by the author
- •
- •
- •
- •
- •
- •
📌 Popular topics
- •
- •
- •
- •
- •
- •
- •
- •
🔗 You May Be Interested In
- •
- •
- •
- •
- •
- •