Screening solo sulle ultime n barre?

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #53038 quote
    pieroim
    Participant
    Average

    Mi spiego, lavorando sull’indicatore delle divergenze nello stocastico realizzato da Nicolas, trovato qui sul forum, ho realizzato una routine di screening che mi cerca appunto tutte del divergenze. La questione che si pone é che purtroppo mi recupera tantissimi segnali non potendo delimitare l’nalisi alle ultime “n” candele, in funzione del TF scelto.

    Se mi interessano i risultati delle ultime 30 candele, ad esempio, come posso fare?

    Barindex funziona nello screening? Se si, come lo si potrebbe usare per raggiungere lo scopo?

    Grazie

    Piero

    #53042 quote
    robertogozzi
    Moderator
    Master

    Puoi partire da n candele indietro, esempio:

    FOR i = 30 TO 0 DO
       IF close[i] > close[i+1] THEN
          .
          .
       ENDIF
    NEXT

    Ovviamente all’interno del ciclo tu metterai tutto quello che vuoi.

    #53044 quote
    pieroim
    Participant
    Average

    Ok, grazie

    #53106 quote
    pieroim
    Participant
    Average

    Purtroppo non mi riesce di farla andare, mi sfugge qualcosa del linguaggio PRT.

    Qui di seguito é l’indicatore da cui ho preso spunto e che se messo cosí com’é (ovviamente con le necessarie modifiche perché proscreener funzioni) funziona ma restituisce troppi segnali perché include eventi accaduti su candele molto vecchie.

    p=15

    overboughtzone=80

    oversoldzone=20

    k=3

    d=6

    // DIVERGENCES STO adapted from HK-LISSE code
    
    x = stochastic[p,k]
    y = average[d](x)
    
    
    if x>overboughtzone then
    hi=max(hi,x)
    hico=max(hico,max(high,high[1]))
    endif
    if x crosses under y then
    sto2b=sto1b
    sto1b=hi
    hi=0
    p3b=p1b
    p2b=max(p1b,hico1)
    p1b=max(highest[3](high),hico)
    if p2b=p1b then
    p2b=max(p3b,p4b)
    endif
    hico=0
    hico1=0
    endif
    if x<y then
    p4b=hico1
    hico1=max(hico1,high)
    endif
    if p1b>p2b and sto1b<sto2b and x crosses under y and x<x[1] then
    signB= -2
    else
    signB= 0
    endif
    
    if x<oversoldzone then
    lo=min(lo,x)
    lowco=min(lowco,min(low,low[1]))
    endif
    if x CROSSES OVER y  then
    sto2h=sto1h
    sto1h=lo
    lo=100
    p3h=p1h
    p2h=min(p1h,lowco1)
    p1h=min(lowest[3](low),lowco)
    if p2h=p1h then
    p2h=min(p3h,p4h)
    endif
    lowco=100000
    lowco1=100000
    endif
    if x>y then
    p4h=lowco1
    lowco1=min(lowco1,low)
    endif
    if p1h<p2h and sto1h > sto2h and x crosses over y and x>x[1]  then
    signH= 2
    else
    signH= 0
    endif
    ////////////////////////////////////////////////
    return       signH as " div STO bull ", signB as " div STO bear " , 0 as " zero "

    La soluzione sarebbe prender nota della candela in cui si é verificato l’evento e validarla solo se appartiene alle ultime x candele. Non so peró quale istruzione fa a questo caso, barindex mi sembra non funzionare correttamente in proscreener.

     

    la seguente é la routine su cui sto lavorando inclusa in un ciclo For… Next che peró non va perché non restituisce alcun risultato..

    p=14
    k=3
    d=6
    overboughtzone=80
    oversoldzone=20
    //mioADX = ADX[14]
    mioStoc = stochastic[p,k]
    
    FOR i = 30 TO 0 DO
    //if mioADX[i]>25 then
    
    // DIVERGENCES STO adapted from HK-LISSE code
    x = mioStoc[i]
    y = average[d](x)
    if x>overboughtzone then
    hi=max(hi,x)
    hico=max(hico,max(high[i],high[i+1]))
    endif
    if x crosses under y then
    sto2b=sto1b
    sto1b=hi
    hi=0
    p3b=p1b
    p2b=max(p1b,hico1)
    p1b=max(highest[3](high[i]),hico)
    if p2b=p1b then
    p2b=max(p3b,p4b)
    endif
    hico=0
    hico1=0
    endif
    if x<y then
    p4b=hico1
    hico1=max(hico1,high[i])
    endif
    
    c1=0
    c1 = p1b>p2b and sto1b<sto2b and x crosses under y and x<mioStoc[i+1]
    
    
    if x<oversoldzone then
    lo=min(lo,x)
    lowco=min(lowco,min(low[i],low[i+1]))
    endif
    if x CROSSES OVER y  then
    sto2h=sto1h
    sto1h=lo
    lo=100
    p3h=p1h
    p2h=min(p1h,lowco1)
    p1h=min(lowest[3](low[i]),lowco)
    if p2h=p1h then
    p2h=min(p3h,p4h)
    endif
    lowco=100000
    lowco1=100000
    endif
    if x>y then
    p4h=lowco1
    lowco1=min(lowco1,low[i])
    endif
    
    c2=0
    c2 = p1h<p2h and sto1h>sto2h and x crosses over y and x>mioStoc[i+1]
    screener[c1 or c2]
    //endif
    NEXT

    Da un punto di vista prettamente logico dovrebbe funzionare, ma io non conoscendo granché  il linguaggio PRT evidentemente qualcosa non gli garba..

     

     

    #53117 quote
    robertogozzi
    Moderator
    Master

    Intanto mi scuso, ma il ciclo FOR decrescente deve usare DOWNTO, non TO, tra i due numeri. La prima cosa errata che noto è la riga 65, ad ogni candela l’istruzione SCREENER può essere eseguita solo una volta, alla fine del codice, non dentro un ciclo. Prova a metterla alla fine, fuori dal ciclo, però tieni presente che C1 e C2 avranno l’ultimo valore (quando il ciclo arriva a 0, non delle altre candele. Comunque, per tornare al tuo post iniziale, l’esempio che ti ho fatto funziona. Io l’ho provato sul DAX ad 1 ora, cercando tutte quelle candele, entro le ultime 10, che abbiano un Massimo < alle due precedenti (una scaletta discendente a tre):

    c = 0
    FOR i = 10 DOWNTO 1 DO
       IF high[i] < high[i+1] AND high[i+1] < high[i+2] THEN
          c = i   //c restituisce il numero dell'ultima barra, chiusa, dove si è verificata la condizione
       ENDIF
    NEXT
    SCREENER [c] (c AS "barra")
    Nicolas thanked this post
    #53123 quote
    pieroim
    Participant
    Average

    Ok, ho risolto con barindex, pensavo non funzionasse nel proscreener, poi Nicolas mi ha dato l’ok, ed ecco qua lo screening: https://www.prorealcode.com/topic/screening-of-the-only-last-x-bars/   Ora devo valutare meglio il comportamento della routine che cerca le divergenze, non mi convince.. almeno io avrei considerato le sole divergenze che nascono e muoiono nelle aree di sovraprezzo/vendita senza sconfinamenti, di solito sono le più attendibili. Vedo che il link non va.. eppure é quello il percorso.. 

    riporto lo screening dovesse tornare utile..

     

    p=14
    k=3
    d=6
    overboughtzone=80
    oversoldzone=20
    maxCandele = 10
    
    x = stochastic[p,k]
    y = average[d](x)
    
    
    if x>overboughtzone then
    hi=max(hi,x)
    hico=max(hico,max(high,high[1]))
    endif
    if x crosses under y then
    sto2b=sto1b
    sto1b=hi
    hi=0
    p3b=p1b
    p2b=max(p1b,hico1)
    p1b=max(highest[3](high),hico)
    if p2b=p1b then
    p2b=max(p3b,p4b)
    endif
    hico=0
    hico1=0
    endif
    if x<y then
    p4b=hico1
    hico1=max(hico1,high)
    endif
    
    c1=0
    if p1b>p2b and sto1b<sto2b and x crosses under y and x<x[1] and barindex>maxCandele then
    c1 = p1b>p2b and sto1b<sto2b and x crosses under y and x<x[1]
    endif
    
    if x<oversoldzone then
    lo=min(lo,x)
    lowco=min(lowco,min(low,low[1]))
    endif
    if x CROSSES OVER y  then 
    sto2h=sto1h
    sto1h=lo
    lo=100
    p3h=p1h
    p2h=min(p1h,lowco1)
    p1h=min(lowest[3](low),lowco)
    if p2h=p1h then
    p2h=min(p3h,p4h)
    endif
    lowco=100000
    lowco1=100000
    endif
    if x>y then 
    p4h=lowco1
    lowco1=min(lowco1,low)
    endif
    
    c2=0
    c2 = p1h<p2h and sto1h>sto2h and x crosses over y and x>x[1]
    if c2<>0 and barindex>maxCandele then
    c2=0
    endif
    
    c2=0
    if p1h<p2h and sto1h>sto2h and x crosses over y and x>x[1] and barindex>maxCandele then
    c2 = p1h<p2h and sto1h>sto2h and x crosses over y and x>x[1]
    endif
    
    screener[c1 or c2]

     

Viewing 6 posts - 1 through 6 (of 6 total)
  • You must be logged in to reply to this topic.

Screening solo sulle ultime n barre?


ProScreener: Scansione Mercati & Screener

New Reply
Author
author-avatar
pieroim @pieroim Participant
Summary

This topic contains 5 replies,
has 2 voices, and was last updated by pieroim
8 years, 3 months ago.

Topic Details
Forum: ProScreener: Scansione Mercati & Screener
Language: Italian
Started: 11/16/2017
Status: Active
Attachments: No files
Logo Logo
Loading...