CorrelationLog

Top  Previous  Next

The CorrelationLog function returns the statistical correlation for the specified number of bars between two markets. It measure the correlation based on the change in the log of the values in the series.

 

Syntax

 

CorrelationLog( series1, series2, barsToMeasure, [offset1], [offset2] )

 

Parameters

barsToMeasure

 

the number of bars over which to measure the correlation

series1

 

the first series

series2

 

the second series

offset1

 

the offset of the first series

offset2

 

the offset of the second series

 

 

 

returns

 

statistical correlation for last barsToMeasure bars

 

 

 

Example

soybeans.LoadSymbol( "S" )

gold.LoadSymbol( "GC" )

correlation = CorrelationLog( soybeans.close, gold.close, 500 )

 

Returns the correlation between GC and S over the last 500 days

 

Returns a decimal number between -1 and 1. Returns -1 if the two series are perfectly negatively correlated. Returns 0 if the two series are not correlated at all. Returns 1 if the two series are perfectly positively correlated.

 

Generally .7 or greater is considered loosely correlated and .9 or greater is considered closely correlated.