screener con filtro kalman

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #234814 quote
    jesus1975
    Participant
    Veteran

    Pretendo construir un screener con el indicador filtro de kalman, presente en la biblioteca de prorealcode.

    El screener calcula el número de giros(el inverso al número de giros) que se han producido en el anterior indicador en las últimas 250 barras(es lo que me permite la versión completa), con objeto de buscar los valores que menos giros tengan, es decir, valores en los que la tendencia sea más constante en el tiempo. Esto es lo que he construido, pero el resultado del screener no es el esperado y no sé por qué, a ver si alguien ayudar.

    Saludos

    REM
    TIMEFRAME(1 hour)
    
    Series = TotalPrice
    
    ONCE Pred = Series
    
    IF BarIndex = 0 THEN
    KF = Series
    ELSE
    Smooth = Pred + (Series - Pred) * SQRT((K / 10000) * 2)
    Velo = Velo + ((K / 10000) * (Series - Pred))
    Pred = Smooth + Velo
    KF = Pred
    ENDIF
    
    once nintervalos=0
    FOR i=0 TO 250 DO
    cambioup=kf[i]> kf[i+1] and kf[i+1]<kf[i+2]
    cambiodw=kf[i]< kf[i+1] and kf[i+1]>kf[i+2]
    if cambioup or cambiodw then
    nintervalos=nintervalos + 1
    else
    endif
    
    NEXT
    
    
    //c1=volume>4000000
    c2=barindex>253
    SCREENER[c2](1/nintervalos*1000 as " menor numero giros")
    #234815 quote
    Iván González
    Moderator
    Master

    ¡Hola! Prueba utilizando islastbarupdate

    once nintervalos=0
    
    if islastbarupdate then
    FOR i=0 TO 250 DO
    cambioup=kf[i]> kf[i+1] and kf[i+1]<kf[i+2]
    cambiodw=kf[i]< kf[i+1] and kf[i+1]>kf[i+2]
    if cambioup or cambiodw then
    nintervalos=nintervalos + 1
    else
    endif
    NEXT
    endif
    
    //c1=volume>4000000
    c2=barindex>253
    SCREENER[c2](nintervalos as " menor numero giros")
    robertogozzi and jesus1975 thanked this post
    #234817 quote
    robertogozzi
    Moderator
    Master

    Creo que es la variable K (no la incluiste en el código que publicaste).
    No debe exceder los 250.

    jesus1975 thanked this post
    #234818 quote
    robertogozzi
    Moderator
    Master

    No, lo siento, me equivoqué, K no es el número de unidades, así que ese no puede ser el problema.

    jesus1975 thanked this post
    #234822 quote
    jesus1975
    Participant
    Veteran

    Sí señor, muchas gracias Iván, ahora funciona perfectamente. Gran trabajo el tuyo en el foro, muchas gracias.

    #234823 quote
    jesus1975
    Participant
    Veteran
    REM
    TIMEFRAME(1 hour)
    k=4//valores entre 1 y 100
    Series = TotalPrice
    
    ONCE Pred = Series
    
    IF BarIndex = 0 THEN
    KF = Series
    ELSE
    Smooth = Pred + (Series - Pred) * SQRT((K / 10000) * 2)
    Velo = Velo + ((K / 10000) * (Series - Pred))
    Pred = Smooth + Velo
    KF = Pred
    ENDIF
    
    once nintervalos=0
    if islastbarupdate then
    FOR i=0 TO 250 DO
    cambioup=kf[i]> kf[i+1] and kf[i+1]<kf[i+2]
    cambiodw=kf[i]< kf[i+1] and kf[i+1]>kf[i+2]
    if cambioup or cambiodw then
    nintervalos=nintervalos + 1
    else
    endif
    NEXT
    endif
    
    //c1=volume>4000000
    c2=barindex>253
    SCREENER[c2](1/nintervalos as "inverso número giros")
    

    Quedaría así, por si alguien lo quiere usar. Saludos

    Iván González thanked this post
Viewing 6 posts - 1 through 6 (of 6 total)
  • You must be logged in to reply to this topic.

screener con filtro kalman


ProScreener: Buscadores de Mercado y Rastreo

New Reply
Author
author-avatar
jesus1975 @jesus1975 Participant
Summary

This topic contains 5 replies,
has 3 voices, and was last updated by jesus1975
1 year, 8 months ago.

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