WilliamsPercentRange

Calculates the Williams' Percent Range indicator.

Accepts the following parameters:

Parameter NameTypeDefault ValueNotes
periodNumber14-

Returns: Series<Number>

WilliamsPercentRange is a built-in function - you can use it directly. Below is an example implementation:

1 function WilliamsPercentRange(period = 14):
2 highest = Highest(high, period)
3 lowest = Lowest(low, period)
4
5 -100 * (highest - close) / (highest - lowest) if highest != lowest else 0