Fibonacci Extensiones con Barridos

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #262376 quote
    Maricarmen
    Participant
    Senior

    Buenas Tardes;

    Se podría traducir a esta Plataforma el Indicador:

    https://es.tradingview.com/script/3GH84ntF-SMC-Liquidity-Sweep-Fibonacci-Extension-MarkitTick/

    Gracias

    #262382 quote
    Iván González
    Moderator
    Legend

    mira, este indicador tiene +900 lineas… es una mezcla de varios indicadores…

    Te paso 2 indicadores por separado porque de lo contrario se ralentiza demasiado.

    //-----------------------------------------------------------//
    //PRC_Fibonacci Extension ABC (by MarkitTick)
    //version = 0
    //06.07.26
    //Iván González @ www.prorealcode.com
    //Sharing ProRealTime knowledge
    //-----------------------------------------------------------//
    // Detecta la ultima estructura ABC via ZigZag y proyecta las
    // extensiones Fibonacci (1.0 / 1.272 / 1.618) + Golden Zone.
    // APLICAR SOBRE EL GRAFICO DE PRECIO (overlay).
    //-----------------------------------------------------------//
    defparam drawonlastbaronly=true
    //-----Inputs (parametros configurables)---------------------//
    depth = 5             //Pivot Lookback Depth (barras a cada lado)
    useATRthr = 1         //1 = umbral ATR, 0 = umbral % fijo
    atrPeriod = 14        //Periodo ATR para el umbral
    atrMult = 2.0         //Multiplicador ATR
    fixedDevPct = 5.0     //% fijo (solo si useATRthr = 0)
    
    showExt0618 = 0       //Mostrar nivel 0.618
    showExt100 = 1        //Mostrar nivel 1.000
    showExt1272 = 1       //Mostrar nivel 1.272
    showExt1618 = 1       //Mostrar nivel 1.618
    extendRight = 1       //1 = extender lineas a la derecha
    extBars = 50          //Barras de extension a la derecha
    
    showStructLines = 1   //Dibujar lineas A-B / B-C
    showABClabels = 1     //Dibujar etiquetas A B C
    showElliott = 1       //Etiquetas Elliott (Wave 3, Harmonic...)
    invalidationOn = 1    //Invalidar si el precio rompe el punto A
    invalidAction = 0     //0 = grisar estructura, 1 = ocultarla
    //-----------------------------------------------------------//
    //-----Colores (RGB)-----------------------------------------//
    rBull = 0             //#00E676 alcista
    gBull = 230
    bBull = 118
    rBear = 255           //#FF5252 bajista
    gBear = 82
    bBear = 82
    rGray = 100           //invalidada
    gGray = 100
    bGray = 100
    //-----------------------------------------------------------//
    //-----Umbral adaptativo-------------------------------------//
    atrv = averagetruerange[atrPeriod]
    if useATRthr then
       zzThr = atrv * atrMult
    else
       zzThr = close * fixedDevPct / 100
    endif
    //-----------------------------------------------------------//
    //-----Deteccion de pivotes (simetricos, depth por lado)-----//
    isPH = 0
    isPL = 0
    if barindex >= 2 * depth then
       okH = 1
       okL = 1
       for i = 1 to 2 * depth do
          if i <> depth then
             if high[i] >= high[depth] then
                okH = 0
             endif
             if low[i] <= low[depth] then
                okL = 0
             endif
          endif
       next
       isPH = okH
       isPL = okL
    endif
    pivBar = barindex - depth
    //-----------------------------------------------------------//
    //-----Estado ZigZag: ultimos 3 puntos (A, B, C)-------------//
    once zzCount = 0
    once barA = 0
    once priceA = 0
    once hiA = 0
    once barB = 0
    once priceB = 0
    once hiB = 0
    once barC = 0
    once priceC = 0
    once hiC = 0
    //-----------------------------------------------------------//
    //-----Procesar pivote HIGH----------------------------------//
    if isPH then
       if zzCount = 0 then
          barC = pivBar
          priceC = high[depth]
          hiC = 1
          zzCount = 1
       elsif hiC = 1 then
          if high[depth] > priceC then
             barC = pivBar
             priceC = high[depth]
          endif
       else
          if abs(high[depth] - priceC) >= zzThr then
             barA = barB
             priceA = priceB
             hiA = hiB
             barB = barC
             priceB = priceC
             hiB = hiC
             barC = pivBar
             priceC = high[depth]
             hiC = 1
             if zzCount < 3 then
                zzCount = zzCount + 1
             endif
          endif
       endif
    endif
    //-----------------------------------------------------------//
    //-----Procesar pivote LOW-----------------------------------//
    if isPL then
       if zzCount = 0 then
          barC = pivBar
          priceC = low[depth]
          hiC = 0
          zzCount = 1
       elsif hiC = 0 then
          if low[depth] < priceC then
             barC = pivBar
             priceC = low[depth]
          endif
       else
          if abs(low[depth] - priceC) >= zzThr then
             barA = barB
             priceA = priceB
             hiA = hiB
             barB = barC
             priceB = priceC
             hiB = hiC
             barC = pivBar
             priceC = low[depth]
             hiC = 0
             if zzCount < 3 then
                zzCount = zzCount + 1
             endif
          endif
       endif
    endif
    //-----------------------------------------------------------//
    //-----Deteccion de estructura ABC---------------------------//
    bullABC = 0
    bearABC = 0
    if zzCount >= 3 then
       if hiA = 0 and hiB = 1 and hiC = 0 then
          if priceC > priceA and priceC < priceB then
             bullABC = 1
          endif
       endif
       if hiA = 1 and hiB = 0 and hiC = 1 then
          if priceC < priceA and priceC > priceB then
             bearABC = 1
          endif
       endif
    endif
    //-----------------------------------------------------------//
    //-----Congelar la ultima estructura valida + senal----------//
    once sExists = 0
    once sIsBull = 0
    once sInvalid = 0
    once sBarA = 0
    once sPriceA = 0
    once sBarB = 0
    once sPriceB = 0
    once sBarC = 0
    once sPriceC = 0
    
    newStructBull = 0
    newStructBear = 0
    
    if bullABC or bearABC then
       isNew = 0
       if barC <> sBarC or barB <> sBarB or barA <> sBarA then
          isNew = 1
       endif
       if isNew then
          sBarA = barA
          sPriceA = priceA
          sBarB = barB
          sPriceB = priceB
          sBarC = barC
          sPriceC = priceC
          sIsBull = bullABC
          sExists = 1
          sInvalid = 0
          if bullABC then
             newStructBull = 1
          else
             newStructBear = 1
          endif
       endif
    endif
    //-----------------------------------------------------------//
    //-----Invalidacion (el precio rompe el punto A)-------------//
    if invalidationOn and sExists = 1 and sInvalid = 0 then
       if sIsBull = 1 and close < sPriceA then
          sInvalid = 1
       endif
       if sIsBull = 0 and close > sPriceA then
          sInvalid = 1
       endif
    endif
    //-----------------------------------------------------------//
    //-----Niveles de extension Fibonacci------------------------//
    extDiff = sPriceB - sPriceA
    lvl0618 = sPriceC + extDiff * 0.618
    lvl100 = sPriceC + extDiff * 1.0
    lvl1272 = sPriceC + extDiff * 1.272
    lvl1500 = sPriceC + extDiff * 1.5
    lvl1618 = sPriceC + extDiff * 1.618
    d0618 = round(lvl0618 * 100000) / 100000
    d100 = round(lvl100 * 100000) / 100000
    d1272 = round(lvl1272 * 100000) / 100000
    d1618 = round(lvl1618 * 100000) / 100000
    //-----------------------------------------------------------//
    //-----Dibujo (solo en la ultima barra)----------------------//
    drawIt = 0
    if islastbarupdate and sExists = 1 then
       if sInvalid = 1 then
          if invalidAction = 0 then
             rC = rGray
             gC = gGray
             bC = bGray
             drawIt = 1
          else
             drawIt = 0
          endif
       else
          drawIt = 1
          if sIsBull = 1 then
             rC = rBull
             gC = gBull
             bC = bBull
          else
             rC = rBear
             gC = gBear
             bC = bBear
          endif
       endif
       
       if drawIt = 1 then
          if extendRight then
             endBar = barindex + extBars
          else
             endBar = barindex
          endif
          
          if showStructLines then
             drawsegment(sBarA, sPriceA, sBarB, sPriceB) coloured(rC, gC, bC)
             drawsegment(sBarB, sPriceB, sBarC, sPriceC) coloured(rC, gC, bC) style(dottedline)
          endif
          
          if showABClabels then
             drawtext("A", sBarA, sPriceA) coloured(rC, gC, bC)
             drawtext("B", sBarB, sPriceB) coloured(rC, gC, bC)
             drawtext("C", sBarC, sPriceC) coloured(rC, gC, bC)
          endif
          
          if showExt0618 then
             drawsegment(sBarC, lvl0618, endBar, lvl0618) coloured(rC, gC, bC) style(dottedline)
             if showElliott then
                drawtext("0.618 Wave 5  #d0618#", endBar, lvl0618) coloured(rC, gC, bC)
             else
                drawtext("0.618  #d0618#", endBar, lvl0618) coloured(rC, gC, bC)
             endif
          endif
          
          if showExt100 then
             drawsegment(sBarC, lvl100, endBar, lvl100) coloured(rC, gC, bC) style(dottedline)
             if showElliott then
                drawtext("1.0 C/3?  #d100#", endBar, lvl100) coloured(rC, gC, bC)
             else
                drawtext("1.0  #d100#", endBar, lvl100) coloured(rC, gC, bC)
             endif
          endif
          
          if showExt1272 then
             drawsegment(sBarC, lvl1272, endBar, lvl1272) coloured(rC, gC, bC) style(dottedline)
             if showElliott then
                drawtext("1.272 Harmonic  #d1272#", endBar, lvl1272) coloured(rC, gC, bC)
             else
                drawtext("1.272  #d1272#", endBar, lvl1272) coloured(rC, gC, bC)
             endif
          endif
          
          if showExt1618 then
             drawsegment(sBarC, lvl1618, endBar, lvl1618) coloured(rC, gC, bC)
             if showElliott then
                drawtext("1.618 Wave 3  #d1618#", endBar, lvl1618) coloured(rC, gC, bC)
             else
                drawtext("1.618  #d1618#", endBar, lvl1618) coloured(rC, gC, bC)
             endif
          endif
          
          if lvl1618 >= lvl1500 then
             gzBot = lvl1500
             gzTop = lvl1618
          else
             gzBot = lvl1618
             gzTop = lvl1500
          endif
          drawrectangle(sBarC, gzBot, endBar, gzTop) coloured(rC, gC, bC) fillcolor(rC, gC, bC, 40)
          drawtext("Golden Zone", sBarC, (gzBot + gzTop) / 2) coloured(rC, gC, bC)
       endif
    endif
    //-----------------------------------------------------------//
    return
    



    //-----------------------------------------------------------//
    //PRC_SMC Structure & Liquidity Sweep (by MarkitTick)
    //version = 0
    //06.07.26
    //Iván González @ www.prorealcode.com
    //Sharing ProRealTime knowledge
    //-----------------------------------------------------------//
    // Bloque SMC (simplificado): estructura BOS/CHoCH, barrido de
    // liquidez, order blocks y zonas Premium/Discount.
    // APLICAR SOBRE EL GRAFICO DE PRECIO (overlay).
    //-----------------------------------------------------------//
    //-----Inputs (parametros configurables)---------------------//
    swingLen = 5          //Swing Length (pivotes a cada lado)
    atrPeriod = 14        //Periodo ATR (grosor del order block)
    useSweep = 0          //1 = exigir barrido de liquidez antes del BOS (default original: off)
    usePDfilter = 0       //1 = solo BOS alcista en discount / bajista en premium
    showOB = 1            //Dibujar order blocks
    showPD = 1            //Dibujar zonas Premium/Discount
    obExtend = 15         //Barras de extension del OB a la derecha
    //-----------------------------------------------------------//
    //-----Colores (RGB)-----------------------------------------//
    rBull = 0
    gBull = 230
    bBull = 118
    rBear = 255
    gBear = 82
    bBear = 82
    //-----------------------------------------------------------//
    //-----ATR---------------------------------------------------//
    atrVal = averagetruerange[atrPeriod]
    //-----------------------------------------------------------//
    //-----Deteccion de pivotes swing----------------------------//
    once lastPH = 0
    once lastPHbar = 0
    once phActive = 0
    once lastPL = 0
    once lastPLbar = 0
    once plActive = 0
    
    if barindex >= 2 * swingLen + 1 then
       if high[swingLen] = highest[2 * swingLen + 1](high) then
          lastPH = high[swingLen]
          lastPHbar = barindex - swingLen
          phActive = 1
       endif
       if low[swingLen] = lowest[2 * swingLen + 1](low) then
          lastPL = low[swingLen]
          lastPLbar = barindex - swingLen
          plActive = 1
       endif
    endif
    //-----------------------------------------------------------//
    //-----Barrido de liquidez (sweep)---------------------------//
    once bullSweep = 0
    once sweepLow = 0
    once hasSweepLo = 0
    once bearSweep = 0
    once sweepHigh = 0
    once hasSweepHi = 0
    
    if plActive = 1 and low < lastPL then
       bullSweep = 1
       if hasSweepLo = 0 then
          sweepLow = low
          hasSweepLo = 1
       else
          sweepLow = min(sweepLow, low)
       endif
    endif
    if plActive = 1 and close < lastPL then
       bullSweep = 0
       hasSweepLo = 0
    endif
    
    if phActive = 1 and high > lastPH then
       bearSweep = 1
       if hasSweepHi = 0 then
          sweepHigh = high
          hasSweepHi = 1
       else
          sweepHigh = max(sweepHigh, high)
       endif
    endif
    if phActive = 1 and close > lastPH then
       bearSweep = 0
       hasSweepHi = 0
    endif
    //-----------------------------------------------------------//
    //-----Estado de estructura y rango--------------------------//
    once trend = 0
    once rangeHi = 0
    once rangeLo = 0
    once hasRange = 0
    
    if usePDfilter = 1 and hasRange = 1 then
       rmid = (rangeHi + rangeLo) / 2
       if close < rmid then
          inDisc = 1
       else
          inDisc = 0
       endif
       if close > rmid then
          inPrem = 1
       else
          inPrem = 0
       endif
    else
       inDisc = 1
       inPrem = 1
    endif
    
    if useSweep = 1 then
       sweepBullOk = bullSweep
       sweepBearOk = bearSweep
    else
       sweepBullOk = 1
       sweepBearOk = 1
    endif
    //-----------------------------------------------------------//
    //-----BOS / CHoCH alcista + Order Block---------------------//
    bullishBreak = phActive = 1 and close > lastPH and sweepBullOk = 1 and inDisc = 1
    if bullishBreak then
       if useSweep = 1 and hasSweepLo = 1 then
          trueLow = sweepLow
       else
          trueLow = lastPL
       endif
       
       midXbull = (lastPHbar + barindex) / 2
       drawsegment(lastPHbar, lastPH, barindex, lastPH) coloured(rBull, gBull, bBull) style(dottedline)
       if trend = 1 then
          drawtext("BOS", midXbull, lastPH + atrVal * 0.3) coloured(rBull, gBull, bBull)
       else
          drawtext("CHoCH", midXbull, lastPH + atrVal * 0.3) coloured(rBull, gBull, bBull)
       endif
       
       if showOB = 1 then
          obTopB = trueLow + atrVal * 0.5
          drawrectangle(lastPLbar, trueLow, barindex + obExtend, obTopB) coloured(rBull, gBull, bBull) fillcolor(rBull, gBull, bBull, 25)
       endif
       
       rangeHi = lastPH
       rangeLo = trueLow
       hasRange = 1
       trend = 1
       
       phActive = 0
       bullSweep = 0
       hasSweepLo = 0
    endif
    //-----------------------------------------------------------//
    //-----BOS / CHoCH bajista + Order Block---------------------//
    bearishBreak = plActive = 1 and close < lastPL and sweepBearOk = 1 and inPrem = 1
    if bearishBreak then
       if useSweep = 1 and hasSweepHi = 1 then
          trueHigh = sweepHigh
       else
          trueHigh = lastPH
       endif
       
       midXbear = (lastPLbar + barindex) / 2
       drawsegment(lastPLbar, lastPL, barindex, lastPL) coloured(rBear, gBear, bBear) style(dottedline)
       if trend = -1 then
          drawtext("BOS", midXbear, lastPL - atrVal * 0.3) coloured(rBear, gBear, bBear)
       else
          drawtext("CHoCH", midXbear, lastPL - atrVal * 0.3) coloured(rBear, gBear, bBear)
       endif
       
       if showOB = 1 then
          obBotS = trueHigh - atrVal * 0.5
          drawrectangle(lastPHbar, obBotS, barindex + obExtend, trueHigh) coloured(rBear, gBear, bBear) fillcolor(rBear, gBear, bBear, 25)
       endif
       
       rangeHi = trueHigh
       rangeLo = lastPL
       hasRange = 1
       trend = -1
       
       plActive = 0
       bearSweep = 0
       hasSweepHi = 0
    endif
    //-----------------------------------------------------------//
    //-----Zonas Premium / Discount (colorbetween)---------------//
    premTop = undefined
    premBot = undefined
    discTop = undefined
    discBot = undefined
    if showPD = 1 and hasRange = 1 then
       pdRng = rangeHi - rangeLo
       premTop = rangeHi
       premBot = rangeHi - pdRng * 0.25
       discTop = rangeLo + pdRng * 0.25
       discBot = rangeLo
    endif
    //colorbetween(premTop, premBot, 255, 82, 82, 85)
    //colorbetween(discTop, discBot, 0, 230, 118, 85)
    //-----------------------------------------------------------//
    return
    


    #262435 quote
    Maricarmen
    Participant
    Senior

    Hola:

    Te paso este indicador de Tradingview más sencillo, con menos de 500 lineas para ver si con este se puede realizar el indicador correspondiente.

    https://es.tradingview.com/script/9cSezPNE-Dynamic-Trend-Based-Fibonacci-Extension/

    Gracias,

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

TradingView to ProRealTime Translation Center

New Reply
Author
author-avatar
Maricarmen @maricarmen Participant
Summary

This topic contains 2 replies,
has 2 voices, and was last updated by Maricarmen
2 days, 9 hours ago.

Topic Details
Forum: TradingView to ProRealTime Translation Center Forum
Started: 07/05/2026
Status: Active
Attachments: No files
Logo Logo
Loading...