TheGereon
Pine Script Rookie
Pine Script Rookie
Posts: 1
Joined: July 19th, 2022

How can I use the ta.correlation function in PineScript (Tradingview) to show the correlation of two different symbols?

I am new to Pine and my problem is that when using the ta.correlation function, I can't figure out how to define two different symbols for which the correlation is displayed.

I only manage to load in as input the price data (with close, open etc. ) from the same symbol, which of course makes little sense.

How do I have to proceed further? Do I have to load another symbol with request.security first?

Thanks in advance :)

processingclouds
Pine Script Master
Pine Script Master
Posts: 115
Joined: January 30th, 2022

Re: How can I use the ta.correlation function in PineScript (Tradingview) to show the correlation of two different symbo

Hey,

You need to use request.security(.......... to get the other symbol source value and than use that with ta.correlation

Return to “Pine Script Q&A”