simplification ligne code

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #105228 quote
    SharkShark
    Participant
    Senior

    Bonjour

    J’ai un code qui teste une condition sur n bougies, j’ai écrit le code en répétant mais je souhaiterais simplifier l’écriture de celui-ci et puis surtout pouvoir tester la condition sur un nb plus important de bougies par exemple.

    J’ai fait qqs

    indicator2 = BollingerDown[20](close)
    c2a = (low < indicator2) OR (low[1] < indicator2[1] OR low[2] < indicator2[2] OR low[3] < indicator2[3] OR low[4] < indicator2[4] OR low[5] < indicator2[5] OR low[6] < indicator2[6] OR low[7] < indicator2[7] OR low[8] < indicator2[8] OR low[9] < indicator2[9])

     

    recherches et explorer une piste sans succès.

    Merci par avance pour votre aide

    #105231 quote
    fifi743fifi743
    Participant
    Master

    bonsoir

    il est possible d’ecrire

    indicator2 = BollingerDown[20](close)

    FOR i =0 TO 9 DO

    c2a = (low[i] < indicator2[i])

    next

    #105311 quote
    NicolasNicolas
    Keymaster
    Legend

    Il manque un petit quelque-chose dans la solution de fifi. L’idée de la boucle est bonne, mais il faudrait en sortir dés qu’on a c2a qui est vérifié, sinon on testera toutes les occurences jusqu’à la 9éme et on ne gardera que cette dernière en mémoire, peu importe si les autres étaient vrais.

    indicator2 = BollingerDown[20](close)
    c2a = 0
    
    FOR i =0 TO 9 DO
     c2a = (low[i] < indicator2[i])
     if c2a=1 then //si cette occurrence de condition est VRAI  
      break //alors on sort de la boucle
     endif
    next
    fifi743 and Shark thanked this post
    #105726 quote
    JC_BywanJC_Bywan
    Moderator
    Master

    ou bien aussi, sans boucle: (puis remplacer le 10 à sa guise si on veut tester sur un nombre plus important de bougies)

    indicator2 = BollingerDown[20](close)
    c2a=summation[10](low<indicator2)
    
    if c2a>=1 then ...
    Shark thanked this post
    #107153 quote
    SharkShark
    Participant
    Senior

    Merci pour vos réponses, je vais tester ça.

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

simplification ligne code


ProBuilder : Indicateurs & Outils Personnalisés

New Reply
Author
author-avatar
Shark @shark Participant
Summary

This topic contains 4 replies,
has 4 voices, and was last updated by SharkShark
7 years ago.

Topic Details
Forum: ProBuilder : Indicateurs & Outils Personnalisés
Language: French
Started: 08/21/2019
Status: Active
Attachments: No files
ProRealCode ProRealCode
Loading...