Swing-Fibonacci-BigBeluga1

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #265155 quote
    MaricarmenMaricarmen
    Participant
    Veteran

    Hola:

    Sería posible confeccionar el Screener de este indicador que nos has creado días pasados.

    Swing-Fibonacci-BigBeluga

    Gracias,

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

    aqui tienes un screener que localiza valores que están tocando la espiral

    // === PRC Swing Fibonacci [BigBeluga] - spiral cross screener ===
    
    //=== INPUTS: swing engine and spiral (same defaults as the indicator) ===
    swingLength = 50   // Swing Structure (50..100)
    spiralArms = 8     // Spirals qty (1..10): rotations around the anchor
    spiralRad = 2.5    // Radius (1..8): multiplies the 500-bar range AND the reach
    spiralRes = 300    // segments of the spiral (original resolution: 300)
    
    //=== INPUTS: screener ===
    maxAge = 0         // 0 = touching on the last evaluated bar; N = within the
    // last N bars
    // flips, or the figure behind the row will be gone
    ringMin = 0        // 0 = off. Lowest ring accepted (1 = innermost)
    ringMax = 0        // 0 = off. Highest ring accepted
    
    //=== PERSISTENT STATE (verbatim from the indicator) ===
    ONCE hiIdx = 0
    ONCE hiVal = high
    ONCE loIdx = 0
    ONCE loVal = low
    ONCE hiSet = 0
    ONCE loSet = 0
    ONCE dirUp = 0
    ONCE swIdx = 0
    ONCE swPrice = 0
    ONCE swReady = 0
    ONCE lockRng = 0
    ONCE lockLen = 0
    ONCE lockDir = 0
    
    
    prevDir = dirUp
    pHiSet = hiSet
    pLoSet = loSet
    
    IF barindex >= swingLength - 1 THEN
       hiWin = highest[swingLength](high)
       loWin = lowest[swingLength](low)
       
       IF high = hiWin THEN
          hiIdx = barindex
          hiVal = high
          hiSet = 1
          dirUp = 1
       ENDIF
       
       IF low = loWin THEN
          loIdx = barindex
          loVal = low
          loSet = 1
          dirUp = 0
       ENDIF
       
       IF dirUp <> prevDir THEN
          
          rngLen = min(500, barindex + 1)
          lockRng = highest[rngLen](high) - lowest[rngLen](low)
          
          IF dirUp = 1 THEN
             lockLen = barindex - loIdx + 20
             IF loSet = 1 THEN
                swIdx = loIdx
                swPrice = loVal
                swReady = 1
                lockDir = 1
             ENDIF
          ELSE
             lockLen = barindex - hiIdx + 20
             IF hiSet = 1 THEN
                swIdx = hiIdx
                swPrice = hiVal
                swReady = 1
                lockDir = 0
             ENDIF
          ENDIF
          
          IF pHiSet = 0 OR pLoSet = 0 THEN
             swReady = 0
          ENDIF
       ENDIF
    ENDIF
    
    //=== SPIRAL GEOMETRY ===
    
    resN = max(3, spiralRes)
    dAng = spiralArms * 180 / (resN - 1)
    cD = cos(dAng)
    sD = sin(dAng)
    
    ONCE dYdone = 0
    ONCE dY = 0
    IF dYdone = 0 THEN
       cA = 1
       sA = 0
       yLo = 0
       yHi = 0
       FOR i = 0 TO resN - 1 DO
          yv = i / (resN - 1) * sA
          IF yv < yLo THEN
             yLo = yv
          ENDIF
          IF yv > yHi THEN
             yHi = yv
          ENDIF
          cN = cA * cD - sA * sD
          sN = sA * cD + cA * sD
          cA = cN
          sA = sN
       NEXT
       dY = yHi - yLo
       dYdone = 1
    ENDIF
    
    //=== IS THE CANDLE TOUCHING THE SPIRAL? ===
    hit = 0
    hitRing = 0
    hitY = 0
    
    IF swReady = 1 AND dY > 0 AND lockRng > 0 AND lockLen > 0 THEN
       boxTop = swPrice + lockRng * spiralRad
       boxBot = swPrice - lockRng * spiralRad
       boxRch = spiralRad * lockLen
       IF high >= boxBot AND low <= boxTop AND abs(barindex - swIdx) <= boxRch THEN
          yScale = lockRng * spiralRad / dY
          IF lockDir = 1 THEN
             dirSign = 0 - 1
          ELSE
             dirSign = 1
          ENDIF
          
          cA = 1
          sA = 0
          xPrev = 0
          yPrev = 0
          FOR i = 0 TO resN - 1 DO
             u = i / (resN - 1)
             xCur = round(swIdx - u * cA * spiralRad * lockLen)
             yCur = swPrice + dirSign * u * sA * yScale
             
             IF i > 0 AND hit = 0 THEN
                
                IF (xPrev - barindex) * (xCur - barindex) <= 0 THEN
                   IF xCur <> xPrev THEN
                      f = (barindex - xPrev) / (xCur - xPrev)
                      yAt = yPrev + f * (yCur - yPrev)
                   ELSE
                      yAt = yCur
                   ENDIF
                   IF yAt >= low AND yAt <= high THEN
                      hit = 1
                      hitY = yAt
                      
                      hitRing = round(u * spiralArms / 2 - 0.5) + 1
                      IF hitRing < 1 THEN
                         hitRing = 1
                      ENDIF
                   ENDIF
                ENDIF
             ENDIF
             
             xPrev = xCur
             yPrev = yCur
             cN = cA * cD - sA * sD
             sN = sA * cD + cA * sD
             cA = cN
             sA = sN
          NEXT
       ENDIF
    ENDIF
    
    //=== MOST RECENT TOUCH INSIDE THE WINDOW ===
    
    found = 0
    ageOut = 0
    ringOut = 0
    pctOut = 0
    FOR k = 0 TO maxAge DO
       IF found = 0 AND hit[k] = 1 THEN
          found = 1
          ageOut = k
          ringOut = hitRing[k]
          
          IF swPrice > 0 THEN
             pctOut = round((hitY[k] - swPrice) / swPrice * 10000) / 100
          ENDIF
       ENDIF
    NEXT
    
    IF lockDir = 1 THEN
       dirOut = 1
    ELSE
       dirOut = 0 - 1
    ENDIF
    ancAge = barindex - swIdx
    
    //=== FILTERS ===
    listed = 0
    IF found = 1 AND swReady = 1 THEN
       listed = 1
    ENDIF
    IF listed = 1 AND ringMin > 0 AND ringOut < ringMin THEN
       listed = 0
    ENDIF
    IF listed = 1 AND ringMax > 0 AND ringOut > ringMax THEN
       listed = 0
    ENDIF
    
    SCREENER[listed = 1](ringOut AS "Ring", dirOut AS "Dir", ageOut AS "Bars ago", pctOut AS "Spiral %", ancAge AS "Anchor age")
    
    
    Maricarmen thanked this post
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

Swing-Fibonacci-BigBeluga1


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álezIván González
3 weeks, 5 days ago.

Topic Details
Forum: ProScreener: Buscadores de Mercado y Rastreo
Language: Spanish
Started: 09/17/2026
Status: Active
Attachments: No files
ProRealCode ProRealCode
Loading...