Conversion indicateur tradingview Equal Highs and Equal Lows

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #215212 quote
    Garex
    Participant
    New

    Bonjour,

     

    Je voulais convertir moi même cet indicateur, mais je ne comprends pas la logique de probuilder et notamment le bout de code qu’il faut écrire pour avoir la possibilité de renseigner des paramètres d’entrée (comme par exemple la valeur de la période de l’indicateur moyenne mobile.

    Si quelqu’un à le temps de convertir ce code ça serait super sympa 😀

    indicator(“Equal Highs and Equal Lows”, shorttitle=”Equal Highs/Lows”, overlay=true, max_lines_count=500)
    //////////////////////////////////////////////////////////////////////////////// Equal Highs/Lows
    precision = input.int(2, step= 1, minval= 1, tooltip=”A low value returns more exact Equal Highs/Lows. The value 1 returns the most accurate Equal Highs/Lows”)
    PlotLines = input.bool(true, title=”Plot Lines”,inline=”Line”)
    LineCol = input(color.new(color.white,0),title=”Line Color”,inline=”Line”)
    LineWidth = input.int(3, step= 1, minval= 0,title=”Line Width”,inline=”Line”)
    PlotShapes = input.bool(true, title=”Plot Shapes”,inline=”Shape”)
    ShapeCol_Highs = input(color.new(color.lime,0),title=”Highs Color”,inline=”Shape”)
    ShapeCol_Lows = input(color.new(color.red,0),title=”Lows Color”,inline=”Shape”)
    // max/min
    max = math.max(high,high[1])
    min = math.min(low,low[1])
    // Normalize
    top = (math.abs(high – high[1])/(max-min))*100
    bottom = (math.abs(low – low[1])/(max-min))*100
    //Condition
    top_v = ta.crossunder(top,precision)
    bottom_v = ta.crossunder(bottom,precision)
    //Lines
    var line [] Top = array.new_line()
    var line [] Bot = array.new_line()
    if top_v and PlotLines
        t = line.new(bar_index[1],high[1],bar_index,high, color=LineCol, style=line.style_solid, width=LineWidth)
        array.push(Top,t)
    if bottom_v and PlotLines
        b = line.new(bar_index[1],low[1],bar_index,low, color=LineCol, style=line.style_solid, width=LineWidth)
        array.push(Bot,b)
    //Plot
    plotshape(PlotShapes?top_v:na, color=ShapeCol_Highs, offset=0, style=shape.triangledown, size=size.tiny, location=location.abovebar, title=”Equal Highs”)
    plotshape(PlotShapes?bottom_v:na, color=ShapeCol_Lows, offset=0, style=shape.triangleup, size=size.tiny, location=location.belowbar, title=”Equal Lows”)
    D’avance merci
    #215213 quote
    Nicolas
    Keymaster
    Master

    Lors d’une prochaine demande, merci d’ajouter une image de l’indicateur d’origine et d’indiquer le nom de l’indicateur dans le titre.

    Après lecture du descriptif, on rejoint les high ou les low lorsque ceux-ci sont égaux sur 2 bougies consécutifs, soit:

    if high=high[1] then 
    drawsegment(barindex[1],high[1],barindex,high) style(line,2)
    drawtext("▼",barindex,high) coloured("red")
    endif 
    if low=low[1] then
    drawsegment(barindex[1],low[1],barindex,low) style(line,2)
    drawtext("▲",barindex,low) coloured("green")
    endif
    
    return

    Pour le moment, il n’y a pas d’instructions pour définir des paramètres externes par le code, mais cela va arriver !

    Garex thanked this post
    double-highs-double-lows.png double-highs-double-lows.png
    #215218 quote
    Garex
    Participant
    New

    Merci Nicolas, c’est noté pour l’image de l’indicateur et le nom de l’indicateur.

    #215224 quote
    Garex
    Participant
    New

    J’ai modifié le code pour qu’il puisse indiquer plusieurs Hauts ou Bas identiques, mais je ne sais pas comment m’y prendre pour que l’indicateur arrête de calculer dès qu’il y a un franchissement des Hauts et Bas par le cours

    L’image jointe “Actuellement Cross” l’indicateur ne devrait rien afficher.

    L’image jointe ” Actuellement Pas de prolongation” devrait apparaitre comme l’image jointe “Résultat voulu“.

     

    Si ce n’est pas clair n’hésitez pas. Merci 😀

     

    DEFPARAM CalculateOnLastBars = 200
    i=1
    for i=1 to 10 do

    if high=high[i] then

    drawsegment(barindex[i],high[i],barindex,high) style(line,2)coloured(51,255,51,255)

    endif

    Next

    i=1
    for i=1 to 10 do
    if low=low[i] then

    drawsegment(barindex[i],low[i],barindex,low) style(line,2) coloured(255,51,51,255)

    endif

    Next

     

    return

    Actuellement-Cross.jpg Actuellement-Cross.jpg Actuellement-Pas-de-prolongation.jpg Actuellement-Pas-de-prolongation.jpg Resultat-voulu.jpg Resultat-voulu.jpg
Viewing 4 posts - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.

Conversion indicateur tradingview Equal Highs and Equal Lows


ProBuilder : Indicateurs & Outils Personnalisés

New Reply
Author
author-avatar
Garex @garex Participant
Summary

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

Topic Details
Forum: ProBuilder : Indicateurs & Outils Personnalisés
Language: French
Started: 05/26/2023
Status: Active
Attachments: 4 files
Logo Logo
Loading...