Screening of the only last x bars?

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

    I’m working on a stochastic divergence screening routine, but it give me all the signals that it find in the period that it go to analyze (I don’t know how long is the period..), is there a way to retrieve only the signals that it find in the last fixed number of bars?

    Barindex can work in the proscreening?

    Thank’s

    Piero

    #53121 quote
    Nicolas
    Keymaster
    Master
    Barindex is working in ProScreener. Since ProScreener only read 254 bars, you can test the amount of bars is read before giving a new divergence signal. I remember had coded something like this before but I can’t find it unfortunately ..
    #53122 quote
    pieroim
    Participant
    Average

    Ok, works.. 

    //from Nicolas Stochastic Divergence indicator
    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 3 posts - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.

Screening of the only last x bars?


ProScreener: Market Scanners & Detection

New Reply
Author
author-avatar
pieroim @pieroim Participant
Summary

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

Topic Details
Forum: ProScreener: Market Scanners & Detection
Language: English
Started: 11/16/2017
Status: Active
Attachments: No files
Logo Logo
Loading...