TRIN screener Criterio para ordenar

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #248254 quote
    JEA
    Participant
    New

    Buenos días.

    En base al screener de TRIN creado por Roberto:

    // Arms Index (TRIN)
    //
    // also named Short-Term Trading Index (TRIN)
    //
    //
    Periods = 20
    BullBAR = close > close[1]
    BearBAR = close < close[1]
    AdvBAR= 1
    AdvVOL= 1
    DecBAR= 1
    DecVOL= 1
    myTrin= 0
    IF BarIndex >= Periods THEN
    FOR i = 0 TO Periods
    IF BullBAR[i] THEN
    AdvBAR = AdvBAR + 1
    AdvVOL = AdvVOL + volume[i]
    ELSIF BearBAR[i] THEN
    DecBAR = DecBAR + 1
    DecVOL = DecVOL + volume[i]
    ENDIF
    NEXT
    IndexBAR = AdvBAR / DecBAR
    IndexVOL = AdvVOL / DecVOL
    myTrin= IndexBAR / IndexVOL
    ENDIF
    Signal = 0
    IF myTrin <= 0.5 THEN
    Signal = 1
    ELSIF myTrin >= 1.5 THEN
    Signal = 2
    ENDIF
    SCREENER[Signal](Signal AS “1=↑,2=↓”)
    he tratado de separarlo para valores ascendentes (1=) por un lado y descendentes por otros(2=↓) y además, quisiera que dentro de los ascendentes, cuyo myTrin<= 0.5, pudiera fijar
    un criterio adicional que me orden los valores encontrados dentro de un rango. Por ejemplo: Cond2=mytrin>0.2 and mytrin<0.4
    El screener alcista me saldría algo así:

    // Arms Index (TRIN)
    //
    // also named Short-Term Trading Index (TRIN)
    //
    // https://corporatefinanceinstitute.com/resources/equities/arms-index-trin/
    //
    Periods = 20
    BullBAR = close > close[1]
    BearBAR = close < close[1]
    AdvBAR = 1
    AdvVOL = 1
    DecBAR = 1
    DecVOL = 1
    myTrin = 0
    IF BarIndex >= Periods THEN
    FOR i = 0 TO Periods
    IF BullBAR[i] THEN
    AdvBAR = AdvBAR + 1
    AdvVOL = AdvVOL + volume[i]
    ELSIF BearBAR[i] THEN
    DecBAR = DecBAR + 1
    DecVOL = DecVOL + volume[i]
    ENDIF
    NEXT
    IndexBAR = AdvBAR / DecBAR
    IndexVOL = AdvVOL / DecVOL
    myTrin = IndexBAR / IndexVOL
    ENDIF
    Signal = 0
    IF myTrin<=0.5 THEN
    Signal=1
    ENDIF

    Cond1=close>4 and volume>50000

    //Criterio de clasificación
    Cond2=myTrin
    Criteria=cond2<0.4 and cond2>0.2

    SCREENER[Signal and cond1 and cond2](criteria)

    El problema que tengo es que me salen valores que no cumplen que el trin sea >0.2 y <0.4 (por ejemplo me sale un trin de 1.81, etc).

    ¿Cómo se puede arreglar?

    Gracias y un saludo.

    #248258 quote
    JS
    Participant
    Master

    Hola JEA,

    Pruebe estos…

    Periods = 20
    BullBAR = close > close[1]
    BearBAR = close < close[1]
    AdvBAR = 1
    AdvVOL = 1
    DecBAR = 1
    DecVOL = 1
    myTrin = 0
    IF BarIndex >= Periods THEN
    FOR i = 0 TO Periods
    IF BullBAR[i] THEN
    AdvBAR = AdvBAR + 1
    AdvVOL = AdvVOL + volume[i]
    ELSIF BearBAR[i] THEN
    DecBAR = DecBAR + 1
    DecVOL = DecVOL + volume[i]
    ENDIF
    NEXT
    IndexBAR = AdvBAR / DecBAR
    IndexVOL = AdvVOL / DecVOL
    myTrin = IndexBAR / IndexVOL
    ENDIF
    Signal = 0
    IF myTrin>0.2 and myTrin<0.4 THEN
    Signal=1
    ENDIF
    
    Cond1=close>4 and volume>50000
    
    SCREENER[Signal and cond1](myTrin as "TRIN")

    Iván González and robertogozzi thanked this post
    Scherm­afbeelding-2025-06-13-om-12.45.17.png Scherm­afbeelding-2025-06-13-om-12.45.17.png
    #248427 quote
    JEA
    Participant
    New
    Buenos días. Gracias por la acertadísima respuesta y la rapidez en contestar. Hasta hoy no lo he podido probar por haber estado de viaje pero funciona perfectamente. Un saludo.   JEA
    JS thanked this post
Viewing 3 posts - 1 through 3 (of 3 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

TRIN screener Criterio para ordenar


ProScreener: Buscadores de Mercado y Rastreo

New Reply
Author
author-avatar
JEA @jea Participant
Summary

This topic contains 2 replies,
has 2 voices, and was last updated by JEA
1 year, 2 months ago.

Topic Details
Forum: ProScreener: Buscadores de Mercado y Rastreo
Language: Spanish
Started: 06/13/2025
Status: Active
Attachments: 1 files
Logo Logo
Loading...