The scale runs negative
Williams %R measures where the current close sits inside the recent high-to-low range. Its scale is the thing to get right before anything else:
%R runs from −100 to 0. Not 0 to 100.
A reading of −100 means the close is at the very bottom of the lookback range; 0 means it is at the very top. Every other bounded oscillator most people have met — RSI, stochastic — runs 0 to 100, which is exactly why this one causes a specific and silent failure.
The condition that is always true
Write the oversold threshold the way you would for RSI and you get this:
// WRONG — every %R value is at or below 0, so this is true on every bar
oversold = wprValue < 20
// Correct — the oversold end of the %R scale is near -80
oversold = wprValue < -80
overbought = wprValue > -20
The broken version does not error, does not warn, and does not look broken. It
produces a strategy that enters on every bar until pyramiding is full, reports
a full trade list, and shows an equity curve. Nothing in the Strategy Tester
says "your condition is a constant".
This is why the input test matters. Move the threshold from 20 to 50 to 90 and watch the trade count. If it never changes, your condition is not reading the indicator — the same check that catches an unreferenced input, described in reading the Strategy Tester.
Building it in the form
| Field | Value | Why |
|---|---|---|
| Indicator | Williams %R | |
| Length | 14 | the conventional lookback; nothing derives it |
| Oversold | −80 | note the minus sign |
| Overbought | −20 | |
| Exit | opposite level, or an ATR stop | %R gives no exit of its own |
Then read the export and confirm the emitted comparison carries the negative sign. If the generated Pine shows a bare positive number against the %R series, the control in the settings dialog is not the number the logic uses — see what each field becomes.
What %R does not tell you
The same thing no oscillator tells you: whether the move is over. %R reaching −100 means price closed at the bottom of its recent range, which in a downtrend is the normal state rather than a reversal. It can sit near −100 for dozens of bars.
So %R alone is a range tool. In a trend it needs a gate — a moving-average filter or a volatility regime test — and the honest way to check whether your gate does anything is to count how many trades it removes: the confluence test.
Tactix AI — Studio vs Guide
Tactix AI is AlfaTactix’s product assistant brand (open Tactix AI).
- Tactix Studio turns a one-sentence strategy description into a draft across Timeframe, Signals, Filters, and Risk in the visual Strategy Builder. You review and edit every field before Code Generator writes MQL5 or Pine Script.
- Tactix Guide explains the step you are on — what to fill, what a control means, or how to phrase a rule — without dumping untested source code.
That is form-first automation: the LLM never replaces Code Generator, and you keep plan limits and real-time validation.

