Reinitialiser les variables

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #214812 quote
    rwandererrwanderer
    Participant
    New

    Bonjour Nicolas, bonjour à tous,

    Ma deuxieme question du jour :

    Comment faire pour réinitialiser des variables afin d’être réutiliser, j’essaie de m’expliquer.

    Actuellement, je travaille comme ceci :

    IF Param1 = 1 THEN
    if truc then
    i=i+1
    $x1[i]=barindex
    $y1[i]=low
    $y2[i]=high
    
    ENDIF
    
    IF Param2 = 1 THEN
    if machin then
    j=j+1  //Je renomme "j" car "i" est déja utilisé
    $x3[j]=barindex // Je renomme "$x3" car "$x1" est déja utilisé
    $y3[j]=low
    $y4[j]=high
    
    ENDIF

    Je renomme “j” car “i” est déja utilisé et je renomme également “$x3” car “$x1” est déja utilisé. Ce qui peut-être assez vite galère lorsque l’on souhaite imbriqué plusieurs paramètres.

    Ma question : comment puis-je reinitialisé “i” et “$x1” en fin de paramètre pour être utilisé dans le suivant ?
    Comme ceci :

    IF Param1 = 1 THEN 
    if truc then
     i=i+1 
    $x1[i]=barindex 
    $y1[i]=low 
    $y2[i]=high 
    ENDIF
    
    IF Param2 = 1 THEN 
    if machin then
     i=i+1 
    $x1[i]=barindex 
    $y1[i]=low 
    $y2[i]=high 
    ENDIF
    
    ...
    #214813 quote
    NicolasNicolas
    Keymaster
    Legend

    Désolé je ne comprends pas.

    Est-ce que Param1 et Param2 peuvent être = 1 en même temps ? Si oui, alors tu vas mélanger tes enregistrements de “truc” et de “machin”.

    #214815 quote
    rwandererrwanderer
    Participant
    New

    Bonjour Nicolas,

     

    Oui “Param1” ou “Param2” peuvent-être égal à 1.
    Param est un nom fictif dans mon exemple, il gère chacun un indicateur différent.

    Ce que je voudrais c’est pouvoir réinitialiser mon incrémentation de “i” en fin d’indicateur pour être réutiliser sans que j’ai besoin de changer son nom dans un autre contexte ou que celui-ci viennent interferer sur un autre “param”.
    Idem pour ma variable $x

    Je n’ai pas forcément le bon vocabulaire, je fais au mieux pour être compris ^^

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

Reinitialiser les variables


ProBuilder : Indicateurs & Outils Personnalisés

New Reply
Author
author-avatar
rwanderer @rwanderer Participant
Summary

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

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