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

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

    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
    Master

    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 and Maricarmen thanked this post
Viewing 2 posts - 1 through 2 (of 2 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 1 reply,
has 2 voices, and was last updated by Iván González
4 weeks ago.

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