Screener RSI y Media móvil ponderada

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #265081 quote
    FGARCIAFGARCIA
    Participant
    New

    Buenas tardes,

    He creado un screener para filtrar los valores que han estado en sobreventa usando el RSI y a continuación se genera la señal de comprar cuando se produce un giro al alza de la media móvil ponderada de 14 períodos, sin embargo no muestra lo esperado. Podríais decirme si el siguiente código es correcto:


    MMP100 = WeightedAverage[100](close)

    e1 = MMP100 > MMP100[1]

    RSI1 = RSI[14](close)

    if RSI1 < 40 then

    VRSIE = 1

    endif

    MMP14 = WeightedAverage[14](close)

    e2 = MMP14 CROSSES OVER MMP14[1]

    ELargo = VRSIE = 1 and e1 and e2


    if ELargo then

    Screener[ELargo]

    VRSIE = 0

    endif



    #265085 quote
    JSJS
    Participant
    Master

    Hola fgarcia,

    e2 = MMP14 CROSSES OVER MMP14[1]

    Esta comparación siempre da como resultado cero, porque un valor nunca puede cruzarse con su propio valor anterior…

    Lo que, por ejemplo, sí sería posible es:

    e2 = MMP14 CROSSES OVER MMP100

    o:

    e2 = MMP14 > MMP14[1]

    Iván González thanked this post
    #265099 quote
    Iván GonzálezIván González
    Moderator
    Legend

    El código compila, pero tiene un problema de fondo que explica que no veas lo que esperas: VRSIE no caduca nunca. Se pone a 1 la primera vez que el RSI baja de 40 y ya no vuelve a 0 salvo que se dispare la señal entera. Como el screener carga 255 barras (o 1024 con Premium), casi todos los valores han tocado RSI<40 en algún momento de esa ventana, así que ese filtro deja de filtrar: lo que te queda corriendo de verdad es “la WMA100 sube y la WMA14 gira”. La sobreventa tiene que ser reciente, no alguna vez.

    Te dejo el screener reescrito. En vez de un flag pegajoso lleva un contador de barras desde la última lectura de sobreventa, que además sale como columna para que veas lo fresca que es cada señal:

    //------------------------------------------------
    // Screener: RSI en sobreventa + media ponderada girando al alza
    // version = 1
    // 15.09.2026
    // Ivan Gonzalez @ www.prorealcode.com
    //------------------------------------------------
    
    // --- Ajustes ---
    rsiLength   = 14
    rsiLevel    = 40    // umbral de sobreventa
    fastLength  = 14    // media ponderada que tiene que girar
    trendLength = 100   // media ponderada usada como filtro de tendencia
    lookback    = 10    // barras máximas entre la sobreventa y el giro
    
    // --- Filtro de tendencia: la media lenta tiene que estar subiendo ---
    wmaSlow = WeightedAverage[trendLength](close)
    trendUp = wmaSlow > wmaSlow[1]
    
    // --- Barras transcurridas desde la última lectura de sobreventa ---
    myRsi = RSI[rsiLength](close)
    if myRsi < rsiLevel then
       barsSinceOS = 0
    else
       barsSinceOS = barsSinceOS + 1
    endif
    oversold = barsSinceOS <= lookback
    
    // --- Giro al alza: la media rápida venía bajando y ahora sube ---
    wmaFast = WeightedAverage[fastLength](close)
    turnUp = wmaFast > wmaFast[1] and wmaFast[1] <= wmaFast[2]
    
    SCREENER[trendUp and oversold and turnUp](myRsi AS "RSI", barsSinceOS AS "Barras desde sobreventa")
    
    


    robertogozzi and FGARCIA thanked this post
    Captura-de-pantalla-2026-09-15-103412.png Captura-de-pantalla-2026-09-15-103412.png
    #265109 quote
    FGARCIAFGARCIA
    Participant
    New

    Gracias Ivan, ha sido de gran ayuda

Viewing 4 posts - 1 through 4 (of 4 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 RSI y Media móvil ponderada


ProScreener: Buscadores de Mercado y Rastreo

New Reply
Author
author-avatar
FGARCIA @fgarcia Participant
Summary

This topic contains 3 replies,
has 3 voices, and was last updated by FGARCIAFGARCIA
4 weeks ago.

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