STRUCTURE de marché (traduction de code)

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #224324 quote
    larouedegannlarouedegann
    Participant
    Master

    Bonjour à tous,

    Ci-joint dessous le code pinescript du MARKET STRUCTURE en libre service sur tradinview.

    Ne connaissant pas ce langage, si les informaticiens du forum pourraient m’aider à la transcrire !

    Merci d’avance.

    
    //@version=5
    indicator("Market Structure (Breakers) [LuxAlgo]", overlay = true, max_lines_count = 500, max_labels_count = 500)
    //-----------------------------------------------------------------------------}
    //Settings
    //-----------------------------------------------------------------------------{
    length = input.int(20, 'Swings Period', minval = 2)
    breaks = input.int(1, 'Maximum Breaks', minval = 1)
    maxDuration = input(1000, 'Breaker Maximum Duration')
    
    //Style
    bullCss = input(#089981, 'Bullish MS', inline = 'bull', group = 'Style')
    bullBreakCss = input(#f23645, 'Breaker', inline = 'bull', group = 'Style')
    
    bearCss = input(#f23645, 'Bearish MS', inline = 'bear', group = 'Style')
    bearBreakCss = input(#089981, 'Breaker', inline = 'bear', group = 'Style')
    
    //-----------------------------------------------------------------------------}
    //UDT
    //-----------------------------------------------------------------------------{
    type breaker
        line level
        int  breaks = 0
    
    //-----------------------------------------------------------------------------}
    //Bullish Breaker
    //-----------------------------------------------------------------------------{
    var phx = 0  
    var phcross = false
    var bullms = array.new<breaker>(0)
    var os = 0
    
    n = bar_index
    ph = fixnan(ta.pivothigh(length, length))
    
    if ph != ph[1]
        phx := n-length
        phcross := false
    
    //Test for bullish market structure
    if close > ph and not phcross
        line.new(phx, ph, n, ph, color = bullCss)
        
        //MS label
        label.new(int(math.avg(phx, n)), ph, os == -1 ? 'MSS' : 'MSB'
          , textcolor = bullCss
          , color = color(na)
          , size = size.small
          , style = label.style_label_down)
    
        bullms.unshift(breaker.new(line.new(n, ph, n, ph, color = bullBreakCss, style = line.style_dotted)))
        phcross := true
    
        if bullms.size() > 100
            bullms.pop()
        
        os := 1
    
    //Iterate trough existing bullish structures and test for breaks
    break_down = false
    
    if bullms.size() > 0
        for i = bullms.size()-1 to 0
            get = bullms.get(i)
            get.level.set_x2(n)
            
            if close < get.level.get_y2() and open > get.level.get_y2()
                get.breaks += 1
    
                if get.breaks == breaks
                    bullms.remove(i)
                    break_down := true
    
            else if (n - get.level.get_x1()) >= maxDuration
                bullms.remove(i).level.delete()
    
    //Support events
    support = false
    if bullms.size() > 0
        lvl = bullms.get(0).level.get_y2()
    
        support := low < lvl and math.min(close, open) > lvl
    
    //-----------------------------------------------------------------------------}
    //Bearish Breaker
    //-----------------------------------------------------------------------------{
    var plx = 0  
    var plcross = false
    var bearms = array.new<breaker>(0)
    
    pl = fixnan(ta.pivotlow(length, length))
    
    if pl != pl[1]
        plx := n-length
        plcross := false
    
    //Test for bearish market structure
    if close < pl and not plcross
        line.new(plx, pl, n, pl, color = bearCss)
    
        //MS label
        label.new(int(math.avg(plx, n)), pl, os == 1 ? 'MSS' : 'MSB'
          , textcolor = bearCss
          , color = color(na)
          , size = size.small
          , style = label.style_label_up)
    
        bearms.unshift(breaker.new(line.new(n, pl, n, pl, color = bearBreakCss, style = line.style_dotted)))
        plcross := true
    
        if bearms.size() > 100
            bearms.pop()
        
        os := -1
    
    //Iterate trough existing bearish structures and test for breaks
    break_up = false
    
    if bearms.size() > 0
        for i = bearms.size()-1 to 0
            get = bearms.get(i)
            get.level.set_x2(n)
            
            if close > get.level.get_y2() and open < get.level.get_y2()
                get.breaks += 1
    
                if get.breaks == breaks
                    bearms.remove(i)
                    break_up := true
            else if (n - get.level.get_x1()) >= maxDuration
                bearms.remove(i).level.delete()
    
    //Resistance events
    resistance = false
    if bearms.size() > 0
        lvl = bearms.get(0).level.get_y2()
    
        resistance := high > lvl and math.max(close, open) < lvl
    
    //-----------------------------------------------------------------------------}
    //Plots
    //-----------------------------------------------------------------------------{
    plotchar(break_up, 'Bull MSB Breakout', '▲', location.belowbar, #089981)
    plotchar(break_down, 'Bear MSB Breakout', '▼', location.abovebar, #f23645)
    
    //Support events
    plotcandle(high, high, low, low
      , 'Support Events'
      , na
      , na
      , bordercolor = support ? #089981 : na
      , display = display.all - display.status_line)
    
    //Resistance events
    plotcandle(high, high, low, low
      , 'Resistance Events'
      , na
      , na
      , bordercolor = resistance ? #f23645 : na
      , display = display.all - display.status_line)
    
    //-----------------------------------------------------------------------------}
    Capture-decran-2023-11-26-195648.png Capture-decran-2023-11-26-195648.png
    #224329 quote
    fifi743fifi743
    Participant
    Master

    c’est pas la meme chose que le lien ci dessous

    ICT Donchian Smart Money Structure (Expo)

    #224524 quote
    larouedegannlarouedegann
    Participant
    Master

    non rien à voir à part support résistance

    #224596 quote
    larouedegannlarouedegann
    Participant
    Master

    Une idée de traduction ?

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

    Hola Ici, vous avez le code traduit par Prorealtime :

    https://www.prorealcode.com/prorealtime-indicators/market-structure-breakers-indicator/

    //PRC_Market Structure Breakers
    //version = 0
    //15.03.24
    //Iván González @ www.prorealcode.com
    //Sharing ProRealTime knowledge
    //---------------------Inputs------------------------------
    lenght = 20
    //----------------------------------------------------------//
    //----------------Bullish Breaker---------------------------//
    //----------------------------------------------------------//
    //-----Calculate pivots high------------------------------------------
    if high < high[lenght] and highest[lenght](high)<high[lenght] and high[lenght]>highest[lenght](high)[lenght+1] then
    $ph[lastset($ph)+1]=high[lenght]
    $phx[lastset($phx)+1]=barindex[lenght]
    phcross = 0
    endif
    //-----Test for bullish market structure--------------------
    if close > $ph[max(0,lastset($ph))] and not phcross then
    drawsegment($phx[max(0,lastset($phx))],$ph[max(0,lastset($ph))],barindex,$ph[max(0,lastset($ph))])style(line,2)coloured(8,153,129)
    //MS Label
    if os = -1 then
    drawtext("MSS",(barindex+$phx[max(0,lastset($phx))])/2,$ph[max(0,lastset($ph))]+0.25*tr)
    else
    drawtext("MSB",(barindex+$phx[max(0,lastset($phx))])/2,$ph[max(0,lastset($ph))]+0.25*tr)
    endif
    $lasty2[lastset($lasty2)+1] = $ph[max(0,lastset($ph))]
    $lastx2[lastset($lastx2)+1] = barindex
    breakdown = 0
    checkup = 0
    phcross = 1
    os = 1
    endif
    //------Iterate trough existing bullish structures and test for breaks
    if close < $lasty2[max(0,lastset($lasty2))] and open > $lasty2[max(0,lastset($lasty2))] and breakdown=0 then
    breakdown = 1
    checkup = 1
    drawsegment($lastx2[max(0,lastset($lastx2))],$lasty2[max(0,lastset($lasty2))],barindex,$lasty2[max(0,lastset($lasty2))])coloured(242, 54, 69)style(dottedline,2)
    drawtext("▼",barindex,high+0.25*tr)coloured("red")
    endif
    //------Check for support events-------------------------------------
    lvl2 = $lasty2[max(0,lastset($lasty2))]
    if low < lvl2 and min(close,open)> lvl2 and not checkup then
    drawcandle(high,high,low,low)coloured("black",90)
    checkup=1
    endif
    //----------------------------------------------------------//
    //----------------Bearish Breaker---------------------------//
    //----------------------------------------------------------//
    //-----Calculate pivots low------------------------------------------
    if low > low[lenght] and lowest[lenght](low) > low[lenght] and low[lenght] < lowest[lenght](low)[lenght+1] then
    $pl[lastset($pl)+1] = low[lenght]
    $plx[lastset($plx)+1] = barindex[lenght]
    plcross = 0
    endif
    //---------------------------------------------------------
    //-----Test for bearish market structure--------------------
    if close < $pl[max(0,lastset($pl))] and not plcross then
    drawsegment($plx[max(0,lastset($plx))],$pl[max(0,lastset($pl))],barindex,$pl[max(0,lastset($pl))])coloured(242, 54, 69)style(line,2)
    //MS Label
    if os = 1 then
    drawtext("MSS",(barindex+$plx[max(0,lastset($plx))])/2,$pl[max(0,lastset($pl))]-0.25*tr)
    else
    drawtext("MSB",(barindex+$plx[max(0,lastset($plx))])/2,$pl[max(0,lastset($pl))]-0.25*tr)
    endif
    $lasty[lastset($lasty)+1]=$pl[max(0,lastset($pl))]
    $lastx[lastset($lastx)+1]=barindex
    plcross=1
    os = -1
    breakup=0
    checkdw=0
    endif
    //------Iterate trough existing bearish structures and test for breaks
    if close > $lasty[max(0,lastset($lasty))] and open < $lasty[max(0,lastset($lasty))] and breakup=0 then
    breakup = 1
    checkdw = 1
    drawsegment($lastx[max(0,lastset($lastx))],$lasty[max(0,lastset($lasty))],barindex,$lasty[max(0,lastset($lasty))])coloured(8,153,129)style(dottedline,2)
    drawtext("▲",barindex,low-0.25*tr)coloured("green")
    endif
    //------Check for resistance events-------------------------------------
    lvl = $lasty[max(0,lastset($lasty))]
    if high > lvl and max(close,open)<lvl and not checkdw then
    drawcandle(high,high,low,low)coloured("black",90)
    checkdw=1
    endif
    
    
    return //$ph[max(0,lastset($ph))] as "Pivot High"coloured("blue"), $pl[max(0,lastset($pl))] as "Pivot Low"coloured("purple")
    
    #229904 quote
    larouedegannlarouedegann
    Participant
    Master

    muchas gracias yvan

Viewing 6 posts - 1 through 6 (of 6 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

STRUCTURE de marché (traduction de code)


ProBuilder : Indicateurs & Outils Personnalisés

New Reply
Author
Summary

This topic contains 5 replies,
has 3 voices, and was last updated by larouedegannlarouedegann
2 years, 6 months ago.

Topic Details
Forum: ProBuilder : Indicateurs & Outils Personnalisés
Language: French
Started: 11/26/2023
Status: Active
Attachments: 1 files
ProRealCode ProRealCode
Loading...