This is the code by Nicolas:
//PRC_WilliamsRpercent - 01.09.2016 - Nicolas @ www.prorealcode.com
//
period = 14
hh = highest [ period] (high )
ll = lowest [ period] (low )
Wp = ((hh- close )/ (hh- ll))* - 100
return Wp as "Williams R percent" , - 20 as "-20 level" , - 80 as "-80 level"
you can add the smoothing just BEFORE the last line:
//PRC_WilliamsRpercent - 01.09.2016 - Nicolas @ www.prorealcode.com
//
period = 14
hh = highest [ period] (high )
ll = lowest [ period] (low )
Wp = ((hh- close )/ (hh- ll))* - 100
Smooth = average [ period,0 ] (Wp)
return Wp as "Williams R percent" , Smooth as "Williams R% Smoothed" , - 20 as "-20 level" , - 80 as "-80 level"
you can change the type of MA (o=sma, 1=ema, etc… as from https://www.prorealcode.com/documentation/average/ ) and periods.
1 user thanked author for this post.