Screener Regression Linéaire plus Fibonacci

Viewing 14 posts - 1 through 14 (of 14 total)
  • Author
    Posts
  • #235666 quote
    supertiti
    Participant
    Master
    // REGRESSION LINEAIRE DROITE + FIBONACCI by Ivan le 30.05.2024
     
    //PRC_Std and Ste LinRegChannel  indicator
    //Standard Deviation and Standard Error
    //Linear Regression Channel //12.03.2019
    //Nicolas @ www.prorealcode.com //Sharing ProRealTime knowledge
    // Modifié par IVAN le 30.05.2024 (Fibo)
     
     
    defparam drawonlastbaronly=true
    defparam calculateonlastbars=1000
    // --- settings
    lookback= 200 //channel period
    ChannelType = 1 //1= Standard Deviation ; 2= Standard Erro
    NbDeviation = 1 //Deviation multiplier
    colorRed = 255
    colorGreen = 255
    colorBlue = 0
    // --- end of settings
     
    sumx = 0
    sumy = 0
    sumxy = 0
    sumx2 = 0
     
    for cmpt = lookback downto 0 do
    tmpx = cmpt
    tmpy = close[cmpt]
    sumy = sumy+tmpy
    sumx = sumx+tmpx
    sumx2 = sumx2 + (tmpx*tmpx)
    sumxy = sumxy + (tmpy*tmpx)
    next
     
    n = lookback+1
     
    if (sumx2 = sumx * sumx) then // protection to avoid infinite values
    b = sumxy - sumx * sumy
    else
    b = (n * sumxy - sumx * sumy) / (n * sumx2 - sumx * sumx)
    endif
    a = (sumy - b * sumx) / n
    /////////////////////////////////////////
     
    //channel
    if ChannelType = 1 then //Standard Deviation
    dat = std[lookback]*NbDeviation
    else
    dat = ste[lookback]*NbDeviation
    endif
     
    drawsegment(barindex[lookback],(a+b*lookback)+dat,barindex,a+b*0+dat) coloured(colorRed,colorGreen,colorBlue)style(line,4)coloured("yellow")
    drawsegment(barindex[lookback],(a+b*lookback)+0.618*dat,barindex,a+b*0+0.618*dat) coloured(colorRed,colorGreen,colorBlue)style(dottedline,4)coloured("green")
    drawsegment(barindex[lookback],(a+b*lookback)+0.5*dat,barindex,a+b*0+0.5*dat) coloured(colorRed,colorGreen,colorBlue)style(dottedline,2)coloured("green")
    drawsegment(barindex[lookback],(a+b*lookback)+0.382*dat,barindex,a+b*0+0.382*dat) coloured(colorRed,colorGreen,colorBlue)style(dottedline,2)coloured("green")
    drawsegment(barindex[lookback],(a+b*lookback)+0.236*dat,barindex,a+b*0+0.236*dat) coloured(colorRed,colorGreen,colorBlue)style(dottedline,2)coloured("green")
    drawsegment(barindex[lookback],a+b*lookback,barindex,a+b*0) coloured(colorRed,colorGreen,colorBlue)style(dottedline,5)coloured("blue")
    drawsegment(barindex[lookback],(a+b*lookback)-0.236*dat,barindex,a+b*0-0.236*dat) coloured(colorRed,colorGreen,colorBlue)style(dottedline,2)coloured("red")
    drawsegment(barindex[lookback],(a+b*lookback)-0.382*dat,barindex,a+b*0-0.382*dat) coloured(colorRed,colorGreen,colorBlue)style(dottedline,2)coloured("red")
    drawsegment(barindex[lookback],(a+b*lookback)-0.5*dat,barindex,a+b*0-0.5*dat) coloured(colorRed,colorGreen,colorBlue)style(dottedline,2)coloured("red")
    drawsegment(barindex[lookback],(a+b*lookback)-0.618*dat,barindex,a+b*0-0.618*dat) coloured(colorRed,colorGreen,colorBlue)style(dottedline,4)coloured("red")
    drawsegment(barindex[lookback],(a+b*lookback)-dat,barindex,a+b*0-dat) coloured(colorRed,colorGreen,colorBlue)style(line,4)coloured("yellow")
     
    Return customclose as " REGRESSION LINEAIRE + FIBO "

    Bonjour à tous

    J’aimerai à partir de ce code avoir un screener qui me renvoie :

    condition 1 = la ligne de régression linéaire est supérieure à la ligne d’il y a 50 jours (canal haussier)

    condition 2 = le prix du jour croise à la hausse la ligne basse du canal de régression linéaire

    J’ai bien essayé mais je tourne en rond !

    merci pour votre aide

    LOREAL.jpg LOREAL.jpg
    #235682 quote
    Iván González
    Moderator
    Master

    Ici vous avez le code

    // --- settings
    lookback= 200 //channel period
    ChannelType = 1 //1= Standard Deviation ; 2= Standard Erro
    NbDeviation = 1 //Deviation multiplier
    // --- end of settings
     
    sumx = 0
    sumy = 0
    sumxy = 0
    sumx2 = 0
     
    for cmpt = lookback downto 0 do
    tmpx = cmpt
    tmpy = close[cmpt]
    sumy = sumy+tmpy
    sumx = sumx+tmpx
    sumx2 = sumx2 + (tmpx*tmpx)
    sumxy = sumxy + (tmpy*tmpx)
    next
     
    n = lookback+1
     
    if (sumx2 = sumx * sumx) then // protection to avoid infinite values
    b = sumxy - sumx * sumy
    else
    b = (n * sumxy - sumx * sumy) / (n * sumx2 - sumx * sumx)
    endif
    a = (sumy - b * sumx) / n
    /////////////////////////////////////////
     
    //channel
    if ChannelType = 1 then //Standard Deviation
    dat = std[lookback]*NbDeviation
    else
    dat = ste[lookback]*NbDeviation
    endif
    
    // Conditions
    // Condition 1: Linear regression line above the line from 50 days ago
    regressiontoday = a + b * 0
    regression50daysago = a + b * 50
    condition1 = regressiontoday > regression50daysago
    
    // Condition 2: Price crosses above the lower channel line
    lowerchannelline = a + b * 0 - dat
    condition2 = close crosses over lowerchannelline
    
    screener[condition1 and condition2]
     
    
    AES-Daily.png AES-Daily.png
    #235685 quote
    supertiti
    Participant
    Master

    Muchas gracias Ivan ,que rapido,lo probare mañana ahorra voy à tomar  una cervecita sin con los 37 que tenemos

    #235718 quote
    supertiti
    Participant
    Master

    Bonjour à tous,

     

    J’ai installé le screener ce matin et il fonctionne tip top !

    merci Ivan

    Bon trades à tous.

    #235815 quote
    supertiti
    Participant
    Master

    Bonjour à tous,

    Le screener fonctionne bien mais j’aimerai réduire le nombre d’occurences , le système ne montrant que les 50 premiers résultats .

    Comment faire pour avoir que les valeurs qui sont dans la moitié basse du canal.

    Je joins une image de BNP, la zone voulue est celle de l’élipse verte claire.

    bons trades.

    BNP-RL-FIBO.jpg BNP-RL-FIBO.jpg
    #235818 quote
    jacquesgermain
    Participant
    Senior

    Bonjour

    changer la condition2 ainsi

    condition2= close crosses over lowerchannelline remplacée par :

    condition2 = close<(a + b * 0) et low>= ligne de canal inférieure

    #235823 quote
    Fr7
    Participant
    Master

    Bonjour, Supertiti, j’ai personnellement et humblement testé l’indicateur en rajoutant une flèche… et je pense que ça repeint car par exemple “ENPH” le 24/07/24 a donné un signal et aujourd’hui le 26/07/24 la flèche n’est plus apparaît… …

    ENPH.jpg ENPH.jpg
    #235829 quote
    jacquesgermain
    Participant
    Senior

    Bonjour

    Non il ne repeint pas si votre flêche n’apparait plus c’est à cause de “defparam DRAWONLASTBARONLY=true”

    voici ce que cela donne en modifiant l’indicateur

    // REGRESSION LINEAIRE DROITE + FIBONACCI by Ivan le 30.05.2024

    //PRC_Std and Ste LinRegChannel indicator
    //Standard Deviation and Standard Error
    //Linear Regression Channel //12.03.2019
    //Nicolas @ http://www.prorealcode.com //Sharing ProRealTime knowledge
    // Modifié par IVAN le 30.05.2024 (Fibo)
    defparam calculateonlastbars=1000
    //defparam DRAWONLASTBARONLY=true
    // — settings
    lookback= lookback//200 //channel period
    ChannelType = 1 //1= Standard Deviation ; 2= Standard Erro
    NbDeviation = 1 //Deviation multiplier
    colorRed = 255
    colorGreen = 255
    colorBlue = 0
    // — end of settings
    sumx = 0
    sumy = 0
    sumxy = 0
    sumx2 = 0
    for cmpt = lookback downto 0 do
    tmpx = cmpt
    tmpy = close[cmpt]
    sumy = sumy+tmpy
    sumx = sumx+tmpx
    sumx2 = sumx2 + (tmpx*tmpx)
    sumxy = sumxy + (tmpy*tmpx)
    next
    n = lookback+1
    if (sumx2 = sumx * sumx) then // protection to avoid infinite values
    b = sumxy – sumx * sumy
    else
    b = (n * sumxy – sumx * sumy) / (n * sumx2 – sumx * sumx)
    endif
    a = (sumy – b * sumx) / n
    /////////////////////////////////////////
    //channel
    if ChannelType = 1 then //Standard Deviation
    dat = std[lookback]*NbDeviation
    else
    dat = ste[lookback]*NbDeviation
    endif
    if islastbarupdate then
    drawsegment(barindex[lookback],(a+b*lookback)+dat,barindex,a+b*0+dat) coloured(colorRed,colorGreen,colorBlue)style(line,1)coloured(0,0,155)
    drawsegment(barindex[lookback],a+b*lookback,barindex,a+b*0) coloured(colorRed,colorGreen,colorBlue)style(dottedline,1)coloured(“blue”)
    drawsegment(barindex[lookback],(a+b*lookback)-dat,barindex,a+b*0-dat) coloured(colorRed,colorGreen,colorBlue)style(line,1)coloured(0,0,155)
    if fibo=1 then
    drawsegment(barindex[lookback],(a+b*lookback)+0.618*dat,barindex,a+b*0+0.618*dat) coloured(colorRed,colorGreen,colorBlue)style(dottedline,1)coloured(“green”)
    drawsegment(barindex[lookback],(a+b*lookback)+0.5*dat,barindex,a+b*0+0.5*dat) coloured(colorRed,colorGreen,colorBlue)style(dottedline,1)coloured(“green”)
    drawsegment(barindex[lookback],(a+b*lookback)+0.382*dat,barindex,a+b*0+0.382*dat) coloured(colorRed,colorGreen,colorBlue)style(dottedline,1)coloured(“green”)
    drawsegment(barindex[lookback],(a+b*lookback)+0.236*dat,barindex,a+b*0+0.236*dat) coloured(colorRed,colorGreen,colorBlue)style(dottedline,1)coloured(“green”)
    drawsegment(barindex[lookback],(a+b*lookback)-0.236*dat,barindex,a+b*0-0.236*dat) coloured(colorRed,colorGreen,colorBlue)style(dottedline,1)coloured(“red”)
    drawsegment(barindex[lookback],(a+b*lookback)-0.382*dat,barindex,a+b*0-0.382*dat) coloured(colorRed,colorGreen,colorBlue)style(dottedline,1)coloured(“red”)
    drawsegment(barindex[lookback],(a+b*lookback)-0.5*dat,barindex,a+b*0-0.5*dat) coloured(colorRed,colorGreen,colorBlue)style(dottedline,1)coloured(“red”)
    drawsegment(barindex[lookback],(a+b*lookback)-0.618*dat,barindex,a+b*0-0.618*dat) coloured(colorRed,colorGreen,colorBlue)style(dottedline,1)coloured(“red”)
    endif
    endif
    // Conditions
    // Condition 1: Linear regression line above the line from 50 days ago
    regressiontoday = a + b * 0
    regression50daysago = a + b * 50

    condition1 = regressiontoday > regression50daysago
    // Condition 2: Price crosses above the lower channel line
    lowerchannelline = a + b * 0 – dat
    condition2 = close crosses over lowerchannelline
    if condition2 then
    DRAWARROWUP(barindex,lowerchannelline)
    endif

    Return customclose as “Regression Linéaire+Fibonacci “

    fifi743 and Fr7 thanked this post
    ENPH-Journalier.png ENPH-Journalier.png
    #235831 quote
    fifi743
    Participant
    Master
    regressiontoday = a + b * 0

    je ne comprend pas ce calcul
    regressiontoday = a suffit
    je m’explique priorité a la multiplication b*0=0
    donc a +0 =a

    jacquesgermain thanked this post
    #235832 quote
    supertiti
    Participant
    Master

    Bonjour à tous,

    merci Jacques pour ton aide le code fonctionne bien, je met la ligne en clair ci-dessous pour ceux qui comme moi on du mal avec le code

    condition2 = close<(a + b * 0) and low>= lowerchannelline

    @ FR7 je vais faire une photo et la regarder dans 8 jours , c’est ma façon de voir si un code repeint ou pas ? merci por l’avoir signalé

    Bons trades à tous dans ces moments si délicats.

    jacquesgermain thanked this post
    #235833 quote
    jacquesgermain
    Participant
    Senior

    bonjour

    c’est exact et confirmé car avec regressiontoday = a l’indicateur se comporte pareillement …

    fifi743 thanked this post
    #235835 quote
    supertiti
    Participant
    Master

    @ Jacques

    J’ai copier/coller le dernier code : il me demande Fibo, j’ai mis fibo en variable =1

    maintenant il veut un chiffre entier avec STD , j’ai mis 200 mais il me sort un graphe sans aucun retracement ni flêche.

    Il est où le lezard ?

    #235837 quote
    jacquesgermain
    Participant
    Senior

    Hello

    le lézard :

    mettre aussi lookback en variable …

    #235849 quote
    supertiti
    Participant
    Master

    merci Jacques bon dimanche

Viewing 14 posts - 1 through 14 (of 14 total)
  • You must be logged in to reply to this topic.

Screener Regression Linéaire plus Fibonacci


ProScreener : Scanners de Marché & Détection

New Reply
Author
author-avatar
supertiti @supertiti Participant
Summary

This topic contains 13 replies,
has 5 voices, and was last updated by supertiti
1 year, 7 months ago.

Topic Details
Forum: ProScreener : Scanners de Marché & Détection
Language: French
Started: 07/23/2024
Status: Active
Attachments: 5 files
Logo Logo
Loading...