Imposer des multiples de 4

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #199007 quote
    LurubuLurubu
    Participant
    Senior

    Bonjour,

    J’établis un valeur de début avec

    once début = high

    Parfait

    Maintenant, je voudrais que ce début se place sur le multiple de 4 le plus proche.

    J’ai fait quelques essais avec Modulo, mais sans succès.

    Si quelqu’un a une idée…..

    Merci d’avance

    #199017 quote
    JC_BywanJC_Bywan
    Moderator
    Master

    Là je l’ai mis avec “chaque” high pour tester, mais si tu ne veux que le tout premier high de barindex=0, tu peux rajouter once:

    debut= high
    
    reste=debut mod 4
    
    if reste>=2 then
    debut=4*floor(debut/4)+4
    else
    debut=4*floor(debut/4)
    endif
    
    return debut
    #199030 quote
    LurubuLurubu
    Participant
    Senior

    Super !

    Mais il est inutile de rajouter 4, comme cela le résultat est immédiatement proche du high initial.

    Merci beaucoup.

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

Imposer des multiples de 4


ProBuilder : Indicateurs & Outils Personnalisés

New Reply
Author
author-avatar
Lurubu @lurubu Participant
Summary

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

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