Etendre DRAWRAY sur X barres

Viewing 7 posts - 16 through 22 (of 22 total)
  • Author
    Posts
  • #178298 quote
    Nicolas
    Keymaster
    Master

    On peut essayer avec le code ci-dessous pour détecter les cassures de triangles:

    //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
    
    
    //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)
    
    signal=0
    //intercept
    upperline = high2+ah*(barindex-high2bar)
    if close crosses over upperline and upperline>0 and barindex-startbar<=5 then
    signal=1
    //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
    signal=-1
    //drawarrowdown(barindex,high+averagetruerange[14]/2) coloured(255,0,0)
    endif
    
    screener[signal<>0]
    #178447 quote
    Manu L.
    Participant
    Average

    Merci Nicolas, je vais tester

    #181273 quote
    Manu L.
    Participant
    Average

    Impec, merci bcp

    #252161 quote
    Robb
    Participant
    Average

    Hello

    I wanted to draw triangles with different lookbacks, like 3 and 5, in the same chart with one indicator only.

    I thought that this could be sufficient:

    Bonjour

    Je souhaitais dessiner des triangles avec des rétrospections différentes, comme 3 et 5, dans le même graphique avec un seul indicateur.

    J’ai pensé que cela pourrait suffire :

    $cpArray[0] = 3
    $cpArray[1] = 5

    for i = 0 to 1 do
    cp = $cpArray[i]

    …same code as describe in this topic….

    …même code que décrit dans ce sujet…

    next

    return

    But surprisingly it does not work, I got only triangle acc. to cp=3.

    Any advice?
    ùthanks a lot

    Mais étonnamment, ça ne fonctionne pas ; je n’ai obtenu qu’un triangle selon cp=3.

    Un conseil ?
    Merci beaucoup

    Roberto

    #252176 quote
    robertogozzi
    Moderator
    Master

    @Robb

    Publiez uniquement dans la langue du forum dans laquelle vous publiez. Par exemple, l’anglais uniquement dans les forums anglophones et le français uniquement dans les forums francophones.

    Merci 🙂

    #252270 quote
    robertogozzi
    Moderator
    Master

    Cette instruction imprime un triangle, mais nécessite six données : trois pour les coordonnées X (les barres où sont imprimés les trois côtés) et trois pour les coordonnées Y (c’est-à-dire les niveaux de prix où sont imprimés les côtés).
    Dans votre cas, quelles sont ces six données ?

    DRAWTRIANGLE(BarIndex[10],low[10],BarIndex[5],high[5],barindex,low) style(line,4) coloured("Cyan")
    #252308 quote
    Robb
    Participant
    Average

    J’ai résolu le problème en écrivant le code deux fois dans le même indicateur, une fois avec cp=3 et une fois avec cp=5.

    Dans la deuxième partie avec cp=5, j’ai modifié les noms des variables pour éviter toute confusion.

    Ainsi, l’indicateur dessine des triangles pour cp=3 et cp=5.

    J’aurais aimé trouver un système plus élégant, comme avec des arrays, mais je crains que le programme ne permette pas de les utiliser de cette façon.

    robertogozzi thanked this post
Viewing 7 posts - 16 through 22 (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...