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

XR Squared - MetaTrader 5 Script | Forex Indicator Download - MT4/MT5 Resources - MetaTrader 5 Resources

author EAcpu | 5 reads | 0 comments |

XR-squared - indicator for MetaTrader 5

The XR-Squared indicator uses linear regression to determine the presence or absence of a market trend.

The XR squared line itself is shown on the chart along with the two levels of the trending and flat market. Indicator values ​​are set in the range 0 to 100. When the indicator falls below 30, the market is considered flat, while when the indicator rises above 70, a trend is considered present. As the trend develops, the XR squared line rises from non-trending to trending levels. When the market reaches a top and begins to pull back, the indicator falls again.

The higher the value of XR squared, the more statistically significant the new trend is. Depending on the period, the trend's critical power level decreases.

Input parameters:

//+------------------------------------------------+
//|Indicator input parameters |
//+------------------------------------------------+
Enter the integer XP period = 14 ; // indicator period
Enter Smooth_Method RMethod=MODE_JJMA; // Smoothing method
Input integer RP period = 3 ; // smoothing period
Input integer R phase = 100 ; // Smoothing parameter
Input Smooth_Method SignMethod= Mode_SMA ; // Smoothing method
Input integer signature period = 14 ; // signal line smoothing period
Input integer sign phase = 15 ; // smoothing parameter
Input application_price_IPC= PRICE_CLOSE ; // application price
Enter integer shift = 0 ; // horizontal movement of the indicator in bars

The indicator allows changing the smoothing method:

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.

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.

XR-squared - indicator for MetaTrader 5


Attachment download

📎 smoothalgorithms.mqh (133.8 KB)

📎 xr-squared.mq5 (10.7 KB)

Source: MQL5 #752

Verification code Refresh