Williams %R: formula, -20/-80 levels, KD difference and an NQ test
Williams %R places the latest close inside the high-low range of the last N bars on a 0 to -100 scale, so it shows how stretched a move is. On its own it is not a reversal signal: in a trending futures market the reading stays stretched for weeks, so the level only earns a place in your rules after a test with costs and a trend filter.
By Soren Huang · Published · updated · Editorial policy
Contents
- What does Williams %R measure, and is it useful for futures reversals?
- How is Williams %R calculated, and how do you use the -20 and -80 levels?
- Williams %R vs KD (stochastic): what is actually different?
- What period should you set for Williams %R?
- Why does Williams %R fail in trending markets?
- What does an NQ backtest of a reversal-style rule show?
- How should you test a Williams %R strategy yourself?
- Frequently asked questions
- References
What does Williams %R measure, and is it useful for futures reversals?
Williams %R places the latest close inside the high-low range of the last 14 bars on a scale from 0 to -100, so it shows how stretched a move is. As a stand-alone reversal trigger it must be tested, because in a trending futures market the stretched reading can stay stretched for weeks.
Williams %R is a momentum oscillator that answers one question: where did the last bar close, relative to the highest high and lowest low of the recent period? A reading of 0 means the close sits at the top of the range; -100 means it sits at the bottom. The Williams %R indicator page covers the history and the standard plot, so this article spends its words on how to read and test it. Think of a thermometer on a wall: it tells you the room is hot, not that someone is about to open a window. "Stretched" is a description of the present, not a prediction of the next bar.
My position: -20 and -80 tell you where price sits in the range, nothing more. Whether a cross of either level is worth trading depends on the market state and a test. Among the technical analysis tools and indicators you can actually test, Williams %R is best used as a cheap measure of stretch that other rules take as a condition.
How is Williams %R calculated, and how do you use the -20 and -80 levels?
The formula divides the distance from the period high to the close by the full range of the period and multiplies by -100; a testable rule enters when the line crosses back through -20 or -80, not on the first touch. This is the only formula in the article:
Williams %R = (highest high of the last N bars − latest close) ÷ (highest high − lowest low of the last N bars) × −100
Here N is the lookback period in bars, highest high and lowest low are the extreme prices inside that window, and the latest close is the close of the current bar. When the close equals the highest high, the top line is zero and the reading is 0. When the close equals the lowest low, the top line equals the bottom line and the reading is -100.
Hypothetical example
Over the last 14 daily bars of an index future, the highest high is 20,000 points and the lowest low is 19,800 points, so the range is 200 points. Today's close is 19,820. The distance from the high to the close is 180 points. Williams %R = 180 ÷ 200 × −100 = −90. The close sits in the bottom tenth of the two-week range, which traders call oversold.
Readings above -20 are called overbought and readings below -80 are called oversold. Overbought means the close is in the top fifth of the recent range; oversold means it is in the bottom fifth. The common trading rules are:
- Touch rule: go long when the line falls below -80, go short when it rises above -20. This rule fires on the first bar of a stretched move and keeps firing while the move continues.
- Cross-back rule: go long when the line has been below -80 and then closes back above -80; go short when it has been above -20 and then closes back below -20. This rule waits for the first sign that the stretch is easing.
The cross-back rule is the one worth writing down and testing, because it has a defined start and does not fire on every bar of a trend. The touch rule produces many entries against a strong move, which the trend section below shows in a picture.
Williams %R vs KD (stochastic): what is actually different?
Williams %R and the raw %K of KD are the same range calculation on flipped scales, so the real differences are smoothing and the signal line, not the idea. The stochastic oscillator (KD) measures where the close sits relative to the lowest low of the period and reports 0 to 100; Williams %R measures the distance from the highest high and reports 0 to -100. Take a raw %K reading, subtract 100, and you have Williams %R for the same period. The two lines are mirror images.
What differs in practice is what the platform does after the calculation. The KD most traders see shows a %K that has already been smoothed over a few bars, plus a %D line, which is a moving average of %K used for crossovers. Williams %R is usually plotted raw, with no smoothing and no second line. The result is that Williams %R reacts one or two bars earlier and crosses its levels more often, while KD is calmer and gives a built-in crossover signal.
| Property | Williams %R | KD (stochastic) |
|---|---|---|
| Scale | 0 to -100 | 0 to 100 |
| Top of the formula | Period high minus close | Close minus period low |
| Smoothing of the main line | None in the usual plot | %K is usually smoothed |
| Signal line | None | %D, a moving average of %K |
| Common default period | 14 | 9 or 14 |
| Typical level pair | -20 / -80 | 80 / 20 |
| Signal timing | Earlier, more crossings | Later, fewer crossings |
For testing, this means a Williams %R cross-back rule and a raw %K cross-back rule at mirrored levels give the same trades. A difference in results between "Williams %R" and "KD" on the same chart comes from the smoothing and the %D crossover, not from the indicator name. If you want to test the effect of smoothing, test it as its own setting rather than as a choice between two indicators.
What period should you set for Williams %R?
The useful period is the one where neighbouring periods behave alike in your test, not the single period with the best backtest. The common default is 14 bars. A shorter period, such as 7, measures a smaller window, so the close reaches the edges of the range more often and the line crosses -20 and -80 more often. A longer period, such as 28, measures a wider window, so the line reaches the bands less often and later. There is no period that is right for every market and bar size.
A practical way to choose:
- Test a range, not a point. Run the same rule with periods from about 5 to 40 in small steps, on the same data with the same costs.
- Look for a plateau. If periods 12 through 20 all give a similar result, pick one in the middle. If period 14 is good and 13 and 15 are poor, the 14 result is a coincidence of that history. The method for reading such a surface is covered in parameter stability: plateau or lucky spike.
- Match the period to the bar size and holding time. A short period on 1-minute bars produces dozens of crossings a day, and each one pays commission and slippage; the article on the best indicator for intraday trading and what testing shows explains why short-period oscillators are the first to fail after costs.
Williams %R settings also include the two levels. -20 and -80 are conventions; -10 and -90 give fewer, more stretched signals, and -30 and -70 give more. Treat the levels as a second setting to test on a grid together with the period.
Why does Williams %R fail in trending markets?
In a steady trend the close sits near the range extreme bar after bar, so Williams %R stays beyond -20 or -80 and every counter-trend entry it produces fights the move. The reason is in the formula. In an uptrend, each new bar sets a new highest high, and the close is near that high, so the top line of the formula stays small and the reading stays near 0. The indicator is not broken; it is correctly reporting that the close keeps landing near the top of the range. The trouble is the trading rule that reads "near the top" as "about to fall".
Traders test two fixes, and both are conditions you can write in one line:
- Add a trend filter. Only take long cross-backs from below -80 when price is above a slow moving average, and only take short cross-backs from above -20 when price is below it. A moving average with less lag, such as the one explained in how the DEMA cuts EMA lag, is a common choice; a trend-strength reading such as ADX is another.
- Trade only in the trend direction. Drop the counter-trend side completely. In an uptrend, a dip below -80 followed by a cross back above it becomes a pullback entry in the direction of the move, which is a different strategy from a reversal and should be tested as one.
Some traders add context from outside the price series, for example the positioning of large traders described in how to read the COT report for gold and test it as a rule, and take oversold signals only when positioning agrees. Whatever the filter, the comparison that matters is the filtered rule against the unfiltered rule on the same data with the same costs. If the filter does not reduce the drawdown of the trending years, it is not doing its job.
What does an NQ backtest of a reversal-style rule show?
The run below tested a reversal-style rule on NQ daily bars from the start of 2019 to mid-2025, with commission and slippage, and the kept candidate shows what such a rule looked like on that history, not what it will do next. The rule in the run is a stand-in, the Effective Spread rule built from standard indicators, used as the only entry and exit with no stop, no target and no filters; it is not a Williams %R rule. The search tried 1,024 candidates (the count tried in this run) and kept one for its return against its drawdown. Picking the kept candidate after the fact flatters it: the best of many tries always carries a selection bonus, which Bailey, Borwein, López de Prado and Zhu (2014) show grows with the number of candidates compared on the same data.
Source: AlphaPrime product engine (CPU), run 2026-10-31. NQ daily bars, 2019-01-02 to 2025-06-30, long and short, 1 contract, $20 commission and $10 slippage per trade.
| Number | Result |
|---|---|
| Net profit (closed trades) | $146,230 |
| Max drawdown | $40,325 |
| Trades | 49 |
| Win rate | 61.22% |
| Profit factor | 2.37 |
| Average trade | $2,984.29 |
| Time in market | 23.29% |

