Williams' Percent Range

The WPR shows the position of the close price within the recent price range to identify overbought and oversold levels.

Role in the strategy

SlotAvailableRole
Entry PointNo—
Entry RuleYesFilters entries by the WPR direction or its level position.
Exit PointNo—
Exit RuleYesTriggers exits by the WPR direction or its level position.

The Williams' Percent Range produces conditions, not order prices. As an entry rule it is ANDed with the entry point and the other entry rules; as an exit rule it is ORed with the other exit rules. See Indicators for the slot semantics.

Logic rules

The indicator offers the standard oscillator rule set, evaluated on the WPR value, which moves between −100 and 0:

RuleLong signal is 1 whenShort signal is 1 when
WPR risesWPR rose on the previous barWPR fell on the previous bar
WPR fallsWPR fell on the previous barWPR rose on the previous bar
WPR is higher than the Level lineWPR is above LevelWPR is below −100 − Level
WPR is lower than the Level lineWPR is below LevelWPR is above −100 − Level
WPR crosses the Level line upwardWPR crossed above Level from belowWPR crossed below −100 − Level from above
WPR crosses the Level line downwardWPR crossed below Level from aboveWPR crossed above −100 − Level from below
WPR changes its direction upwardWPR formed a valley (down then up)WPR formed a peak (up then down)
WPR changes its direction downwardWPR formed a peak (up then down)WPR formed a valley (down then up)

The Level parameter sets the long threshold; the short threshold is always −100 − Level. With the default Level of −20, the long side uses −20 and the short side uses −80.

Parameters

ParameterTypeDefaultRangePurpose
Periodnumber141 to 1000Bars of the price range
Levelnumber−20−100 to 0Long threshold; the short threshold is −100 − Level

Calculation

tech.WPR in engine/indicator-engine/tech.ts computes WPR = −100 × (Highest High − Close) / (Highest High − Lowest Low) over the Period. The line is drawn in a separate chart pane; values near 0 mark strength, values near −100 mark oversold conditions.

Backtesting

  • The rule is evaluated on the previous (closed) bar with the standard dead zone (SIGMA = 0.000001).
  • The indicator contributes only long/short signal arrays — it never changes the entry or exit order price.
  • An entry happens only when the entry point allows the direction and every entry rule passes; an exit happens when the exit point is reached and any exit rule passes.