Skip to content

Williams' %R

WILLR measures overbought and oversold conditions on a scale of 0 to -100.

Method

tm.ta.willr(source_high, source_low, source_close, timeperiod)

Inputs

ParameterArgument typeDescriptionDefault Value
source_highpd.SeriesHigh prices series-
source_lowpd.SeriesLow prices series-
source_closepd.SeriesClose prices series-
timeperiodintNumber of periods for the indicator14

Outputs

OutputType
willrnp.ndarray

Example usage

strategy.py
import tradomate as tm
@tm.strategy()
def my_strategy(config: tm.TradomateConfig, data: tm.TradomateData):
# Trying out Williams' %R
willr = tm.ta.willr(data.high, data.low, data.close, timeperiod=14)
# Get the last value and print
last_value = willr.iloc[-1]
tm.log(f"Last value of Williams' %R is {last_value}")
# Plot the values of willr
tm.plot(willr, title="Williams' %R", overlay=False)