Systemicalpha

Williams %R

systemic:core-wrIndicatorsfunction1 cr

Inputs

NameTypeDescription
Windowinteger- **Description**; The number of trading periods used to calculate the Williams %R indicator.
Price Highfloatarray- **Description**; The highest price recorded during a specific trading period.
Price Lowfloatarray- **Description**; The lowest price recorded during a specific trading period.
Price Closefloatarray- **Description**; The closing price of the asset at the end of a specific trading period.

Outputs

NameTypeDescription
WRfloatarrayThe output of the Williams %R indicator is a value between 0 and -100. These values indicate the level of the current price relative to the highest high and lowest low of the lookback period:

Williams %R is a momentum oscillator that measures where the close sits relative to the high-low range over a lookback period. Developed by Larry Williams, it identifies overbought and oversold conditions.

%R=Highest High−CloseHighest High−Lowest Low×(−100)\%R = \frac{Highest\ High - Close}{Highest\ High - Lowest\ Low} \times (-100)

Missing Data

A closed-market bar (weekend, holiday) or any bar with a null High or Low is not computed — it is a genuine gap, output as None, never a sentinel value and never carried forward from the last valid bar. The Highest High and Lowest Low are found over the observed-bar subsequence: an "n-period window" means n observed bars, with market-closed gaps bridged (Friday adjacent to the following Monday). The first n observed bars are warm-up and are also None. A null Close alone voids only that bar's own value — the High/Low window it sits in still counts for later bars. A flat window (Highest High equals Lowest Low, so the price range is zero) is a genuinely undeterminable ratio and is also None, never 0 or -50. Output length always equals input length; only the values at gap, warm-up, and flat-window slots differ. Live requests return exactly one datapoint — None when that datapoint's window is not yet fully observed.


How It Works

flowchart TD
    subgraph Input["Price Data"]
        H["High"]
        L["Low"]
        C["Close"]
    end
    
    subgraph Calc["Over n periods"]
        HH["Find Highest High"]
        LL["Find Lowest Low"]
        RANGE["Range = HH - LL"]
        POS["Position = HH - Close"]
    end
    
    subgraph Output["Result"]
        DIV["Position / Range"]
        MULT["× -100"]
        WR["Williams %R (-100 to 0)"]
    end
    
    H & L --> HH & LL --> RANGE
    C & HH --> POS
    POS & RANGE --> DIV --> MULT --> WR

Interpreting Williams %R

%R ValueInterpretation
-20 to 0Overbought zone
-80 to -20Neutral zone
-100 to -80Oversold zone
flowchart LR
    subgraph Zones["Williams %R Zones"]
        OB["-20 to 0<br/>Overbought"]
        N["-80 to -20<br/>Neutral"]
        OS["-100 to -80<br/>Oversold"]
    end
    
    OB --> N --> OS

Trading Strategies

1. Overbought/Oversold Exits

ZoneConditionAction
Overbought%R > -20 then drops belowPotential sell
Oversold%R < -80 then rises abovePotential buy

2. Failure Swings

When %R reaches an extreme but fails to make a new extreme on the next attempt, it signals weakening momentum.

3. Divergence

PatternPrice%RImplication
BullishLower lowHigher lowReversal up
BearishHigher highLower highReversal down

Williams %R vs Stochastic

AspectWilliams %RStochastic %K
Range-100 to 00 to 100
FormulaInvertedStandard
Overbought> -20> 80
Oversold< -80< 20
Relationship%R = %K - 100%K = %R + 100

Williams %R is essentially an inverted Stochastic Oscillator.


Common Parameters

ParameterDefaultDescription
Period14Lookback for high/low range

Advantages

  • Leading indicator — Can signal reversals early
  • Simple — Easy to calculate and interpret
  • Clear zones — Well-defined overbought/oversold levels
  • Works in ranges — Effective in sideways markets

Disadvantages

  • False signals — Stays at extremes in strong trends
  • Inverted scale — -100 to 0 can be confusing
  • No smoothing — Can be choppy without additional filtering
  • Trend-blind — Doesn't account for trend direction

Further Reading


Indicator Assessment

%%{init: {'theme': 'base', 'themeVariables': { 'cScale0': '#2563eb', 'cScale1': '#7c3aed'}}}%%
quadrantChart
    title Williams %R Indicator Assessment
    x-axis Low Complexity --> High Complexity
    y-axis Low Reliability --> High Reliability
    quadrant-1 High Value
    quadrant-2 Specialized
    quadrant-3 Limited Use
    quadrant-4 Accessible
    Stocks: [0.25, 0.60]
    Crypto: [0.25, 0.55]
DimensionStocksCryptoNotes
Popularity7/106/10Well-known oscillator; often overshadowed by RSI and Stochastic
Reliability6/105.5/10Effective in ranging markets; prone to false signals in strong trends
Complexity2.5/102.5/10Simple formula and interpretation; inverted scale can confuse beginners
Versatility6/106/10Works across timeframes but best in sideways markets
Recent Interest5/105/10Steady but modest usage; RSI often preferred as the go-to momentum oscillator
Rendering diagrams...
© 2026 WanoLabs. All rights reservedAlpha build v0.1.5