REM Percentage proximity within which the closing price is with respect to the fib level
REM Change this parameter to desired percentage e.g. change it to 1 if you want results where the
REM closing price is within 1% of the fib level
proximity = 0.5
REM The highest price of the last 70 days roughly taking us to the highs of late april/early may
REM Change 70 to a different number of days as required
h = DHigh(70)
REM The Lowest price of the last 70 days rougly taking us into the lows of june
REM Change 70 to a different number of days as required
l = DLow(70)
diff = h - l
fib2 =h - diff*0.382
fib3 =h - diff*0.618
fib4 =h - diff*0.5
REM Closing price within the 'proximity' of 38.2 fib
diff2 = abs(close-fib2)
pdiff2 = diff2/close*100
c2 = pdiff2 <= proximity
REM Closing price within the 'proximity' of 68.2 fib
diff3 = abs(close-fib3)
pdiff3 = diff3/close*100
c3 = pdiff3 <= proximity
REM Closing price within the 'proximity' of 50 fib
diff4 = abs(close-fib4)
pdiff4 = diff4/close*100
c4 = pdiff4 <= proximity
REM Scanning criteria is satisfied if any of the above 4 conditions are met
c5 = c2 Or c3 Or c4
REM sort the results by decending RSI
criteria = RSI[14](close)
SCREENER[c5] (criteria AS "RSI")