Screener de roturas en Pivot Trendlines [HG] 15-30m

Viewing 11 posts - 1 through 11 (of 11 total)
  • Author
    Posts
  • #259105 quote
    Maricarmen
    Participant
    Veteran

    Buenas:

    Se podría hacer Screener con las roturas correspondientes a marcos temporales bajos por ejemplo 15 o 30 minutos, de este indicador:

    .https://www.prorealcode.com/topic/conversion-lineas-de-tendencia-y-rupturas-de-pivote-hg/

    Gracias,

    //--------------------------------------------------//
    //PRC_Pivot Trendlines with Breaks [HG]
    //version = 0
    //14.01.2026
    //Iván González @ www.prorealcode.com
    //Sharing ProRealTime knowledge
    //--------------------------------------------------//
    // --- Inputs ---
    //--------------------------------------------------//
    pivotLen = 20
    pivotType = 1 //(1 for Wicks, 0 for Body)
    maxLines = 20 //(Limits how many historical lines are drawn to keep chart clean)
    showOldBrokenLines = 1 //(Boolean: 1 to see history, 0 for clean chart)
    //--------------------------------------------------//
    // --- Initialization ---
    //--------------------------------------------------//
    leftBars = pivotLen
    rightBars = MAX(1, ROUND(pivotLen / 2))
    
    IF pivotType = 1 THEN
      srcLo = low
      srcHi = high
    ELSE
      srcLo = MIN(open, close)
      srcHi = MAX(open, close)
    ENDIF
    //--------------------------------------------------//
    // --- Pivot Detection and Array Storage ---
    //--------------------------------------------------//
    IF srcLo > srcLo[rightBars] AND LOWEST[rightBars](srcLo) > srcLo[rightBars] AND srcLo[rightBars] < LOWEST[leftBars](srcLo)[rightBars + 1] THEN
      $PLy[z] = srcLo[rightBars]
      $PLx[z] = barindex[rightBars]
      IF z > 0 THEN
       IF $PLy[z] > $PLy[z-1] THEN
         $slopeL[z] = ($PLy[z] - $PLy[z-1]) / ($PLx[z] - $PLx[z-1])
       ELSE
         $slopeL[z] = 0
       ENDIF
      ENDIF
      z = z + 1
    ENDIF
    
    IF srcHi < srcHi[rightBars] AND HIGHEST[rightBars](srcHi) < srcHi[rightBars] AND srcHi[rightBars] > HIGHEST[leftBars](srcHi)[rightBars + 1] THEN
      $PHy[t] = srcHi[rightBars]
      $PHx[t] = barindex[rightBars]
      IF t > 0 THEN
       IF $PHy[t] < $PHy[t-1] THEN
         $slopeH[t] = ($PHy[t] - $PHy[t-1]) / ($PHx[t] - $PHx[t-1])
       ELSE
         $slopeH[t] = 0
       ENDIF
      ENDIF
      t = t + 1
    ENDIF
    //--------------------------------------------------//
    // --- Drawing Logic on Last Bar ---
    //--------------------------------------------------//
    IF ISLASTBARUPDATE THEN
    
      // Limit the loop to the last N lines to match TradingView's cleanliness
      startLoopH = MAX(1, t - maxLines)
      startLoopL = MAX(1, z - maxLines)
    
      // Resistance Lines (Bearish)
      IF t > 2 THEN
       FOR i = t - 1 DOWNTO startLoopH DO
         IF $slopeH[i] <> 0 THEN
          x1 = $PHx[i-1]
          y1 = $PHy[i-1]
          m = $slopeH[i]
    
          breakX = 0
          breakY = 0
    
          FOR j = $PHx[i] + 1 TO barindex DO
            valLine = y1 + (j - x1) * m
            IF close[barindex - j] > valLine THEN
             breakX = j
             breakY = valLine
             BREAK
            ENDIF
          NEXT
    
          IF breakX = 0 THEN
            // Active line
            yEnd = y1 + (barindex - x1) * m
            DRAWSEGMENT(x1, y1, barindex, yEnd) STYLE(dottedline, 2) COLOURED(255, 0, 0)
          ELSE
            // Broken line: only draw if the user wants to see history
            IF showOldBrokenLines THEN
             DRAWSEGMENT(x1, y1, breakX, breakY) COLOURED(150, 0, 0, 150) // More transparent
             DRAWTEXT("Br", breakX, breakY + range, Dialog, Bold, 10) COLOURED(255, 0, 0)
            ENDIF
          ENDIF
         ENDIF
       NEXT
      ENDIF
    
      // Support Lines (Bullish)
      IF z > 2 THEN
       FOR i = z - 1 DOWNTO startLoopL DO
         IF $slopeL[i] <> 0 THEN
          x1 = $PLx[i-1]
          y1 = $PLy[i-1]
          m = $slopeL[i]
    
          breakX = 0
          breakY = 0
    
          FOR j = $PLx[i] + 1 TO barindex DO
            valLine = y1 + (j - x1) * m
            IF close[barindex - j] < valLine THEN
             breakX = j
             breakY = valLine
             BREAK
            ENDIF
          NEXT
    
          IF breakX = 0 THEN
            // Active line
            yEnd = y1 + (barindex - x1) * m
            DRAWSEGMENT(x1, y1, barindex, yEnd) STYLE(dottedline, 2) COLOURED(0, 255, 0)
          ELSE
            // Broken line
            IF showOldBrokenLines THEN
             DRAWSEGMENT(x1, y1, breakX, breakY) COLOURED(0, 150, 0, 150)
             DRAWTEXT("Br", breakX, breakY - range, Dialog, Bold, 10) COLOURED(0, 200, 0)
            ENDIF
          ENDIF
         ENDIF
       NEXT
      ENDIF
    
    ENDIF
    
    RETURN
    


    #259124 quote
    Iván González
    Moderator
    Legend

    buenas. Aquí tienes un screener que localiza la rotura de la última linea de tendencia:

    //--------------------------------------------------//
    // --- Inputs ---
    //--------------------------------------------------//
    pivotLen = 20
    pivotType = 1 //(1 for Wicks, 0 for Body)
    //--------------------------------------------------//
    // --- Initialization ---
    //--------------------------------------------------//
    ONCE pl0Bar = -1
    ONCE pl1Bar = -1
    ONCE ph0Bar = -1
    ONCE ph1Bar = -1
    ONCE suppActive = 0
    ONCE resistActive = 0
    ONCE slopeL = 0
    ONCE slopeH = 0
    
    
    leftBars = pivotLen
    rightBars = MAX(1, ROUND(pivotLen / 2))
    
    
    IF pivotType = 1 THEN
    srcLo = low
    srcHi = high
    ELSE
    srcLo = MIN(open, close)
    srcHi = MAX(open, close)
    ENDIF
    //--------------------------------------------------//
    // --- Pivot Low Detection + Support Trendline ---
    //--------------------------------------------------//
    IF barindex >= 2 * pivotLen + 1 THEN
    IF srcLo > srcLo[rightBars] AND LOWEST[rightBars](srcLo) > srcLo[rightBars] AND srcLo[rightBars] < LOWEST[leftBars](srcLo)[rightBars + 1] THEN
    pl0Bar = pl1Bar
    pl0Price = pl1Price
    pl1Bar = barindex - rightBars
    pl1Price = srcLo[rightBars]
    IF pl0Bar > -1 AND pl1Bar <> pl0Bar THEN
    IF pl1Price > pl0Price THEN
    slopeL = (pl1Price - pl0Price) / (pl1Bar - pl0Bar)
    suppActive = 1
    ELSE
    slopeL = 0
    suppActive = 0
    ENDIF
    ENDIF
    ENDIF
    ENDIF
    //--------------------------------------------------//
    // --- Pivot High Detection + Resistance Trendline ---
    //--------------------------------------------------//
    IF barindex >= 2 * pivotLen + 1 THEN
    IF srcHi < srcHi[rightBars] AND HIGHEST[rightBars](srcHi) < srcHi[rightBars] AND srcHi[rightBars] > HIGHEST[leftBars](srcHi)[rightBars + 1] THEN
    ph0Bar = ph1Bar
    ph0Price = ph1Price
    ph1Bar = barindex - rightBars
    ph1Price = srcHi[rightBars]
    IF ph0Bar > -1 AND ph1Bar <> ph0Bar THEN
    IF ph1Price < ph0Price THEN
    slopeH = (ph1Price - ph0Price) / (ph1Bar - ph0Bar)
    resistActive = 1
    ELSE
    slopeH = 0
    resistActive = 0
    ENDIF
    ENDIF
    ENDIF
    ENDIF
    //--------------------------------------------------//
    // --- Break Detection ---
    //--------------------------------------------------//
    breakUp = 0
    breakDown = 0
    
    
    // Support trendline break (bearish signal)
    IF suppActive = 1 AND slopeL <> 0 AND pl0Bar > -1 THEN
    suppNow = pl0Price + (barindex - pl0Bar) * slopeL
    suppPrev = pl0Price + (barindex - 1 - pl0Bar) * slopeL
    IF close < suppNow AND close[1] >= suppPrev THEN
    breakDown = 1
    suppActive = 0
    ENDIF
    ENDIF
    
    
    // Resistance trendline break (bullish signal)
    IF resistActive = 1 AND slopeH <> 0 AND ph0Bar > -1 THEN
    resistNow = ph0Price + (barindex - ph0Bar) * slopeH
    resistPrev = ph0Price + (barindex - 1 - ph0Bar) * slopeH
    IF close > resistNow AND close[1] <= resistPrev THEN
    breakUp = 1
    resistActive = 0
    ENDIF
    ENDIF
    //--------------------------------------------------//
    // Direction: 1 = Bullish break (resistance), -1 = Bearish break (support)
    mySignal = breakUp - breakDown
    SCREENER[breakUp OR breakDown](mySignal AS "Direction")
    



    robertogozzi thanked this post
    #262883 quote
    Maricarmen
    Participant
    Veteran

    Buenos días:

    Se podría hacer un nuevo Screener que recogiese la Ruptura de una Cuña Descendente (Falling Wedge)

    (pues creo que se pueden dar con las dos ultimas Lineas de Tendencia),

    Gracias

    #262933 quote
    Iván González
    Moderator
    Legend

    Buenas Maricarmen,

    Se puede, pero hay un detalle importante: el screener que publiqué antes en este hilo no sirve para cuñas descendentes, y no por un ajuste de parámetros. En aquel código (y en el indicador original [HG]) la línea de soporte solo se construye si los mínimos son crecientes:

    IF pl1Price > pl0Price THEN
       slopeL = (pl1Price - pl0Price) / (pl1Bar - pl0Bar)
       suppActive = 1
    ELSE
       slopeL = 0
       suppActive = 0
    ENDIF
    

    Una cuña descendente necesita justo lo contrario: las dos líneas bajan, también la de abajo. Con esa condición el soporte de la cuña nunca llega a existir, así que la figura es indetectable por construcción.

    Aquí tienes un screener nuevo. Sigue usando los mismos pivots, pero en vez de filtrar por la dirección del soporte, filtra por la geometría de la cuña:

    1. resistencia bajista (slopeH < 0),
    2. soporte bajista (slopeL < 0),
    3. que converjan (slopeH < slopeL: el techo cae más rápido que el suelo),
    4. que el ancho se haya estrechado al menos un % (minContra), para no colar canales bajistas casi paralelos,
    5. que la cuña siga viva (no hemos pasado el ápice),
    6. y la ruptura al alza: cierre por encima de la resistencia viniendo de dentro de la figura.
    //--------------------------------------------------//
    //PRC_Falling Wedge Breakout Screener
    //version = 1
    //27.07.2026
    //Iván González @ www.prorealcode.com
    //Sharing ProRealTime knowledge
    //--------------------------------------------------//
    // --- Inputs ---
    //--------------------------------------------------//
    pivotLen  = 20    // longitud del pivote
    pivotType = 1     // 1 = mechas (high/low) - 0 = cuerpo (open/close)
    maxAge    = 200   // antiguedad maxima, en velas, del pivote mas viejo de la cuña
    minContra = 20    // contraccion minima de la cuña, en %
    //--------------------------------------------------//
    // --- Initialization ---
    //--------------------------------------------------//
    ONCE pl0Bar     = -1
    ONCE pl1Bar     = -1
    ONCE ph0Bar     = -1
    ONCE ph1Bar     = -1
    ONCE pl0Price   = 0
    ONCE pl1Price   = 0
    ONCE ph0Price   = 0
    ONCE ph1Price   = 0
    ONCE slopeL     = 0
    ONCE slopeH     = 0
    ONCE wedgeArmed = 0
    
    
    leftBars  = pivotLen
    rightBars = MAX(1, ROUND(pivotLen / 2))
    
    
    IF pivotType = 1 THEN
       srcLo = low
       srcHi = high
    ELSE
       srcLo = MIN(open, close)
       srcHi = MAX(open, close)
    ENDIF
    //--------------------------------------------------//
    // --- Pivot low + soporte (aqui SI se admite pendiente descendente) ---
    //--------------------------------------------------//
    IF barindex >= 2 * pivotLen + 1 THEN
       IF srcLo > srcLo[rightBars] AND LOWEST[rightBars](srcLo) > srcLo[rightBars] AND srcLo[rightBars] < LOWEST[leftBars](srcLo)[rightBars + 1] THEN
          pl0Bar   = pl1Bar
          pl0Price = pl1Price
          pl1Bar   = barindex - rightBars
          pl1Price = srcLo[rightBars]
          IF pl0Bar > -1 AND pl1Bar <> pl0Bar THEN
             slopeL = (pl1Price - pl0Price) / (pl1Bar - pl0Bar)
          ENDIF
       ENDIF
    ENDIF
    //--------------------------------------------------//
    // --- Pivot high + resistencia (rearma la cuña) ---
    //--------------------------------------------------//
    IF barindex >= 2 * pivotLen + 1 THEN
       IF srcHi < srcHi[rightBars] AND HIGHEST[rightBars](srcHi) < srcHi[rightBars] AND srcHi[rightBars] > HIGHEST[leftBars](srcHi)[rightBars + 1] THEN
          ph0Bar   = ph1Bar
          ph0Price = ph1Price
          ph1Bar   = barindex - rightBars
          ph1Price = srcHi[rightBars]
          IF ph0Bar > -1 AND ph1Bar <> ph0Bar THEN
             slopeH     = (ph1Price - ph0Price) / (ph1Bar - ph0Bar)
             wedgeArmed = 1
          ENDIF
       ENDIF
    ENDIF
    //--------------------------------------------------//
    // --- Geometria de la cuña en la vela actual ---
    //--------------------------------------------------//
    isWedge   = 0
    breakOut  = 0
    resistNow = 0
    contracti  = 0
    proj      = 0
    
    
    IF wedgeArmed = 1 AND pl0Bar > -1 AND ph0Bar > -1 AND slopeH < 0 AND slopeL < 0 AND slopeH < slopeL THEN
    
    
       wedgeStart = MIN(pl0Bar, ph0Bar)
    
    
       IF barindex - wedgeStart <= maxAge THEN
    
    
          resStart = ph0Price + (wedgeStart - ph0Bar) * slopeH
          supStart = pl0Price + (wedgeStart - pl0Bar) * slopeL
          widthIni = resStart - supStart
    
    
          resistNow  = ph0Price + (barindex - ph0Bar) * slopeH
          resistPrev = ph0Price + (barindex - 1 - ph0Bar) * slopeH
          suppNow    = pl0Price + (barindex - pl0Bar) * slopeL
          suppPrev   = pl0Price + (barindex - 1 - pl0Bar) * slopeL
          widthNow   = resistNow - suppNow
    
    
          IF widthIni > 0 AND widthNow > 0 THEN
             contracti = 100 * (widthIni - widthNow) / widthIni
             IF contracti >= minContra THEN
                isWedge = 1
             ENDIF
          ENDIF
    
    
          // Ruptura alcista: la vela previa estaba DENTRO de la cuña y ahora cierra sobre la resistencia
          IF isWedge = 1 AND close > resistNow AND close[1] <= resistPrev AND close[1] >= suppPrev THEN
             breakOut   = 1
             wedgeArmed = 0
             proj       = close + widthIni
          ENDIF
    
    
       ENDIF
    ENDIF
    //--------------------------------------------------//
    SCREENER[breakOut](resistNow AS "Rotura", contracti AS "Contrac", proj AS "Objetivo")
    

    Te devuelve tres columnas: Rotura (el nivel de la resistencia en la vela de la ruptura, útil como referencia para el stop), Contrac (cuánto se ha estrechado la cuña en %, cuanto más alto más madura la figura) y Objetivo (la proyección clásica del patrón: el ancho de la cuña sumado al punto de ruptura).

    Si en vez de la ruptura quieres ver las cuñas mientras se están formando, cambia la última línea por SCREENER[isWedge](…).

    #262948 quote
    Maricarmen
    Participant
    Veteran

    Me da error, el el indicador linea 74 Contract = 0 y me pone un triángulo con un signo de interjección ¡

    Y al lanzarlo pone linea 76 – Caracteres ausentes, sugerencias, final del código.¡

    #262949 quote
    Iván González
    Moderator
    Legend

    vale, al copiar no he copiado el correcto. ahora sí:

    //--------------------------------------------------//
    //PRC_Falling Wedge Breakout Screener
    //version = 1
    //27.07.2026
    //Iván González @ www.prorealcode.com
    //Sharing ProRealTime knowledge
    //--------------------------------------------------//
    // --- Inputs ---
    //--------------------------------------------------//
    pivotLen  = 20    // longitud del pivote
    pivotType = 1     // 1 = mechas (high/low) - 0 = cuerpo (open/close)
    maxAge    = 200   // antiguedad maxima, en velas, del pivote mas viejo de la cuña
    minContra = 20    // contraccion minima de la cuña, en %
    //--------------------------------------------------//
    // --- Initialization ---
    //--------------------------------------------------//
    ONCE pl0Bar     = -1
    ONCE pl1Bar     = -1
    ONCE ph0Bar     = -1
    ONCE ph1Bar     = -1
    ONCE pl0Price   = 0
    ONCE pl1Price   = 0
    ONCE ph0Price   = 0
    ONCE ph1Price   = 0
    ONCE slopeL     = 0
    ONCE slopeH     = 0
    ONCE wedgeArmed = 0
    
    leftBars  = pivotLen
    rightBars = MAX(1, ROUND(pivotLen / 2))
    
    IF pivotType = 1 THEN
       srcLo = low
       srcHi = high
    ELSE
       srcLo = MIN(open, close)
       srcHi = MAX(open, close)
    ENDIF
    //--------------------------------------------------//
    // --- Pivot low + soporte (aqui SI se admite pendiente descendente) ---
    //--------------------------------------------------//
    IF barindex >= 2 * pivotLen + 1 THEN
       IF srcLo > srcLo[rightBars] AND LOWEST[rightBars](srcLo) > srcLo[rightBars] AND srcLo[rightBars] < LOWEST[leftBars](srcLo)[rightBars + 1] THEN
          pl0Bar   = pl1Bar
          pl0Price = pl1Price
          pl1Bar   = barindex - rightBars
          pl1Price = srcLo[rightBars]
          IF pl0Bar > -1 AND pl1Bar <> pl0Bar THEN
             slopeL = (pl1Price - pl0Price) / (pl1Bar - pl0Bar)
          ENDIF
       ENDIF
    ENDIF
    //--------------------------------------------------//
    // --- Pivot high + resistencia (rearma la cuña) ---
    //--------------------------------------------------//
    IF barindex >= 2 * pivotLen + 1 THEN
       IF srcHi < srcHi[rightBars] AND HIGHEST[rightBars](srcHi) < srcHi[rightBars] AND srcHi[rightBars] > HIGHEST[leftBars](srcHi)[rightBars + 1] THEN
          ph0Bar   = ph1Bar
          ph0Price = ph1Price
          ph1Bar   = barindex - rightBars
          ph1Price = srcHi[rightBars]
          IF ph0Bar > -1 AND ph1Bar <> ph0Bar THEN
             slopeH     = (ph1Price - ph0Price) / (ph1Bar - ph0Bar)
             wedgeArmed = 1
          ENDIF
       ENDIF
    ENDIF
    //--------------------------------------------------//
    // --- Geometria de la cuña en la vela actual ---
    //--------------------------------------------------//
    isWedge   = 0
    breakOut  = 0
    resistNow = 0
    contracti  = 0
    proj      = 0
    
    IF wedgeArmed = 1 AND pl0Bar > -1 AND ph0Bar > -1 AND slopeH < 0 AND slopeL < 0 AND slopeH < slopeL THEN
       
       wedgeStart = MIN(pl0Bar, ph0Bar)
       
       IF barindex - wedgeStart <= maxAge THEN
          
          resStart = ph0Price + (wedgeStart - ph0Bar) * slopeH
          supStart = pl0Price + (wedgeStart - pl0Bar) * slopeL
          widthIni = resStart - supStart
          
          resistNow  = ph0Price + (barindex - ph0Bar) * slopeH
          resistPrev = ph0Price + (barindex - 1 - ph0Bar) * slopeH
          suppNow    = pl0Price + (barindex - pl0Bar) * slopeL
          suppPrev   = pl0Price + (barindex - 1 - pl0Bar) * slopeL
          widthNow   = resistNow - suppNow
          
          IF widthIni > 0 AND widthNow > 0 THEN
             contracti = 100 * (widthIni - widthNow) / widthIni
             IF contracti >= minContra THEN
                isWedge = 1
             ENDIF
          ENDIF
          
          // Ruptura alcista: la vela previa estaba DENTRO de la cuña y ahora cierra sobre la resistencia
          IF isWedge = 1 AND close > resistNow AND close[1] <= resistPrev AND close[1] >= suppPrev THEN
             breakOut   = 1
             wedgeArmed = 0
             proj       = close + widthIni
          ENDIF
          
       ENDIF
    ENDIF
    //--------------------------------------------------//
    SCREENER[breakOut](resistNow AS "Rotura", contracti AS "Contrac", proj AS "Objetivo")
    


    Maricarmen thanked this post
    #262950 quote
    Maricarmen
    Participant
    Veteran

    Correcto, ahora no da ningún problema.

    Al probarlo en todos los marcos temporales,no me da ningún resultado, pero bueno seguiré probando en lo sucesivo

    para ver lo que da de sí.

    Muchas gracias de nuevo.

    #262957 quote
    Iván González
    Moderator
    Legend

    Yo lo pasé en diario creo recordar sobre acciones americanas y sólo me dio un valor.

    #263055 quote
    Maricarmen
    Participant
    Veteran

    Hola

    Este indicador me gusta un montón y da mucho de si. Se podría hacer también el Screener que coja

    este movimiento (Coge en un mercado alcista en SOPORTE una Linea Continua seguida de puntos

    suspensivos como señalo en la imagen que te adjunto)

    LLevó tiempo observando dicho movimiento y veo que da mucho de si. Gracias

    EDREAM-15.png EDREAM-15.png
    #263060 quote
    Iván González
    Moderator
    Legend

    vale. he modificado el indicador para que se vea como tu imagen.

    codigo screener:

    //--------------------------------------------------//
    //PRC_Pivot Trendlines [HG] - Nueva linea de soporte ascendente
    //version = 1
    //31.07.2026
    //Iván González @ www.prorealcode.com
    //Sharing ProRealTime knowledge
    //--------------------------------------------------//
    // --- Inputs ---
    //--------------------------------------------------//
    pivotLen  = 20    // longitud del pivote (la misma que uses en el indicador)
    pivotType = 1     // 1 = mechas (high/low) - 0 = cuerpo (open/close)
    maxNew    = 0     // velas desde que nace la linea (0 = solo la ultima vela)
    useTrend  = 1     // 1 = exige mercado alcista (cierre sobre la media larga)
    trendLen  = 200   // periodo de la media del filtro de tendencia
    //--------------------------------------------------//
    // --- Initialization ---
    //--------------------------------------------------//
    ONCE pl0Bar     = -1
    ONCE pl1Bar     = -1
    ONCE pl0Price   = 0
    ONCE pl1Price   = 0
    ONCE slopeL     = 0
    ONCE suppActive = 0
    ONCE lineBar    = -1
    
    leftBars  = pivotLen
    rightBars = MAX(1, ROUND(pivotLen / 2))
    
    IF pivotType = 1 THEN
       srcLo = low
    ELSE
       srcLo = MIN(open, close)
    ENDIF
    //--------------------------------------------------//
    // --- Pivot low + nacimiento de la linea de soporte ---
    //--------------------------------------------------//
    IF barindex >= 2 * pivotLen + 1 THEN
       IF srcLo > srcLo[rightBars] AND LOWEST[rightBars](srcLo) > srcLo[rightBars] AND srcLo[rightBars] < LOWEST[leftBars](srcLo)[rightBars + 1] THEN
          pl0Bar   = pl1Bar
          pl0Price = pl1Price
          pl1Bar   = barindex - rightBars
          pl1Price = srcLo[rightBars]
          IF pl0Bar > -1 AND pl1Bar <> pl0Bar THEN
             IF pl1Price > pl0Price THEN
                slopeL     = (pl1Price - pl0Price) / (pl1Bar - pl0Bar)
                suppActive = 1
                lineBar    = barindex
                // la linea nace muerta si el precio perdio el nivel mientras se confirmaba el pivote
                FOR k = 0 TO rightBars DO
                   valLine = pl0Price + (barindex - k - pl0Bar) * slopeL
                   IF close[k] < valLine THEN
                      suppActive = 0
                   ENDIF
                NEXT
             ELSE
                slopeL     = 0
                suppActive = 0
             ENDIF
          ENDIF
       ENDIF
    ENDIF
    //--------------------------------------------------//
    // --- Vida de la linea: muere con el primer cierre por debajo ---
    //--------------------------------------------------//
    suppNow = 0
    distPct = 0
    
    IF suppActive = 1 THEN
       suppNow = pl0Price + (barindex - pl0Bar) * slopeL
       IF close < suppNow THEN
          suppActive = 0
       ELSE
          distPct = 100 * (close - suppNow) / suppNow
       ENDIF
    ENDIF
    //--------------------------------------------------//
    // --- Senal: la linea acaba de nacer y sigue viva ---
    //--------------------------------------------------//
    trendOK = 1
    IF useTrend = 1 THEN
       IF close <= average[trendLen](close) THEN
          trendOK = 0
       ENDIF
    ENDIF
    
    sig = 0
    IF suppActive = 1 AND lineBar > -1 AND barindex - lineBar <= maxNew AND trendOK = 1 THEN
       sig = 1
    ENDIF
    //--------------------------------------------------//
    SCREENER[sig](suppNow AS "Soporte", distPct AS "Dist%", slopeL AS "Pend")
    

    codigo del indicador:

    //---------------------------------------------//
    //PRC_Ascending Support Line - espejo del screener
    //version = 1
    //31.07.2026
    //Iván González @ www.prorealcode.com
    //Sharing ProRealTime knowledge
    //---------------------------------------------//
    defparam drawonlastbaronly = true
    //---------------------------------------------//
    pivotLen  = 20    // la misma que en el screener
    pivotType = 1     // 1 = mechas (high/low) - 0 = cuerpo (open/close)
    //---------------------------------------------//
    ONCE pl0Bar     = -1
    ONCE pl1Bar     = -1
    ONCE pl0Price   = 0
    ONCE pl1Price   = 0
    ONCE slopeL     = 0
    ONCE suppActive = 0
    ONCE lineBar    = -1
    ONCE brkBar     = -1
    ONCE brkPrice   = 0
    
    leftBars  = pivotLen
    rightBars = MAX(1, ROUND(pivotLen / 2))
    
    IF pivotType = 1 THEN
       srcLo = low
    ELSE
       srcLo = MIN(open, close)
    ENDIF
    //---------------------------------------------//
    IF barindex >= 2 * pivotLen + 1 THEN
       IF srcLo > srcLo[rightBars] AND LOWEST[rightBars](srcLo) > srcLo[rightBars] AND srcLo[rightBars] < LOWEST[leftBars](srcLo)[rightBars + 1] THEN
          pl0Bar   = pl1Bar
          pl0Price = pl1Price
          pl1Bar   = barindex - rightBars
          pl1Price = srcLo[rightBars]
          IF pl0Bar > -1 AND pl1Bar <> pl0Bar THEN
             IF pl1Price > pl0Price THEN
                slopeL     = (pl1Price - pl0Price) / (pl1Bar - pl0Bar)
                suppActive = 1
                lineBar    = barindex
                brkBar     = -1
                FOR k = rightBars DOWNTO 0 DO
                   valLine = pl0Price + (barindex - k - pl0Bar) * slopeL
                   IF close[k] < valLine AND suppActive = 1 THEN
                      suppActive = 0
                      brkBar     = barindex - k
                      brkPrice   = valLine
                   ENDIF
                NEXT
             ELSE
                slopeL     = 0
                suppActive = 0
             ENDIF
          ENDIF
       ENDIF
    ENDIF
    //---------------------------------------------//
    IF suppActive = 1 THEN
       suppNow = pl0Price + (barindex - pl0Bar) * slopeL
       IF close < suppNow THEN
          suppActive = 0
          brkBar     = barindex
          brkPrice   = suppNow
       ENDIF
    ENDIF
    //---------------------------------------------//
    IF pl0Bar > -1 AND slopeL > 0 THEN
       drawsegment(pl0Bar, pl0Price, pl1Bar, pl1Price) coloured("red")
       IF suppActive = 1 THEN
          yNow   = pl0Price + (barindex - pl0Bar) * slopeL
          yBirth = pl0Price + (lineBar - pl0Bar) * slopeL
          drawsegment(pl1Bar, pl1Price, barindex, yNow) style(dottedline, 2) coloured("red")
          drawarrowup(lineBar, yBirth) coloured("blue")
       ELSE
          IF brkBar > -1 THEN
             drawtext("Br", brkBar, brkPrice - tr) coloured("red")
          ENDIF
       ENDIF
    ENDIF
    //---------------------------------------------//
    return
    


    Maricarmen thanked this post
    #263085 quote
    Maricarmen
    Participant
    Veteran

    Hola:

    Fallan bastante tanto el indicador como el Screener,

    El indicador por ejemplo ACERINOX en Marco Temporal de 30´y 1 H lo señala, en 15´y 20¨no sale nada. El Screener tampoco devuelve nada en ningún marco temporal, este valor lo tenía que señalar, y

    MTS el indicador lo señala en 15´y 1 H.ý luego no lo señala en 20´y 30´, El Screener lo mismo. no señala nada en ningún marco temporal

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

Screener de roturas en Pivot Trendlines [HG] 15-30m


ProScreener: Buscadores de Mercado y Rastreo

New Reply
Author
author-avatar
Maricarmen @maricarmen Participant
Summary

This topic contains 10 replies,
has 2 voices, and was last updated by Maricarmen
1 week ago.

Topic Details
Forum: ProScreener: Buscadores de Mercado y Rastreo
Language: Spanish
Started: 03/18/2026
Status: Active
Attachments: 1 files
Logo Logo
Loading...