Williams R Indicator Trading Strategy
The Williams %R trading strategy generates signals based on the Williams Percent Range indicator, which measures market momentum by comparing the current close to the high-low range over a period. The strategy goes…
Strategy Logic
The Williams %R trading strategy generates signals based on the Williams Percent Range indicator, which measures market momentum by comparing the current close to the high-low range over a period.
The strategy goes long when the %R line crosses above oversold, and sells when the line crosses below overbought. The logic is:
Calculate Williams %R over a timeframe (e.g. 14 periods)
Set overbought (e.g. -20) and oversold (e.g. -80) levels
Go long when the %R line crosses up through oversold
Close longs when the %R line crosses down through overbought
This allows entries around potential reversal points to capitalize on short-term moves.
Advantages
Simple parameters and rules
Early identification of overbought/oversold
Systematic breakout trading
Risks
Lagging %R may miss opportunities
Requires optimization of inputs
Oversold/bought levels are rough guides
Summary
The Williams %R strategy aims to capture reversals by trading overbought/oversold regions. With proper position sizing and stops, risk can be controlled. But lag is a key limitation requiring additional tools for validation and caution in use.
Parameters
| Name | Default | What it controls |
|---|---|---|
| v_input_1 | 14 | Length |
| v_input_2 | -20 | Overbought Level |
| v_input_3 | -80 | Oversold Level |
Source Pine Script
/*backtest
start: 2023-01-01 00:00:00
end: 2023-09-13 00:00:00
period: 12h
basePeriod: 15m
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/
// © Julien_Eche
//@version=5
strategy("Williams %R Strategy", overlay=true, initial_capital=100000, shorttitle="W%R Strategy")
// Paramètres
length = input(14, "Length")
overboughtLevel = input(-20, "Overbought Level")
oversoldLevel = input(-80, "Oversold Level")
// Calcul du Williams %R
williamsR = -100 * (ta.highest(high, length) - close) / (ta.highest(high, length) - ta.lowest(low, length))
// Conditions d'achat et de vente
buySignal = ta.crossover(williamsR, oversoldLevel)
sellSignal = ta.crossunder(williamsR, overboughtLevel)
// Entrée en position longue
if buySignal
strategy.entry("Buy", strategy.long)
// Sortie de la position longue
if sellSignal
strategy.close("Buy")
Published by ChaoZhang on the FMZ strategy square · last modified 2023-09-14. Collected in the Quant Trading Vault. Unvalidated research: re-test with your own data and costs before trusting it.
Build this with AgenKit
A spec is not a trading system. Paste this into your coding agent and AgenKit runs a specialist team — architecture, test-first build, risk gates, review — with paper trading on by default.
/agenkit build a production-grade trading bot with a backtest engine, risk controls and paper trading by default from strategies/Williams-R-Indicator-Trading-Strategy.md- npx agenkit install engineering-kit in your project
- Paste the command into your agent and approve each phase
- Get tests, backtest, risk controls and a paper-trading switch
Understand it first
Before you run this, read the lesson behind the idea and how to backtest it honestly. Specs like this one are the survivors of an unknown number of trials; deflate their results accordingly.
Related specs
- 5 Day Moving Average Channel Breakout Strategy Combined With Mileage ConceptPine Script · Breakout · 1d
- ATR Trailing Stops StrategyPine Script · Breakout · 1h
- ATR Trend Breakout StrategyPine Script · Breakout · 1d
- Adaptive Bollinger Breakout with Moving Average Quantitative Strategy SystemPine Script · Breakout · 1h
- Adaptive Channel Breakout StrategyPine Script · Breakout · 1d
- Adaptive Multi Period Trading Strategy Based on Wave Trend Momentum BreakoutPine Script · Breakout · 2h