Tracé de segment entre les highs

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #215368 quote
    rwanderer
    Participant
    New

    Bonjour Nicolas, JC, et tous,

    Je solicite votre aide et vous expose mon problème.

    Ma condition = si mon high et plus grand que les 5 précedentes bougies et les 5 suivantes.
    Je souhaite que :
    – si ma condition est detectée, alors mon “index” = 1.
    – si un plus haut se créé alors je récupère le barindex de la bougie pour mon tracé de segment et mon “index” = 2
    – si une nouvelle condition se créé et alors que mon dernier index est égal à 1, alors le précedent “index” est égal à 0.

    A force d’avoir fait et refait, j’ai fini par m’y perdre et patauger dans un code sale…

    CinqDernierhaut=highest[5](high)
    MonPointHaut = high[5]>CinqDernierhaut[6] and CinqDernierhaut<=high[5]
    
    indexH=0
    
    if MonPointHaut then
    i = i+1
    //count = count+1
    $EQHBar[i] = barindex[5]
    $EQH[i] = high[5]
    $index[i] = indexH +1
    $EQHBarCourante[i] =  barindex
    
    endif
    
    IF islastbarupdate then
    //IF $index[i] =1 then
    //$EQHBarCourante[i] =  barindex
    
    
    
    
    For p=0 to i
    cc=$index[p]
    
    DrawSegment($EQHBar[p],$EQH[p],$EQHBarCourante[p],$EQH[p])Style(DottedLine,3)Coloured(0,150,0,255)
    DrawText("#cc#",$EQHBarCourante[p],$EQH[p]) coloured(0,0,0,255)
    
    NEXT
    
    //hh=$index[i]
    
    
    
    ENDIF

    Quelqu’un pourrait-il m’aider à avancer sur cet indicateur svp?

    Voir la capture pour plus de clarté sur l’attendu.

    Capture-du-2023-05-29-22-32-57.png Capture-du-2023-05-29-22-32-57.png
    #215378 quote
    rwanderer
    Participant
    New

    J’avance !

    Il me reste à definir : Si la condition se recrée alors que “l’index” précédent est égal à 1 alors il faut le passer à 0 !

    Voir exemple sur la captur pour l’attendu.

    CinqDernierhaut=highest[5](high)
    MonPointHaut = high[5]>CinqDernierhaut[6] and CinqDernierhaut<=high[5]
    
    indexH=0
    
    if MonPointHaut then
    count = count+1
    //count = count+1
    $EQHBar[count] = barindex[5]
    $EQH[count] = high[5]
    //$index[count] = indexH +1
    $EQHBarCourante[count] =  barindex
    //monindexH = $index[count]
    $monindexH[count] = 1
    endif
    
    IF islastbarupdate then
    
    for i = 0 to lastset($EQHBar)       
    for j = $EQHBar[i]+1 to barindex   
     
    if close[barindex[j]] >= $EQH[i]  then  
    $EQHBarCourante[i] = barindex-barindex[j]  
    $monindexH[i] = 2  
    break        
    endif
    next
     
    next
    
    for i = 1 to lastset($EQHBar) do
    monindexH = $monindexH[i]
    if $monindexH[i]=2then
    DrawSegment($EQHBar[i],$EQH[i],$EQHBarCourante[i],$EQH[i])Style(DottedLine,3)Coloured(0,150,0,255)
    DrawText("#monindexH#",$EQHBarCourante[i],$EQH[i]) coloured(0,0,0,255)
    
    elsif $monindexH[i]=1 then
    DrawSegment($EQHBar[i],$EQH[i],$EQHBarCourante[i],$EQH[i])Style(DottedLine,3)Coloured(150,150,0,255)
    DrawText("#monindexH#",$EQHBarCourante[i],$EQH[i]) coloured(0,0,0,255)
    else
    //DrawSegment($EQHBar[i],$EQH[i],barindex,$EQH[i])Style(DottedLine,3)Coloured(0,150,0,255)
    endif
    next
    
    
    ENDIF
    ENDIF
    Capture-du-2023-05-30-02-14-55.png Capture-du-2023-05-30-02-14-55.png
    #215439 quote
    Nicolas
    Keymaster
    Master

    Si j’ai bien compris, dans ta boucle lorsqu’on fait : $monindexH[i] = 2  alors on passe la valeur de la colonne précédente à 1, si oui voilà ce que ça donne :

    CinqDernierhaut=highest[5](high)
    MonPointHaut = high[5]>CinqDernierhaut[6] and CinqDernierhaut<=high[5]
    
    indexH=0
    
    if MonPointHaut then
    count = count+1
    //count = count+1
    $EQHBar[count] = barindex[5]
    $EQH[count] = high[5]
    //$index[count] = indexH +1
    $EQHBarCourante[count] =  barindex
    //monindexH = $index[count]
    $monindexH[count] = 1
    endif
    
    IF islastbarupdate then
    for i = 1 to lastset($EQHBar)
    for j = $EQHBar[i]+1 to barindex 
    if close[barindex[j]] >= $EQH[i]  then
    $EQHBarCourante[i] = barindex-barindex[j]
    $monindexH[i] = 2
    $monindexH[i-1]=0
    break
    endif
    next 
    next
    
    for i = 1 to lastset($EQHBar) do
    monindexH = $monindexH[i]
    if $monindexH[i]=2then
    DrawSegment($EQHBar[i],$EQH[i],$EQHBarCourante[i],$EQH[i])Style(DottedLine,3)Coloured(0,150,0,255)
    DrawText("#monindexH#",$EQHBarCourante[i],$EQH[i]) coloured(0,0,0,255)
    elsif $monindexH[i]=1 then
    DrawSegment($EQHBar[i],$EQH[i],$EQHBarCourante[i],$EQH[i])Style(DottedLine,3)Coloured(150,150,0,255)
    DrawText("#monindexH#",$EQHBarCourante[i],$EQH[i]) coloured(0,0,0,255)
    else
    //DrawSegment($EQHBar[i],$EQH[i],barindex,$EQH[i])Style(DottedLine,3)Coloured(0,150,0,255)
    endif
    next
    ENDIF
    
    
    return
    #215443 quote
    rwanderer
    Participant
    New

    Merci Nicolas pour ton retour,

    Ce n’est pas tout a fait ça mais cette syntaxe m’a mis sur la voie sans parvenir pour autant à l’attendu :

    $monindexH[i-1]=0

    J’ai donc tester cette logique mais sans resultat non plus :

    if $monindexH[j]=1 and $monindexH[j-1]=1 then
    $monindexH[i-1]=0
    endif

    Je souhaite que si un index=1 se materialise et que le precedent index[1] =1 (donc n’as pas vue de high le surpasser alors on l’élimine) alors le precedent index[1] passe à 0.

    Est-ce plus clair pour toi ?

    Capture-du-2023-05-30-16-32-09.png Capture-du-2023-05-30-16-32-09.png
    #215546 quote
    rwanderer
    Participant
    New

    Bonjour Nicolas,

    Je ne trouve pas la solution pour annuler la condition précedente (si elle est égale à 1) lorsqu’une nouvelle se recrée.

    Pourrais-tu jeter un oeil à mon message précedent stp ?

    #215672 quote
    JC_Bywan
    Moderator
    Master

    Bjr, à tester:

    once count=0
    
    CinqDernierhaut=highest[5](high)
    
    MonPointHaut = high[5]>CinqDernierhaut[6] and CinqDernierhaut<=high[5]
    
    //indexH=0
    
    if MonPointHaut then
    count = count+1
    $EQHBar[count] = barindex[5]
    $EQH[count] = high[5]
    //$index[count] = indexH +1
    $EQHBarCourante[count] = barindex
    //monindexH = $index[count]
    $monindexH[count] = 1
    
    if $EQH[count]<$EQH[count-1] then
    $monindexH[count-1] = 0
    elsif $EQH[count]>$EQH[count-1] then
    $monindexH[count] = 2
    endif
    endif
    
    IF islastbarupdate then
    
    for i = 1 to lastset($EQHBar) do
    monindexH = $monindexH[i]
    if $monindexH[i]=2 then
    DrawSegment($EQHBar[i],$EQH[i],$EQHBarCourante[i],$EQH[i] )Style(DottedLine,3) Coloured(0,200,0,255)
    DrawText("#monindexH#",$EQHBarCourante[i],$EQH[i]) coloured(0,200,0,255)
    elsif $monindexH[i]=1 then
    DrawSegment($EQHBar[i],$EQH[i],$EQHBarCourante[i],$EQH[i]) Style(DottedLine,3) Coloured(150,150,0,255)
    DrawText("#monindexH#",$EQHBarCourante[i],$EQH[i]) coloured(150,150,0,255)
    elsif $monindexH[i]=0 then
    DrawSegment($EQHBar[i],$EQH[i],$EQHBarCourante[i],$EQH[i]) Style(DottedLine,3) Coloured(250,0,0,255)
    DrawText("#monindexH#",$EQHBarCourante[i],$EQH[i]) coloured(250,0,0,255)
    endif
    next
    ENDIF
    
    return
Viewing 6 posts - 1 through 6 (of 6 total)
  • You must be logged in to reply to this topic.

Tracé de segment entre les highs


ProBuilder : Indicateurs & Outils Personnalisés

New Reply
Author
author-avatar
rwanderer @rwanderer Participant
Summary

This topic contains 5 replies,
has 3 voices, and was last updated by JC_Bywan
2 years, 9 months ago.

Topic Details
Forum: ProBuilder : Indicateurs & Outils Personnalisés
Language: French
Started: 05/29/2023
Status: Active
Attachments: 3 files
Logo Logo
Loading...