How to read it. The trade count is the first number to check: 49 trades over six and a half years is a small sample, and an average of $2,984.29 per trade built from 49 trades can move a long way if a handful of trades are replaced. The 61.22% win rate and the profit factor of 2.37 describe the same 49 trades, so they share that uncertainty. Time in market of 23.29% says the rule was flat for more than three quarters of the period, which is typical of a reversal-style rule that waits for a stretched reading. The max drawdown of $40,325 against the net profit of $146,230 is the ratio the search selected for, so it is the number most flattered by the selection. None of this says the rule earned that money in a way a reader can expect; it says what one kept candidate looked like on one history. Park and Irwin (2007) surveyed decades of studies of technical rules and found that results which look strong before costs and before an adjustment for the number of rules tried often shrink after both, which is exactly why the next section puts costs and out-of-sample data in the test from the start.
How should you test a Williams %R strategy yourself?
Write the exact entry and exit before you look at a chart, add realistic costs, test a range of periods and levels, grade the result on data the search never saw, and then run the same checks on a trend-filtered version before deciding whether the indicator earns a place in your rules. The order matters: a rule written after you have seen the results is a description of the history.
- Write the exact rule. For example: period 14, long when Williams %R closes back above -80 after being below it, short when it closes back below -20 after being above it, exit on the opposite signal or after a fixed number of bars. Name the bar size, the session and the market.
- Add commission and slippage per trade. Use your broker's commission and at least one tick of slippage per side for a liquid index future; rerun with double the slippage and see whether the result survives. An oscillator rule on short bars trades often, so costs decide more of the outcome than the levels do.
- Test a grid of periods and levels. Periods from about 5 to 40 and level pairs from -10/-90 to -30/-70, all with the same costs and the same next-bar execution. Read the grid as a surface and look for a plateau. When you run that grid, the backtesting in AlphaPrime (Valynox) charges the same fees and slippage and fills on the next bar for every cell, so no period wins because it was tested under softer assumptions.
- Grade on out-of-sample data. Choose the settings on the earlier part of the history and run them unchanged on the later part. Judge the later part by completed trades: a rule that produced 30 out-of-sample trades has given you a hint, not a result. Sullivan, Timmermann and White (1999) showed that the best of a large set of technical rules on one history often loses its edge once the number of rules tried is accounted for, which is why the out-of-sample grade is the one that counts.
- Repeat with a trend filter and compare. Run the identical grid with a moving-average or ADX condition added and compare the two surfaces: trade count, average trade after costs, drawdown in the trending years. If the filtered version is not clearly better on the out-of-sample part, the filter is adding a parameter without adding an edge.
Start with step 1 tonight: write a one-line cross-back rule for the market you trade, with the period and both levels fixed, and run it on your own bar data with your real commission and one tick of slippage per side. Count the trades it produces in the last two years before you read any other number.
Frequently asked questions
What is the difference between Williams %R and KD?
Williams %R and the raw %K of KD are the same calculation on flipped scales: Williams %R measures the distance from the period high and reports 0 to -100, while %K measures the distance from the period low and reports 0 to 100. The practical differences are that KD usually smooths %K and adds a %D signal line, while Williams %R is plotted raw with no second line. Williams %R therefore crosses its levels earlier and more often.
How do you use the -20 and -80 levels in Williams %R?
Readings above -20 mean the close is in the top fifth of the recent range (overbought); readings below -80 mean it is in the bottom fifth (oversold). The testable rule is the cross-back: enter long when the line closes back above -80 after being below it, and short when it closes back below -20 after being above it. Entering on the first touch produces many entries against a strong trend.
What are the best Williams %R settings?
The common default period is 14 bars with levels at -20 and -80, but no single setting fits every market and bar size. Test a range of periods and level pairs with the same costs and look for a plateau where neighbouring settings give similar results. A period that beats its neighbours by a wide margin is a coincidence of the history you tested, not a property of the market.
Does Williams %R work in a trending market?
In a steady trend the close sits near the range extreme bar after bar, so Williams %R stays above -20 or below -80 for long stretches and counter-trend signals lose. The indicator is reporting correctly; the reversal rule is the problem. Traders fix this by adding a trend filter, such as price above or below a slow moving average, or by taking cross-back signals only in the direction of the trend, as pullback entries.
Is Williams %R a leading or lagging indicator?
Williams %R is built only from the current close and the high-low range of the lookback window, with no smoothing, so it reacts to a new close immediately. That makes it react earlier than smoothed oscillators like KD, but earlier also means noisier: it crosses its levels more often, and many of those crossings are not followed by a turn. Whether the early signal is worth trading depends on costs and a test, not on the indicator being "leading".
References
- Bailey, D. H., Borwein, J., López de Prado, M., & Zhu, Q. J. (2014). Pseudo-Mathematics and Financial Charlatanism: The Effects of Backtest Overfitting on Out-of-Sample Performance. Notices of the American Mathematical Society, 61(5), 458–471.
- Park, C.-H., & Irwin, S. H. (2007). What Do We Know About the Profitability of Technical Analysis? Journal of Economic Surveys, 21(4), 786–826.
- Sullivan, R., Timmermann, A., & White, H. (1999). Data-Snooping, Technical Trading Rule Performance, and the Bootstrap. The Journal of Finance, 54(5), 1647–1691.

