Screener del indicador “Support Resistance OB”

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

    Hola Buenas:

    Se podría hacer para coger Soportes el Screener del indicador:

    Support Resistance OB

    Gracias,

    robertogozzi thanked this post
    #262358 quote
    Iván González
    Moderator
    Legend

    aquí tiens:

    //----------------------------------------------
    //SCR_KN Support Resistance OB - Screener SOPORTES
    //Filtra valores en retest de un order block de demanda vivo
    //version = 0
    //Ivan Gonzalez @ www.prorealcode.com
    //Sharing ProRealTime knowledge
    //----------------------------------------------
    
    // Geometria del OB por tracking incremental (running min/max).
    
    // === INPUTS ===
    internalLength = 5     // Internal Structure Length (>= 2)
    swingLength    = 50    // Swing Structure Length (>= 10)
    obMitigation   = 0     // 1 = Close, 0 = High/Low
    useInternal    = 1     // 1 = internos + swing, 0 = solo swing
    mode           = 1     // 1 = solo soportes (demanda). 2 = resistencias, 0 = ambos
    proxATR        = 100   // retest a <= proxATR*ATR(14) (100 = sin filtro)
    atrLen         = 200   // ATR del filtro de volatilidad (bajar en PRT Complete)
    
    MAXZ = 20
    
    // === ATR ===
    atr   = averagetruerange[atrLen](close)
    atr14 = averagetruerange[14](close)
    
    // === parsed high/low (swap alta volatilidad LuxAlgo) ===
    if (high - low) >= 2 * atr then
       pHigh = low
       pLow  = high
    else
       pHigh = high
       pLow  = low
    endif
    
    // === STATE INIT ===
    if barindex = 0 then
       prevLegSwing      = 0
       prevLegInternal   = 0
       swingHighLevel    = 0
       swingLowLevel     = 0
       internalHighLevel = 0
       internalLowLevel  = 0
       swingHighCrossed    = 1
       swingLowCrossed     = 1
       internalHighCrossed = 1
       internalLowCrossed  = 1
       sBullLow  = low
       sBullHigh = high
       sBearHigh = high
       sBearLow  = low
       iBullLow  = low
       iBullHigh = high
       iBearHigh = high
       iBearLow  = low
       obPtr = 0
    endif
    
    // === SWING LEG ===
    if barindex <= swingLength then
       legSwing = 0
    elsif high[swingLength] > highest[swingLength](high) then
       legSwing = 0
    elsif low[swingLength] < lowest[swingLength](low) then
       legSwing = 1
    else
       legSwing = prevLegSwing
    endif
    
    if legSwing <> prevLegSwing then
       if legSwing = 1 then
          swingLowLevel   = low[swingLength]
          swingLowCrossed = 0
          sBearHigh = pHigh
          sBearLow  = pLow
       else
          swingHighLevel   = high[swingLength]
          swingHighCrossed = 0
          sBullLow  = pLow
          sBullHigh = pHigh
       endif
    endif
    
    // === INTERNAL LEG ===
    if barindex <= internalLength then
       legInternal = 0
    elsif high[internalLength] > highest[internalLength](high) then
       legInternal = 0
    elsif low[internalLength] < lowest[internalLength](low) then
       legInternal = 1
    else
       legInternal = prevLegInternal
    endif
    
    if legInternal <> prevLegInternal then
       if legInternal = 1 then
          internalLowLevel   = low[internalLength]
          internalLowCrossed = 0
          iBearHigh = pHigh
          iBearLow  = pLow
       else
          internalHighLevel   = high[internalLength]
          internalHighCrossed = 0
          iBullLow  = pLow
          iBullHigh = pHigh
       endif
    endif
    
    // === TRACKING DE CANDIDATOS ===
    if swingHighCrossed = 0 then
       if pLow < sBullLow then
          sBullLow  = pLow
          sBullHigh = pHigh
       endif
    endif
    if swingLowCrossed = 0 then
       if pHigh > sBearHigh then
          sBearHigh = pHigh
          sBearLow  = pLow
       endif
    endif
    if internalHighCrossed = 0 then
       if pLow < iBullLow then
          iBullLow  = pLow
          iBullHigh = pHigh
       endif
    endif
    if internalLowCrossed = 0 then
       if pHigh > iBearHigh then
          iBearHigh = pHigh
          iBearLow  = pLow
       endif
    endif
    
    // === ROTURAS -> PUSH OB (buffer circular) ===
    if swingHighCrossed = 0 then
       if close > swingHighLevel and close[1] <= swingHighLevel then
          swingHighCrossed = 1
          $obTop[obPtr]  = sBullHigh
          $obBot[obPtr]  = sBullLow
          $obBias[obPtr] = 1
          $obAct[obPtr]  = 1
          obPtr = obPtr + 1
          if obPtr >= MAXZ then
             obPtr = 0
          endif
       endif
    endif
    if swingLowCrossed = 0 then
       if close < swingLowLevel and close[1] >= swingLowLevel then
          swingLowCrossed = 1
          $obTop[obPtr]  = sBearHigh
          $obBot[obPtr]  = sBearLow
          $obBias[obPtr] = -1
          $obAct[obPtr]  = 1
          obPtr = obPtr + 1
          if obPtr >= MAXZ then
             obPtr = 0
          endif
       endif
    endif
    if useInternal = 1 then
       if internalHighCrossed = 0 then
          if internalHighLevel <> swingHighLevel then
             if close > internalHighLevel and close[1] <= internalHighLevel then
                internalHighCrossed = 1
                $obTop[obPtr]  = iBullHigh
                $obBot[obPtr]  = iBullLow
                $obBias[obPtr] = 1
                $obAct[obPtr]  = 1
                obPtr = obPtr + 1
                if obPtr >= MAXZ then
                   obPtr = 0
                endif
             endif
          endif
       endif
    endif
    if useInternal = 1 then
       if internalLowCrossed = 0 then
          if internalLowLevel <> swingLowLevel then
             if close < internalLowLevel and close[1] >= internalLowLevel then
                internalLowCrossed = 1
                $obTop[obPtr]  = iBearHigh
                $obBot[obPtr]  = iBearLow
                $obBias[obPtr] = -1
                $obAct[obPtr]  = 1
                obPtr = obPtr + 1
                if obPtr >= MAXZ then
                   obPtr = 0
                endif
             endif
          endif
       endif
    endif
    
    // === MITIGACION ===
    if obMitigation = 1 then
       mitBear = close
       mitBull = close
    else
       mitBear = high
       mitBull = low
    endif
    
    for i = 0 to MAXZ - 1 do
       if $obAct[i] = 1 then
          if $obBias[i] = -1 then
             if mitBear > $obTop[i] then
                $obAct[i] = 0
             endif
          else
             if mitBull < $obBot[i] then
                $obAct[i] = 0
             endif
          endif
       endif
    next
    
    // === RETEST: la vela actual toca algun OB vivo ===
    matchBull = 0
    matchBear = 0
    haveDist  = 0
    minDist   = 0
    nearBias  = 0
    for i = 0 to MAXZ - 1 do
       if $obAct[i] = 1 then
          obT = $obTop[i]
          obB = $obBot[i]
          obMid = (obT + obB) / 2
          if $obBias[i] = 1 then
             if low <= obT and close >= obB then
                matchBull = matchBull + 1
                d = abs(close - obMid)
                if haveDist = 0 or d < minDist then
                   minDist  = d
                   nearBias = -1
                   haveDist = 1
                endif
             endif
          else
             if high >= obB and close <= obT then
                matchBear = matchBear + 1
                d = abs(close - obMid)
                if haveDist = 0 or d < minDist then
                   minDist  = d
                   nearBias = 1
                   haveDist = 1
                endif
             endif
          endif
       endif
    next
    
    // === MODE + PROXIMIDAD ===
    matchAny = 0
    if mode = 0 and (matchBull > 0 or matchBear > 0) then
       matchAny = 1
    endif
    if mode = 1 and matchBull > 0 then
       matchAny = 1
    endif
    if mode = 2 and matchBear > 0 then
       matchAny = 1
    endif
    
    if atr14 > 0 then
       distAtr = minDist / atr14
    else
       distAtr = 0
    endif
    if close > 0 then
       minDistPct = minDist / close * 100
    else
       minDistPct = 0
    endif
    
    prevLegSwing    = legSwing
    prevLegInternal = legInternal
    
    SCREENER[matchAny = 1 and haveDist = 1 and distAtr <= proxATR](minDistPct AS "Dist OB %", nearBias AS "R1 S-1")
    
    
    LEONIDAS007 and repropel 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

Screener del indicador “Support Resistance OB”


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
2 months, 1 week ago.

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