What is expression for %R

for buy signal % R should hit -99.99 about 15 times and then give alert

for sell signal %R should hit -0.05 aboout 15 times and then give alert

no of periods =14

if %r goes below -50 again -99.99 should start from first time (buy signal)

I don’t think it’s possible to count and keep the number of times it hit.

Not sure if its possible to code this.

Below is the code-

***BUY-
WPR(14)= -99.99

***BUY Exit
WPR(14)= -0.05

Then help me in coding only Williams%R by keeping time periods 14
Buy when %r reaches -99.99
Exit when it reches -0.05