Very Latest John Ehler's Correlation Trend Indicator

Viewing 2 posts - 31 through 32 (of 32 total)
  • Author
    Posts
  • #130869 quote
    supertiti
    Participant
    Master
    // CTI Short <= -0.95
    
    Speriod = 5
    //Short
    SumSx = 0 // the price curve
    SumSy = 0
    SumSxx = 0
    SumSxy = 0
    SumSyy = 0 // the trend line
    
    data=customclose
    
    for count = 0 to SPeriod-1 do
    X = Data[count] // the price curve
    Y = -count // the trend line
    SumSx = SumSx + X
    SumSy = SumSy + Y
    SumSxx = SumSxx + X*X
    SumSxy = SumSxy + X*Y
    SumSyy = SumSyy + Y*Y
    next
    
    if(SPeriod*SumSxx-SumSx*SumSx > 0 and SPeriod*SumSyy-SumSy*SumSy > 0) then
    CTIShort = (SPeriod*SumSxy-SumSx*SumSy)/Sqrt((SPeriod*SumSxx-SumSx*SumSx)*(SPeriod*SumSyy-SumSy*SumSy))
    endif
    
    c1 = CTIshort  <= - 0.95
    
    SCREENER [ c1 ]
    Bard thanked this post
    #130871 quote
    supertiti
    Participant
    Master
    // CTI LONG UP
    // CTI BARD
    //Ehler's Correlation Trend Indicator (CTI) //PRC_R-Squared coefficient | indicator
    //19.09.2018 //Updated to double Ehler's R2 03/05/2020
    //Nicolas @ www.prorealcode.com //Sharing ProRealTime knowledge
     
    // --- settings
    LPeriod     = 30 //Add in Variables  perso = 30
    SPeriod     = 5 //Add in Variables  perso = 5
    // --- end of settings
    
    ///////////////////////////////////////////////////////////////////////////////////////////////////
    
    // Defparam calculateonlastbars = 100
    
    //Short
    SumSx = 0 // the price curve
    SumSy = 0
    SumSxx = 0
    SumSxy = 0
    SumSyy = 0 // the trend line
    
    data=customclose
    
    for count = 0 to SPeriod-1 do
    X = Data[count] // the price curve
    Y = -count // the trend line
    SumSx = SumSx + X
    SumSy = SumSy + Y
    SumSxx = SumSxx + X*X
    SumSxy = SumSxy + X*Y
    SumSyy = SumSyy + Y*Y
    next
    
    if(SPeriod*SumSxx-SumSx*SumSx > 0 and SPeriod*SumSyy-SumSy*SumSy > 0) then
    // CTIShort = (SPeriod*SumSxy-SumSx*SumSy)/Sqrt((SPeriod*SumSxx-SumSx*SumSx)*(SPeriod*SumSyy-SumSy*SumSy))
    endif
    
    ///////////////////////////////////////////////////////////////////////////////////////////////////
    
    //Long
    SumLx = 0
    SumLy = 0
    SumLxx = 0
    SumLxy = 0
    SumLyy = 0
    
    for count = 0 to LPeriod-1 do
    X = Data[count] // the price curve
    Y = -count // the trend line
    SumLx = SumLx + X
    SumLy = SumLy + Y
    SumLxx = SumLxx + X*X
    SumLxy = SumLxy + X*Y
    SumLyy = SumLyy + Y*Y
    next
    
    if(LPeriod*SumLxx-SumLx*SumLx > 0 and LPeriod*SumLyy-SumLy*SumLy > 0) then
    CTILong = (LPeriod*SumLxy-SumLx*SumLy)/Sqrt((LPeriod*SumLxx-SumLx*SumLx)*(LPeriod*SumLyy-SumLy*SumLy))
    endif
    
    c1 = CTIlong < - 0.8
    c2 = CTIlong [1] < CTIlong [2]
    c3 = CTIlong > CTIlong [1]
    
    SCREENER [c1 and c2 and c3 ]
    Bard thanked this post
Viewing 2 posts - 31 through 32 (of 32 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

Very Latest John Ehler's Correlation Trend Indicator


ProBuilder: Indicators & Custom Tools

New Reply
Author
author-avatar
Bard @brad Participant
Summary

This topic contains 31 replies,
has 4 voices, and was last updated by supertiti
6 years, 4 months ago.

Topic Details
Forum: ProBuilder: Indicators & Custom Tools
Language: English
Started: 04/28/2020
Status: Active
Attachments: 21 files
Logo Logo
Loading...