correlation
Syntax Format
correlation(x, y, n)
Overview
The correlation
function provides the coefficient for the two sets of series, taken into calculation – x and y, over a chosen period, indicated as n in the formula. This function can be useful to analyze and compare the given data series, their directions, interconnection, etc. You can also use this function to compare price series of different assets.
Parameters
Parameter | Type | Purpose |
---|---|---|
x | series | First series |
y | series | Second series |
n | integer | Period, taken into calculation |
Returns: series
.
Example
h_l = correlation(high, low, 14) -- correlation between highest and lowest price values of 14 bars
Formula
The formula for calculating the correlation
function is: