Segnali di Breakout e Retest – FloAlgo

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #261235 quote
    Ciccarelli FrancoCiccarelli Franco
    Participant
    Senior

    Chiedo la traduzione dell’indicatore in oggetto.

    Grazie


    https://it.tradingview.com/script/Prso5Lji-Breakout-and-Retest-Signals-FloAlgo/

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

    Ecco qui:

    //--------------------------------------------------------//
    //PRC_Breakout and Retest Signals (by FloAlgo)
    //version = 0
    //18.05.2026
    //Iván González @ www.prorealcode.com
    //Sharing ProRealTime knowledge
    //--------------------------------------------------------//
    // Overlay indicator. Builds demand/supply zones on swing
    // pivots and fires a signal when price sweeps the zone
    // wick (liquidity) and closes back inside the candle body
    // (breakout & retest = liquidity sweep + reclaim).
    //--------------------------------------------------------//
    //-----Inputs---------------------------------------------//
    swingLen   = 10        // pivot length (left = right)
    maxLife    = 400       // max bars a zone stays active
    maxZones   = 5         // max zones per side (1..10)
    showTarget = 1         // 1 = draw measured-move target
    //--------------------------------------------------------//
    MAXZ = 10              // physical slots per side (>= maxZones)
    //--------------------------------------------------------//
    bullSig = 0
    bearSig = 0
    L   = swingLen
    win = 2 * L + 1
    //-----Centred pivot detection (no repaint)---------------//
    isPL = 0
    isPH = 0
    IF barindex >= win THEN
       IF low[L] = LOWEST[win](low) THEN
          isPL = 1
       ENDIF
       IF high[L] = HIGHEST[win](high) THEN
          isPH = 1
       ENDIF
    ENDIF
    pvBar  = barindex[L]
    pvBHi  = MAX(open[L], close[L])
    pvBLo  = MIN(open[L], close[L])
    pvLow  = low[L]
    pvHigh = high[L]
    //--------------------------------------------------------//
    //-----Spawn demand zone (on swing low)-------------------//
    IF isPL = 1 AND pvBHi > pvLow THEN
       isDup = 0
       FOR i = 0 TO MAXZ - 1 DO
          IF $dAct[i] = 1 AND pvLow >= $dExt[i] AND pvLow <= $dBHi[i] THEN
             isDup = 1
          ENDIF
       NEXT
       IF isDup = 0 THEN
          FOR i = 0 TO MAXZ - 1 DO
             IF $sAct[i] = 1 AND pvBHi >= $sBLo[i] AND pvLow <= $sExt[i] THEN
                isDup = 1
             ENDIF
          NEXT
       ENDIF
       IF isDup = 0 THEN
          slot    = -1
          cnt     = 0
          oldIdx  = -1
          oldBorn = 0
          FOR i = 0 TO MAXZ - 1 DO
             IF $dAct[i] = 1 THEN
                cnt = cnt + 1
                IF oldIdx = -1 OR $dBorn[i] < oldBorn THEN
                   oldBorn = $dBorn[i]
                   oldIdx  = i
                ENDIF
             ELSE
                IF slot = -1 THEN
                   slot = i
                ENDIF
             ENDIF
          NEXT
          IF cnt >= maxZones THEN
             slot = oldIdx
          ENDIF
          IF slot = -1 THEN
             slot = oldIdx
          ENDIF
          $dAct[slot]  = 1
          $dExt[slot]  = pvLow
          $dBHi[slot]  = pvBHi
          $dBLo[slot]  = pvBLo
          $dBorn[slot] = pvBar
       ENDIF
    ENDIF
    //-----Spawn supply zone (on swing high)------------------//
    IF isPH = 1 AND pvHigh > pvBLo THEN
       isDup = 0
       FOR i = 0 TO MAXZ - 1 DO
          IF $sAct[i] = 1 AND pvHigh <= $sExt[i] AND pvHigh >= $sBLo[i] THEN
             isDup = 1
          ENDIF
       NEXT
       IF isDup = 0 THEN
          FOR i = 0 TO MAXZ - 1 DO
             IF $dAct[i] = 1 AND pvHigh >= $dExt[i] AND pvBLo <= $dBHi[i] THEN
                isDup = 1
             ENDIF
          NEXT
       ENDIF
       IF isDup = 0 THEN
          slot    = -1
          cnt     = 0
          oldIdx  = -1
          oldBorn = 0
          FOR i = 0 TO MAXZ - 1 DO
             IF $sAct[i] = 1 THEN
                cnt = cnt + 1
                IF oldIdx = -1 OR $sBorn[i] < oldBorn THEN
                   oldBorn = $sBorn[i]
                   oldIdx  = i
                ENDIF
             ELSE
                IF slot = -1 THEN
                   slot = i
                ENDIF
             ENDIF
          NEXT
          IF cnt >= maxZones THEN
             slot = oldIdx
          ENDIF
          IF slot = -1 THEN
             slot = oldIdx
          ENDIF
          $sAct[slot]  = 1
          $sExt[slot]  = pvHigh
          $sBHi[slot]  = pvHigh
          $sBLo[slot]  = pvBLo
          $sBorn[slot] = pvBar
       ENDIF
    ENDIF
    //--------------------------------------------------------//
    //-----Process demand zones-------------------------------//
    FOR i = 0 TO MAXZ - 1 DO
       IF $dAct[i] = 1 THEN
          IF barindex > $dBorn[i] + maxLife THEN
             $dAct[i] = 0
          ELSIF close < $dExt[i] THEN
             $dAct[i] = 0
          ELSIF low < $dExt[i] AND close > $dBHi[i] THEN
             bullSig = 1
             tgtB = close + (close - $dExt[i])
             IF showTarget = 1 THEN
                DRAWSEGMENT(barindex, close, barindex + 40, tgtB) STYLE(dottedline) COLOURED(0, 193, 118)
             ENDIF
             $dAct[i] = 0
          ENDIF
       ENDIF
    NEXT
    //-----Process supply zones-------------------------------//
    FOR i = 0 TO MAXZ - 1 DO
       IF $sAct[i] = 1 THEN
          IF barindex > $sBorn[i] + maxLife THEN
             $sAct[i] = 0
          ELSIF close > $sExt[i] THEN
             $sAct[i] = 0
          ELSIF high > $sExt[i] AND close < $sBLo[i] THEN
             bearSig = 1
             tgtS = close - ($sExt[i] - close)
             IF showTarget = 1 THEN
                DRAWSEGMENT(barindex, close, barindex + 40, tgtS) STYLE(dottedline) COLOURED(255, 61, 61)
             ENDIF
             $sAct[i] = 0
          ENDIF
       ENDIF
    NEXT
    //--------------------------------------------------------//
    //-----Signals (historical, one per event)----------------//
    atr = averagetruerange[14]
    IF bullSig = 1 THEN
       DRAWTEXT("▲", barindex, low - atr * 0.5) COLOURED(0, 193, 118)
    ENDIF
    IF bearSig = 1 THEN
       DRAWTEXT("▼", barindex, high + atr * 0.5) COLOURED(255, 61, 61)
    ENDIF
    //-----Active zones (last bar only)-----------------------//
    IF islastbarupdate THEN
       FOR i = 0 TO MAXZ - 1 DO
          IF $dAct[i] = 1 THEN
             rEndD = MIN(barindex, $dBorn[i] + maxLife)
             DRAWRECTANGLE($dBorn[i], $dBHi[i], rEndD, $dExt[i]) COLOURED(0, 193, 118, 0) FILLCOLOR(0, 193, 118, 45)
             DRAWSEGMENT($dBorn[i], $dExt[i], rEndD, $dExt[i]) COLOURED(0, 193, 118)
          ENDIF
          IF $sAct[i] = 1 THEN
             rEndS = MIN(barindex, $sBorn[i] + maxLife)
             DRAWRECTANGLE($sBorn[i], $sExt[i], rEndS, $sBLo[i]) COLOURED(255, 61, 61, 0) FILLCOLOR(255, 61, 61, 45)
             DRAWSEGMENT($sBorn[i], $sExt[i], rEndS, $sExt[i]) COLOURED(255, 61, 61)
          ENDIF
       NEXT
    ENDIF
    //--------------------------------------------------------//
    RETURN
    



    TSLA-Diario-3.png TSLA-Diario-3.png
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

TradingView to ProRealTime Translation Center

New Reply
Summary

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

Topic Details
Forum: TradingView to ProRealTime Translation Center Forum
Started: 05/17/2026
Status: Active
Attachments: 1 files
ProRealCode ProRealCode
Loading...