Expert Advisors • Indicators • Scripts • Libraries

MQL.RobotFX.org is the biggest collection of MetaTrader expert advisors (MT5 & MT4), indicators, scripts and libraries that can be used to improve trading results, minimize risks or simply automate trading tasks

MetaTrader 5 Indicator | Spearman rank correlation - floating levels

Usually when Spearman rank is used, it is coupled with some fixed levels that, once when crossed, should indicate high "strength" of correlation (positive or negative, does not matter). This version is a Spearman rank correlation with an addition of floating levels to be used instead of using fixed level as a measure of high or low correlation ratio.

MetaTrader Experts, Indicators, Scripts and Libraries

Theory:

A nonparametric (distribution-free) rank statistic proposed by Spearman in 1904 as a measure of the strength of the associations between two variables (Lehmann and D'Abrera 1998). The Spearman rank correlation coefficient can be used to give an R-estimate, and is a measure of monotone association that is used when the distribution of the data make Pearson's correlation coefficient undesirable or misleading.

The Spearman rank correlation coefficient is defined by

MetaTrader Experts, Indicators, Scripts and Libraries

where is the difference in statistical rank of corresponding variables, and is an approximation to the exact correlation coefficient.

Usage:

You can use the color change as a signal.

PS: the "big picture" example that can show why it seems that floating levels are adding to the estimation when Spearman rank is used.

MetaTrader Experts, Indicators, Scripts and Libraries

22966