Correlation Coefficient

Viewing 2 posts - 16 through 17 (of 17 total)
  • Author
    Posts
  • #44759 quote
    Leonida1984Leonida1984
    Participant
    Average

    Good afertoon everyone, could someone help me?

    I need to use code of The Pearson R Correlation whitout the problem that I wrote above.

    Thanks

    #193231 quote
    NicolasNicolas
    Keymaster
    Legend

    For future reference, the pinescript instruction “correlation” is the same as this prorealtime code:

    ProBuilder" >//correlation(x, y, len)
    
    len = 20
    x = barindex
    y = customclose
    
    lenMinusOne = len - 1
    meanx = 0.0
    meany = 0.0
    for i=0 to lenMinusOne
    meanx = meanx + (x[i])
    meany = meany + (y[i])
    next
    meanx = meanx / len
    meany = meany / len
    sumxy=0.0
    sumx=0.0
    sumy=0.0
    for i=0  to lenMinusOne
    sumxy = sumxy +    ((x[i]) - meanx) * ((y[i]) - meany)
    sumx  = sumx  + pow((x[i]) - meanx, 2)
    sumy  = sumy  + pow((y[i]) - meany, 2)
    correlation = sumxy / sqrt(sumy * sumx)
    next
    
    return correlation
Viewing 2 posts - 16 through 17 (of 17 total)
  • You must be logged in to reply to this topic.
ProRealAI ProRealAI New

Stuck on this ProBuilder code?

Describe what this topic is trying to build, in plain English, and ProRealAI writes the ProRealTimeā„¢ indicator, screener or system for you.

Available in 7 languages
Try ProRealAI

Correlation Coefficient


ProBuilder: Indicators & Custom Tools

New Reply
Summary

This topic contains 16 replies,
has 1 voice, and was last updated by NicolasNicolas
4 years, 4 months ago.

Topic Details
Forum: ProBuilder: Indicators & Custom Tools
Language: English
Started: 08/02/2016
Status: Active
Attachments: 2 files
ProRealCode ProRealCode
Loading...