2 DERNIERS SIGNAUX SEULEMENT

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #220908 quote
    Roland57800Roland57800
    Participant
    Veteran

    Bonjour,

    j’ai écris un code pour me donner un signal

    Concrètement j’ai un chandelier ROUGE suivi de 2 chandeliers VERT

    Je voudrais ne garder que les 2 derniers signaux sur le graphique

    le code

    C1 = close[2] < open [2]
    
    c2 = close [1] > open [1]
    
    c2a = close > open and close > close [1]
    
    c3 = close > close [2] and close > close[3]
    
    // CALCUL POUR DETERMINER LE STOP
    if c1 and c2 and c3 and c2a THEN
    drawtext("    ------      SL ",barindex,LOW [2],Dialog,Bold,14 ) coloured ( 255,0,0 )
    ENDIF
    
    if c1 and c2 and c3 and c2a then
    DRAWARROWUP (barindex, LOW - 3.5 )  coloured(0,0,255)                           //coloured(72,224,208)   // MEDIUM TURQUOISE
    DRAWTEXT ( "◯", barindex, LOW - 3.5 ,dialog, bold,20)  coloured(0,0,255)
    ENDIF
    
    
    RETURN

    Merci pour votre retour

    Cordialement

    #220921 quote
    NicolasNicolas
    Keymaster
    Legend

    Pour cela il faut enregistrer les signaux quand ils surviennent, dans un tableau. Puis on trace dans le passé à partir du chandelier courant, les 2 derniers signaux :

    defparam drawonlastbaronly=true
    
    C1 = close[2] < open [2]
    
    c2 = close [1] > open [1]
    
    c2a = close > open and close > close [1]
    
    c3 = close > close [2] and close > close[3]
    
    // j'enregistre dans un tableau le signal
    if c1 and c2 and c3 and c2a THEN
     $signal[count]=low
     $signalbar[count]=barindex
     count=count+1
    ENDIF
    
    // je trace dans le passé les 2 derniers signaux
    if islastbarupdate and count>=3 then
     for i = count-1 downto count-2
      drawtext("    ------      SL ",$signalbar[i],low [$signalbar[i]-2],Dialog,Bold,14 ) coloured ( 255,0,0 )
      DRAWARROWUP ($signalbar[i], $signal[i] - 3.5 )  coloured(0,0,255)                           //coloured(72,224,208)   // MEDIUM TURQUOISE
      DRAWTEXT ( "◯", $signalbar[i], $signal[i] - 3.5 ,dialog, bold,20)  coloured(0,0,255)
     next
    ENDIF
    
    RETURN
    
    #220939 quote
    Roland57800Roland57800
    Participant
    Veteran

    Merci Nicolas

    pour ton retour. c’est parfait

    fonctionne correctement

     

    Cordialement

    #220940 quote
    Roland57800Roland57800
    Participant
    Veteran

    Nicolas,

    désolé je me suis emballé un peu trop vite

    en effet la 1ère ligne de DRAWTEXT ne s’affiche (celle ci-dessous)

    drawtext(”    ——      SL “,$signalbar[i],low [$signalbar[i]2],Dialog,Bold,14 ) coloured ( 255,0,0 )

    j’ai essayé de comprendre et j’ai pas trouvé.

    merci pour ton retour

    Cordialement

    #220942 quote
    Roland57800Roland57800
    Participant
    Veteran

    Nicolas,

    j’ai repris la ligne de code dans le bon format

    drawtext("    ------      SL ",$signalbar[i],low [$signalbar[i]-2],Dialog,Bold,14 ) coloured ( 255,0,0 )

    Merci

Viewing 5 posts - 1 through 5 (of 5 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

2 DERNIERS SIGNAUX SEULEMENT


ProBuilder : Indicateurs & Outils Personnalisés

New Reply
Author
Summary

This topic contains 4 replies,
has 2 voices, and was last updated by Roland57800Roland57800
3 years ago.

Topic Details
Forum: ProBuilder : Indicateurs & Outils Personnalisés
Language: French
Started: 09/13/2023
Status: Active
Attachments: No files
ProRealCode ProRealCode
Loading...