Compter une variable sur XX Barres

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #164676 quote
    fxbravofxbravo
    Participant
    Average

    Bonjour à toutes et tous,

     

    J’ai une question concernant la comptabilisation d’apparition d’un signal.

    Voilà, je souhaite compter, sur XX barres glissantes (on va dire 20 pour l’exemple), combien de fois apparait le signal (DD rouge sur l’image attachée).

    Dans l’image attaché, ça donnerait: 1, 2, 3 puis 4, et quand la 20eme barre passe le signal 1, on redescend le décompte à 3, puis 2, 1 et 0.

    (J’espère que mes explications seront claires. Demandez moi des compléments si besoin.)

    Je ne sais pas du tout s’il faut utiliser FOR ou WHILE, et surtout, comment coder ça!

    Je vous remercie par avance pour votre aide.

     

    Excellente journée à toutes et tous.

    Capture-decran-2021-03-19-a-14.47.10.png Capture-decran-2021-03-19-a-14.47.10.png
    #164689 quote
    NicolasNicolas
    Keymaster
    Legend

    Si ta condition pour générer ce signal est une variable booléenne qui retourne 1 quand elle est vrai, alors tu fais une somme de cette condition sur les X dernières barres.

    En supposant que ta condition s’appelle “macondition” :

    c = summation[20](macondition)
    fxbravo thanked this post
    #164690 quote
    fxbravofxbravo
    Participant
    Average

    Hello Nicolas,

     

    Merci pour ton retour rapide! C’est top !

    Bon, bah j’ai plus qu’à tester (je me sens un peu bête de pas avoir pensé à ça, c’est tout simple 🙂 )

    Excellente journée.

    #164715 quote
    fxbravofxbravo
    Participant
    Average

    Ça fonctionne parfaitement! Merci encore 😉

    #178199 quote
    JC_BywanJC_Bywan
    Moderator
    Master

    Le sujet initialement rajouté à la fin de celui-ci, suite à difficulté à en créer un nouveau, est désormais là pour info: https://www.prorealcode.com/topic/ordre-pris-en-backtest-mais-pas-en-reel/

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

Compter une variable sur XX Barres


ProBuilder : Indicateurs & Outils Personnalisés

New Reply
Author
author-avatar
fxbravo @fxbravo Participant
Summary

This topic contains 4 replies,
has 4 voices, and was last updated by JC_BywanJC_Bywan
5 years, 1 month ago.

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