Pente et Angle

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #252121 quote
    Bernard13Bernard13
    Participant
    Senior

    Bonjour,
    Pouvez-vous valider ou non l’écriture du code de ces trois calculs, j’ai des valeurs d’angles aberrants.

    Slope= ROUND( (Src – Src[1]) / (BarIndex – BarIndex[1]), 2)   // Le delta X est optionnel car je souhaite calculer la pente sur la barre courante et la précédente donc deltaX= 1
    Slope%= ROUND( (Src / Src[1] – 1 )  * 100,  2 )
    Corner= ROUND( ATAN(Slope) * 180/Pi, 2)  // J’ai contrôlé, ATN ou ATN2 n’est pas reconnu, je suis en V12.
    Corner= Corner MOD 360 – 180 n’a rien résolu, j’ai des angles à plus de 360°

    Merci d’avance.

    #252132 quote
    Iván GonzálezIván González
    Moderator
    Legend

    Dans la plupart des langages, ATAN() renvoie une valeur en radians, et il faut donc multiplier par 180/PI pour la convertir en degrés.
    Mais dans ProRealTime, la fonction ATAN() renvoie déjà directement l’angle en degrés, dans l’intervalle [-90°, +90°].

    La bonne écriture est simplement :

    Corner = ROUND(ATAN(Slope), 2)
    Bernard13 and robertogozzi thanked this post
Viewing 2 posts - 1 through 2 (of 2 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

Pente et Angle


ProBuilder : Indicateurs & Outils Personnalisés

New Reply
Author
author-avatar
Bernard13 @bernard13 Participant
Summary

This topic contains 1 reply,
has 2 voices, and was last updated by Iván GonzálezIván González
11 months, 3 weeks ago.

Topic Details
Forum: ProBuilder : Indicateurs & Outils Personnalisés
Language: French
Started: 10/02/2025
Status: Active
Attachments: No files
ProRealCode ProRealCode
Loading...