Obtenir une polarité dans le résultat d’un indicateur

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #161435 quote
    jeje1664jeje1664
    Participant
    Average

    Bonjour à tous,

    Je cherche à coder un indicateur de changement de polarité de bougie HA, assorti d’une condition de variation minimale entre 2 clôtures.

    HAup = 0
    HAdown = 0
    
    
    IF BarIndex = 0 THEN
    XClose = TotalPrice
    XOpen = (Open + Close) / 2
    ELSE
    
    XClose = TotalPrice
    XOpen = (XOpen[1] + XClose[1]) / 2
    ENDIF
    
    
    // Apparition Bougie HaUp
    HAup1 = XClose > Xopen
    HAup2 = ((Close / Close[1]) - 1) >= 0.015/100
    
    IF (HAup1 and HAup2) THEN
    HAup = 1
    ENDIF
    
    
    // Apparition Bougie HaDown
    HAdown1 = XClose < Xopen
    HAdown2 = ((Close / Close[1]) - 1) <= -0.015/100
    
    IF (HAdown1 and HAdown2) THEN
    HAdown = 1
    ENDIF
    
    
    RETURN HAup as "HAup", HAdown as "HAdown"

    En copie d’écran, le résultat n’est actuellement pas satisfaisant car je souhaiterais que l’indicateur ne mentionne un résultat (histogramme) qu’à la condition que le précédent histogramme apparu soit d’une couleur différente.

    (ne pas avoir d’histogramme identiques qui se suivent, quel que soit l’intervalle)

    L’un d’entre vous saurait-il svp m’éclairer ?

    Cordialement

    Jérôme

    Image1.jpg Image1.jpg
    #161485 quote
    NicolasNicolas
    Keymaster
    Legend

    Lorsque tu crées ton signal aux lignes 20 et 29, ajoute une variable qui stockera quelle est la direction du signal, puis teste cette direction avant de réafficher un nouveau signal.

    IF (HAup1 and HAup2) and direction<=0 THEN //test si ça descend !!
     HAup = 1
     direction = 1 //ça monte
    ENDIF
    IF (HAdown1 and HAdown2) and direction>=0 THEN
     HAdown = 1
     direction = -1 //ça descend :)
    ENDIF
    #161495 quote
    jeje1664jeje1664
    Participant
    Average

    Ça fonctionne Tip Top, merci Nicolas ! :  )

    #242005 quote
    DiamantDiamant
    Participant
    Average

    Bonjour Nicolas,

    Est-il possible d’avoir l’indicateur complet avec tes rajouts des lignes 20 et 29, je ne parvient pas à les ajouter.

    Merci d’avance

    Diamant

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

Obtenir une polarité dans le résultat d’un indicateur


ProBuilder : Indicateurs & Outils Personnalisés

New Reply
Author
author-avatar
jeje1664 @jeje1664 Participant
Summary

This topic contains 3 replies,
has 3 voices, and was last updated by DiamantDiamant
1 year, 8 months ago.

Topic Details
Forum: ProBuilder : Indicateurs & Outils Personnalisés
Language: French
Started: 02/14/2021
Status: Active
Attachments: 1 files
ProRealCode ProRealCode
Loading...