FinAnalysis User Guide

## Moving Correlation Coefficient |

The __Mcc__
calculates a correlation coefficient of two data series over the last n
periods. This statistical calculation is used to determine if two series of
numbers are related. The closer the value is to 1, the closer the data is
related.

Calculation

where n – is the period.

Chart Example

Implementation and Usage

To initialize Mcc indicator use one of the following constructors:

Mcc – sets default values: period = 14

Mcc(Int32) – sets value for period

Mcc(TimeSpan) – sets time period

Use

MCC - property to get current value

Example

C#

1Calculate the correlation coefficient between simple moving average and price 2// Create new instance 3Mcc mcc = new Mcc(28); 4Sma sma = new Sma(14); 5 6// Add new data points 7sma.Add(CurrentPrice); 8mcc.Add(CurrentPrice, sma.SMA); 9 10// Get indicator value 11double IndicatorValue = mcc.MCC;