This is a stock screener that will fetch stocks that have made a new Fractal (calculated upon the last “p” period = 10 periods by default) in the last 5 days (“lookback” variable that can be modified at line 6 of the below code).
Some Fractals indicators can be downloaded too in the Library:
The Fractals code here do not respect completely the Bill Williams original description (FYI).
This screener has been coded by request.
//PRC_FractalsScreener | screener
//03.11.2016
//Nicolas @ www.prorealcode.com
//Sharing ProRealTime knowledge
lookback = 5 //how much days in the past to scan for new fractal?
p = 10 //period to calculate new fractals
if high[p] >= highest[2*p+1](high) then
fractalH = 1
fractalL=0
else
fractalH = 0
endif
if low[p] <= lowest[2*p+1](low) then
fractalL = -1
fractalH=0
else
fractalL = 0
endif
newhigh = summation[lookback](fractalH=1 and fractalH[1]=0)=1
newlow = summation[lookback](fractalL=-1 and fractalL[1]=0)=1
SCREENER [newhigh or newlow]