Affichage variation au dessus de la valeur concernée

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #257260 quote
    finplus
    Participant
    Master

    Bonsoir,

    j’utilise l’indicateur suivant :

    //Parameters :
    Len = 100
    z1 = linearregression[Len](high)
    z2 = linearregression[Len](low)
    z2s = -std[len](low)+z2
    z1s = std[len](high)+z1
    M = (z2s + z1s) / 2
    
    RETURN z1 as "LRHigh", z2 as "LRLow", z1s as "high LR dev", z2s as "low LR dev", M as "Middle LR"
    


    J’aurai aimé calculer la pente de la courbe M avec la formule suivante (si elle vous paraît correct) :

    VarM = (M -M[5])/M[5]*100


    Je souhaiterai que le résultat (peut-être exprimé en %) s’affiche au dessus de la courbe M si (M-M[1]) > 0 et au dessous si (M-M[1]) < 0


    Merci.

    #257286 quote
    Iván González
    Moderator
    Master

    Salut ! Voici une solution qui pourrait vous aider :

    defparam drawonlastbaronly=true
    Len = 100
    z1 = LinearRegression[Len](high)
    z2 = LinearRegression[Len](low)
    stdLow = std[Len](low)
    stdHigh = std[Len](high)
    z2s = z2 - stdLow
    z1s = z1 + stdHigh
    mLine = (z2s + z1s) / 2
    
    //(M - M[5]) / M[5] * 100
    IF mLine[5] <> 0 THEN
       varM = (mLine - mLine[5]) / mLine[5] * 100
    ELSE
       varM = 0
    ENDIF
    
    if islastbarupdate then
       IF mLine > mLine[1] THEN
          DRAWTEXT("#varM#%", barindex, mLine + (stdHigh * 0.1)) COLOURED(0, 200, 0)
       ELSE
          IF mLine < mLine[1] THEN
             DRAWTEXT("#varM#%", barindex, mLine - (stdLow * 0.1)) COLOURED(200, 0, 0)
          ENDIF
       ENDIF
    endif
    
    RETURN z1 AS "LRHigh", z2 AS "LRLow", z1s AS "high LR dev", z2s AS "low LR dev", mLine AS "Middle LR"
    


    Nicolas, finplus and robertogozzi thanked this post
    #257342 quote
    finplus
    Participant
    Master

    Merci. Je regarde et vous reviens.

    Bonne soirée.

Viewing 3 posts - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.

Affichage variation au dessus de la valeur concernée


ProBuilder : Indicateurs & Outils Personnalisés

New Reply
Author
author-avatar
finplus @finplus Participant
Summary

This topic contains 2 replies,
has 2 voices, and was last updated by finplus
1 day, 7 hours ago.

Topic Details
Forum: ProBuilder : Indicateurs & Outils Personnalisés
Language: French
Started: 02/01/2026
Status: Active
Attachments: No files
Logo Logo
Loading...