Etendre DRAWRAY sur X barres

Viewing 15 posts - 1 through 15 (of 22 total)
  • Author
    Posts
  • #137267 quote
    Nuno
    Participant
    Average

    bonjour
    est il possible d’étendre un segment entre deux points sur x barres avec drawray ou autre?

    #137365 quote
    Nicolas
    Keymaster
    Master

    Désolé je ne sais pas bien la question.

    DRAWSEGMENT trace un segment fixe entre 2 coordonnées.

    DRAWRAY fait la même chose sauf qu’on peut étendre vers l’infini le segment d’un côté ou de l’autre de celui-ci.

    #137384 quote
    Nuno
    Participant
    Average

    Merci Nicolas

    ma question n’est pas claire
    est il possible d’etendre le segment de 10 barres (par exemple) vers la droite avec DRAWRAY ou autre?

    Je ne veux pas que cela s’étende vers l’infini

    #137448 quote
    Nicolas
    Keymaster
    Master

    Pour faire cela on peut utiliser DRAWSEGMENT, on lui donne une troisième coordonnées en X et il trouvera automatiquement la valeur de Y en calculant sa fonction affine.

    Par exemple :

    DRAWsegment(barindex, close, barindex[10],close[5],barindex+10)
    #137571 quote
    Nuno
    Participant
    Average

    merci Nicolas
    je vais tester cela

    est ce compliqué ensuite de detecter un franchissement de ce segment  dans les 10 dernieres bougies?

    y a t il peut etre un autre indicateur dont jeux peux m’inspirer?

    #137607 quote
    Nicolas
    Keymaster
    Master

    Il suffit de créer une fonctionne affine et de tester le nouveau niveau calculé sur chaque barre. Le coefficient directeur étant celui-ci : (distance du prix parcourus) / (quantité de chandeliers)

    #137757 quote
    Nuno
    Participant
    Average

    [attachment file=”137759″]

    cela marche nickel pour:

    DRAWsegment(barindex, close, barindex[10],close[5],barindex+10)

    pour votre derniere reponse

    Il suffit de créer une fonctionne affine et de tester le nouveau niveau calculé sur chaque barre. Le coefficient directeur étant celui-ci : (distance du prix parcourus) / (quantité de chandeliers)

    dans votre code “PRC_triangle Wedge pattern”  je ne vois pas les buystop et sellstop

    //PRC_triangle Wedge pattern | screener
    //12.09.2016
    //Nicolas @ www.prorealcode.com
    //Sharing ProRealTime knowledge
    // modified by Yannick v4 31.10.2017 avec affichage des buystop et sellstop level
    
    
    defparam drawonlastbaronly = true
    //fractals
    cp = 1//4 //lookback
    //volatilty
    //HistVolatily=HistoricVolatility[20](close)
    
    
    //Detection High
    if high[cp] >= highest[(cp)*2+1](high) then
    LLH = 1
    else
    LLH = 0
    endif
    
    //Value of last High
    if LLH = 1 then
    High1 = High2[1]
    High1bar = High2bar[1]
    High2 = high[cp]
    High2bar = barindex[cp]
    endif
    
    //Detection Low
    if low[cp] <= lowest[(cp)*2+1](low)  then
    LLL = -1
    else
    LLL = 0
    endif
    
    //Value of last Low
    if LLL = -1 then
    Low1 = Low2[1]
    Low1bar = Low2bar[1]
    Low2 = low[cp]
    Low2bar = barindex[cp]
    endif
    
    // condition of screening Triangle
    //condition 1 triangle compression contraction Lows are increasings and High are decreasing High1>High2 and Low1<Low2
    //condition 2 compression of volatilty Initial swing High1Low1> Last Swing High2Low2 : abs(High1-Low1)> abs(High2-Low2)
    //condition 3 triangle oscillation inside the triangle e.g. correct order of bars L/H/L/H or H/L/H/L
    //condition 4 triangle amplitude ratio control H1L1< 2 H2L2
    
    triangle = High1>High2 and Low1<Low2 and abs(High1-Low1)> abs(High2-Low2) //triangle conditions 1+2 contraction Low increasing and High decreasing
    
    oscillationH1L1H2L2= High1bar< Low1bar and Low1bar< High2bar and High2bar<Low2bar  //triangle condition 3 oscillation
    
    oscillationL1H1L2H2= Low1bar<High1bar and High1bar<Low2bar and Low2bar< High2bar //triangle condition 3 oscillation
    
    triangleamplitude=abs(High1-Low1)< 2* abs(High2-Low2)
    //triangleamplitude =1
    //Triangle display and H1L1H2L2
    if triangle and triangleamplitude and oscillationH1L1H2L2 or triangle and triangleamplitude and oscillationL1H1L2H2  then //and HistVolatily< HistVolatily[20]
    DRAWSEGMENT(Low1bar,Low1,Low2bar,Low2,barindex+5)
    DRAWSEGMENT(High1bar,High1,High2bar,High2,barindex+5)
    DRAWARROWUP(Low1bar,Low1)coloured(10,255,10)
    DRAWARROWUP(Low2bar,Low2)coloured(10,255,10)
    DRAWARROWDOWN(High1bar,High1)coloured(255,10,10)
    DRAWARROWDOWN(High2bar,High2)coloured(255,10,10)
    //DRAWCANDLE(High1,high2,low2,low1)  //when triangle is detected
    endif
    
    // possible buystop or sellstop orders level
    ///Equation of line y=ax+b
    // slope a= (yB-yA)/(xB-xA)= deltay/deltax
    // intercept b= yA-xA(YB-YA)/(xB-xA)
    
    //calculation of upperline equation and position yHigh for buystop
    aH=(High2-High1)/(High2bar-High1bar)
    bH=High1-High1bar*(High2-High1)/(High2bar-High1bar)
    
    //calculation of lowerline equation
    aL=(Low2-Low1)/(Low2bar-Low1bar)
    bL=Low1-Low1bar*(Low2-Low1)/(Low2bar-Low1bar)
    
    
    if triangle and triangleamplitude and oscillationH1L1H2L2 or triangle and triangleamplitude and oscillationL1H1L2H2  then //and HistVolatily< HistVolatily[20]
    //upper line
    //for i=0 to High1bar do
    i=1
    yHigh= aH*(i-High1bar)+bH
    DRAWARROWUP(i,yHigh)coloured(10,255,10)
    //next
    
    //lowerline
    //for j=0 to Low1bar do
    j=1
    yLow= aL*(j-Low1bar)+bL
    DRAWARROWDOWN(j,yLow)coloured(255,10,10)
    //next
    
    Endif
    
    //end of triangle
    // intercept between yH and yL yH=yL= aH(x-H1bar)+bH=aL(x-L1bar)+bL => x= (bL-bH+aH*H1bar-aL*L1bar)/(aH-aL)
    
    
    //conditions of screening wedge
    //risingwedge = High1<High2 and Low1<Low2 and abs(High1bar-High2bar)>abs(Low1bar-Low2bar) and abs(High1-High2)<abs(Low1-Low2) //Rising wedge?
    //fallingwedge = High1>High2 and Low1>Low2 and abs(High1bar-High2bar)<abs(Low1bar-Low2bar) and abs(High1-High2)>abs(Low1-Low2) //Falling weg ?
    //condition 3 wedge oscillation inside the wedge e.g. correct order of bars L/H/L/H or H/L/H/L similar condition than triangle
    //condition 4 wedge amplitude ratio control H1L1< ??? H2L2 to check?
    
    
    //if risingwedge  or fallingwedge and oscillationH1L1H2L2 or oscillationL1H1L2H2 then
    //DRAWsegment(Low1bar,Low1,Low2bar,Low2)
    //DRAWsegment(High1bar,High1,High2bar,High2)
    //DRAWARROWUP(Low1bar,Low1)coloured(10,255,10)
    //DRAWARROWUP(Low2bar,Low2)coloured(10,255,10)
    //DRAWARROWDOWN(High1bar,High1)coloured(255,10,10)
    //DRAWARROWDOWN(High2bar,High2)coloured(255,10,10)
    //endif
    
    
    
    //Volatility decrease in triangle lowest 300 period volatily
    
    //AverageVolatity
    //Volatilty
    
    //Previous trend detection : triangle should be continuation pattern
    //Previous trend detection : trend continuation wedge should a short term reversalpattern and long term continuation
    //close > average[X]
    
    
    
    Return
    //Indicator End
    

    est il possible de l’afficher comme dans l’exemple ci dessous

    exemple fleche verte quand le triangle est cassé par le haut à la cloture de l’extension du segment

    #137772 quote
    Nicolas
    Keymaster
    Master

    Je ne comprends pas dans quel code je dois ajouter des flèches ?

    #137773 quote
    Nuno
    Participant
    Average

    Nicolas,
    dans votre version ci dessus(triangle-v4.tif), je souhaiterais avoir une alerte ou une fleche quand la cloture casse par exemple à la hausse  l’extension du segment   (cf capture chart ci dessus)

    code ligne 62

    DRAWSEGMENT(High1bar,High1,High2bar,High2,barindex+5)

    //PRC_triangle Wedge pattern | screener
    //12.09.2016
    //Nicolas @ http://www.prorealcode.com
    //Sharing ProRealTime knowledge
    // modified by Yannick v4 31.10.2017 avec affichage des buystop et sellstop level

    #137968 quote
    Nicolas
    Keymaster
    Master

    Ce code n’est pas le mien, il a été modifié et pas facile à lire. Je l’ai modifié pour tracer des flèches à la cassures des triangles par le haut ou par le bas sur 5 bougies depuis sa création puisque tu étends de 5 bougies seulement les droites.

    //PRC_triangle Wedge pattern | screener
    //12.09.2016
    //Nicolas @ www.prorealcode.com
    //Sharing ProRealTime knowledge
    // modified by Yannick v4 31.10.2017 avec affichage des buystop et sellstop level
    
    
    defparam drawonlastbaronly = false
    //fractals
    cp = 1//4 //lookback
    
    //Detection High
    if high[cp] >= highest[(cp)*2+1](high) then
    LLH = 1
    else
    LLH = 0
    endif
    
    //Value of last High
    if LLH = 1 then
    High1 = High2[1]
    High1bar = High2bar[1]
    High2 = high[cp]
    High2bar = barindex[cp]
    endif
    
    //Detection Low
    if low[cp] <= lowest[(cp)*2+1](low)  then
    LLL = -1
    else
    LLL = 0
    endif
    
    //Value of last Low
    if LLL = -1 then
    Low1 = Low2[1]
    Low1bar = Low2bar[1]
    Low2 = low[cp]
    Low2bar = barindex[cp]
    endif
    
    
    triangle = High1>High2 and Low1<Low2 and abs(High1-Low1)> abs(High2-Low2) //triangle conditions 1+2 contraction Low increasing and High decreasing
    
    oscillationH1L1H2L2= High1bar< Low1bar and Low1bar< High2bar and High2bar<Low2bar  //triangle condition 3 oscillation
    
    oscillationL1H1L2H2= Low1bar<High1bar and High1bar<Low2bar and Low2bar< High2bar //triangle condition 3 oscillation
    
    triangleamplitude=abs(High1-Low1)< 2* abs(High2-Low2)
    //triangleamplitude =1
    //Triangle display and H1L1H2L2
    if triangle and triangleamplitude and oscillationH1L1H2L2 or triangle and triangleamplitude and oscillationL1H1L2H2  then
    DRAWSEGMENT(Low1bar,Low1,Low2bar,Low2,barindex+5)
    DRAWSEGMENT(High1bar,High1,High2bar,High2,barindex+5)
    startbar=barindex
    endif
    
    //calculation of upperline equation 
    aH=(High2-High1)/(High2bar-High1bar)
    //calculation of lowerline equation
    aL=(Low2-Low1)/(Low2bar-Low1bar)
    
    //intercept 
    upperline = high2+ah*(barindex-high2bar)
    if close crosses over upperline and upperline>0 and barindex-startbar<=5 then 
    drawarrowup(barindex,low-averagetruerange[14]/2) coloured(0,255,0)
    endif
    //drawpoint(barindex,high2+ah*(barindex-high2bar))
    lowerline = low2-al*(barindex-low2bar)
    if close crosses under lowerline and lowerline>0 and barindex-startbar<=5 then
    drawarrowdown(barindex,high+averagetruerange[14]/2) coloured(255,0,0)
    endif
    
    Return 
    
    Nuno thanked this post
    #138017 quote
    Nuno
    Participant
    Average

    Un grand merci Nicolas pour le code

    j’ai bien saisi le calcul

    //calculation of upperline equation 
    aH=(High2-High1)/(High2bar-High1bar)
    //calculation of lowerline equation
    aL=(Low2-Low1)/(Low2bar-Low1bar)
    
    //intercept 
    upperline = high2+ah*(barindex-high2bar)
    #149638 quote
    MAKSIDE
    Participant
    Veteran

    y’a pas un problème dans le code avec drawsegment ?

    #149644 quote
    JC_Bywan
    Moderator
    Master

    C’est un code v11, et c’est une des améliorations de la v11 sur la v10.3, on peut y mettre dans drawsegment un 5ème paramètre pour préciser l’abscisse “x” d’un 3ème point, et cela prolongera le segment suivant la même pente au point x,y correspondant

    MAKSIDE thanked this post
    #149646 quote
    Nicolas
    Keymaster
    Master

    En effet, ces deux lignes devraient être comme ci-dessous, cela ne générant pas d’erreurs en v11 à l’époque ..

    DRAWSEGMENT(Low1bar,Low1,Low2bar,Low2)
    DRAWSEGMENT(High1bar,High1,High2bar,High2)
    MAKSIDE thanked this post
    #178262 quote
    Manu L.
    Participant
    Average

    Bonjour Nicolas,

    est-il possible de créer un screnner qui permet de détecter la dernière flêche verte qui alerte sur une sortie de triangle ?

    Merci pour ton retour

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

Etendre DRAWRAY sur X barres


ProBuilder : Indicateurs & Outils Personnalisés

New Reply
Author
author-avatar
Nuno @nuno Participant
Summary

This topic contains 21 replies,
has 6 voices, and was last updated by Robb
3 months, 4 weeks ago.

Topic Details
Forum: ProBuilder : Indicateurs & Outils Personnalisés
Language: French
Started: 06/26/2020
Status: Active
Attachments: 5 files
Logo Logo
Loading...