ForexBestRobots.comCompare EAs →
EN

Momentum strategies · Forex strategy

GBP/USD H4 Williams %R Strategy: −80/−20 Returns, EMA(50) and a Real-Data Test

Test fresh Williams %R(14) returns with a frozen EMA(50) filter, ATR stops, a 2R target and a full minute-quote ledger. Compare the filter with the unfiltered control after costs.

Actual Forexite GBP/USD H4 quote candles, EMA(50), Williams %R(14), and the frozen model's entry E, exit X, stop S and target T.
Actual Forexite GBP/USD H4 quote candles, EMA(50), Williams %R(14), and the frozen model's entry E, exit X, stop S and target T.

A return from a Williams %R extreme can define a signal, but it does not establish an edge. We froze the rules before replaying January–February 2024 GBP/USD quotes. At a hypothetical 1.2-pip transaction allowance, the EMA-filtered version takes 8 trades and totals −0.556444R; the control takes 22 trades and totals −0.109531R. Here the filter worsens the R result. Inspect every trade and change the allowance without changing the recorded entries.

1. The question this replay tests

Does requiring price and the slope of EMA(50) to agree with a Williams %R return improve this fixed model? We run two independent variants: Williams %R return only, and the same return with the EMA filter. Both begin at H4 index 50, use the same risk and exit rules, and allow one position at a time. The periods, levels, filters, holding cap and cost scenarios were fixed before the first replay; no parameter search was performed.

2. Actual quotes, group boundaries and warm-up

The source contains 61 972 original four-decimal GBP/USD minute records from 60 Forexite daily archives. We convert winter CET to UTC and group timestamps in (end − 4 hours, end], ending at 00:00, 04:00, 08:00, 12:00, 16:00 and 20:00 UTC. Labels identify group ends. There are 266 H4 groups, including 17 short or sparse groups; missing prices are never filled.

Execution uses 61 792 observed minute records through the last included H4 endpoint, 2024-02-29 20:00 UTC. The later source-boundary fragment is excluded. Both variants wait until index 50 so current and previous EMA(50), Williams %R and ATR are available. Broker H4 boundaries may differ. Source timestamps and modeled fills do not establish a broker's actual execution time.

One pip is 0.0001 USD per GBP in this model. The source has four decimal places; a broker’s smallest platform point may use a different convention.

3. Define the fresh Williams %R(14) return

Williams %R(14) locates the latest Close inside the highest High and lowest Low of the current 14 completed groups: −100 × (HH14 − Close)/(HH14 − LL14). The scale runs from −100 to 0. If HH14 equals LL14, this model leaves the value unavailable, as in the companion guide. A crossing involving an unavailable current or previous value is skipped; values are never carried across a flat window.

A long signal requires previous %R ≤ −80 and current %R > −80. A short requires previous %R ≥ −20 and current %R < −20. Current equality does not complete a crossing. A jump may pass the opposite threshold too; we add no hidden condition that the new value remain between −80 and −20. Signals use completed groups only.

A rolling extreme can leave the window and move %R even without a corresponding reversal in Close. This is a range-location event, not proof that price has reversed. No additional price-pattern confirmation is silently added.

Williams %R = −100 × (HH14 − C) / (HH14 − LL14)
Long: previous %R ≤ −80 and current %R > −80
Short: previous %R ≥ −20 and current %R < −20

4. Apply the fixed EMA(50) filter

For a long, the signal Close must exceed EMA(50) of Close and the current EMA must exceed its previous value. For a short, Close must be below EMA(50) and the EMA must be falling. Equality fails the filter. The control run ignores these two trend conditions but retains the shared warm-up and all execution rules.

EMA(50) uses Close and α = 2/51. Seed it at index 49 with the mean of the first 50 Closes; then EMA = previous EMA + (Close − previous EMA) × 2/51. Start both runs at index 50, when current and previous EMA exist. Do not restart the seed when scrolling. Price above EMA and a rising EMA agree algebraically for this update; they are not two independent confirmations.

Each variant has its own one-position schedule. Removing a filter can open an earlier position and make a later signal unavailable. Consequently, the filtered trade list is not guaranteed to be a subset of the control list. Compare the complete ledgers rather than pairing trades only by their row numbers.

5. Enter on the next observed minute and freeze risk

At the signal endpoint, the variant must be flat. Entry is the Open of the first observed minute strictly after that endpoint, at most five minutes later. An older signal is discarded; it is not queued for a later group. A signal occurring while a position is open is rejected even if that position exits in the next minute.

Wilder ATR(14) starts with the mean of TR transitions 1–14 at index 14, then uses (previous ATR × 13 + current TR)/14. TR includes gaps from the previous Close. Initial risk is ceil(1.5 × ATR in pips), rounded upward to a whole pip to match the four-decimal quote grid. Freeze this distance at the signal. Place a 1R stop and a 2R target relative to the next-minute entry Open. There is no trailing stop or break-even adjustment.

risk_pips = ceil(1.5 × ATR14_pips)
Long: S = E − risk; T = E + 2 × risk
Short: S = E + risk; T = E − 2 × risk

6. Resolve gaps, minute touches and the holding cap

For each observed minute, an Open beyond the stop exits at that Open; an Open through the target exits at the target without favorable gap improvement. Next, if the holding cap is due, exit at Open. Otherwise inspect the minute High and Low: touching a level counts; if both levels occur in the same minute, assume the stop first. Entry-minute touches also count. Stop/target timestamps identify a minute record, not an observed execution second.

The cap is the first observed minute strictly after the sixth H4 endpoint following the signal. Six observed groups can span more than 24 elapsed hours across a market closure. If a position survives the study boundary, close at the last included minute Close and flag sample_end. This sample has no such exits and no both-level minutes. The model has no signal-based exit, scaling or simultaneous positions within a variant.

7. Separate transaction allowance from observed costs

We deduct a hypothetical round-trip allowance once per closed trade: 0.0, 1.2 or 2.4 pips. Net R = (gross pips − allowance pips)/initial risk pips. The journal also permits 0.0–5.0 pips in 0.1 steps. Changing it updates net accounting only; the trades, entry quotes, stop and target remain fixed.

The allowance is not a reconstructed spread or commission. No historical Ask, spread, slippage or broker fills are supplied, and holding financing is excluded. A weekend position could therefore incur an additional unmodeled cost. A live evaluation must supply its own execution and financing data; these results are after the selected transaction allowance, not after every possible trading cost.

8. Read the complete two-variant result

At 1.2 pips, the control has 22 trades and 8 positive net-R outcomes: +31.6 net pips but −0.109531R. The EMA-filtered version has 8 trades and 3 positives: +4.4 net pips but −0.556444R. The filter reduces trade count and worsens the R result in this sample. Neither variant has positive R expectancy after this allowance.

For the filtered version, net-R profit factor is 0.832042 and maximum closed-trade drawdown is 2.060847R. Its sum is already −0.337291R without the allowance and becomes −0.775597R at 2.4 pips. The control has two exactly flat gross-pip trades at zero allowance; both become losses after a positive allowance. These are model statistics, not an account return or a forecast.

Rule setRound-trip transaction allowance (pips)Closed tradesTrades with positive net RNet pipsSum of net RProfit factor in net RMaximum closed-trade drawdown (R)
Williams %R return only0.022858.00.4843661.0652623.069860
Williams %R return only1.222831.6-0.1095310.9859763.301626
Williams %R return only2.42285.2-0.7034290.9142013.533392
Williams %R return + EMA(50)0.08314.0-0.3372910.8936422.000000
Williams %R return + EMA(50)1.2834.4-0.5564440.8320422.060847
Williams %R return + EMA(50)2.483-5.2-0.7755970.7754942.121694

9. Why positive pips can accompany negative R

Pips assign equal weight to each pip; R divides each trade by its own initial stop distance. Filtered risks range from 38 to 59 pips. Therefore +4.4 net pips can accompany −0.556444R. A positive pip sum does not show a positive fixed-risk outcome, and the EMA filter cannot be credited with an improvement that the R comparison does not show.

One R equals the initial stop distance of that trade. We do not infer an account balance, a percentage return, lot rounding, compounding or portfolio exposure. Those require a separate sizing model. Profit factor in the table is calculated from positive versus negative net R; drawdown is the decline from the cumulative closed-R peak, starting at zero.

10. Inspect month splits and rejected signals

At 1.2 pips, the filtered run has 2 January-entry trades totaling −1.170087R and 6 February-entry trades totaling +0.613643R. Entry-month groups describe this same sample; they are not independent validation or a held-out test. Positions may exit in a different month or span a weekend.

There are 37 fresh return events per variant. Three precede shared eligibility. The filtered run accepts 8, rejects 20 for trend and 6 while busy. The control accepts 22 and rejects 12 while busy. The declared rejection priority matters: an event rejected while busy is not also counted as a trend rejection.

Williams %R return + EMA(50) · 1.2 pips
Entry monthClosed tradesSum of net R
2024-012-1.170087
2024-0260.613643

11. Follow two examples chosen by chronology

The first filtered trade signals a short at 2024-01-18 16:00 UTC: %R moves from −17.757009 to −28.971963 and EMA(50) is falling. Entry is 1.2672 at 16:01 UTC. ATR is 33.273320 pips, so risk is 50 pips, stop 1.2722 and target 1.2572. The holding cap exits at 1.2678 on 2024-01-19 16:01 UTC: −6 gross pips and −0.144000R after 1.2 pips.

The first February-entry filtered trade opens a short at 1.2655 on 2024-02-02 16:01 UTC, with 59-pip risk, stop 1.2714 and target 1.2537. The six-group cap spans the weekend and exits at 1.2572 on 2024-02-05 12:01 UTC: +83 gross pips and +1.386441R after the allowance, before financing. The examples are selected by chronology, not return; all five filtered losses remain in the journal.

Actual Forexite GBP/USD H4 quote candles, EMA(50), Williams %R(14), and the frozen model's entry E, exit X, stop S and target T.
First accepted filtered trade, chosen before inspecting its return. E marks the modeled entry at the first later minute Open; X marks the time-cap exit record. S is the fixed stop and T the 2R target. Candles use actual completed H4 quote groups through the exit; the last fractional group is not invented. Market closures are compressed. Green/red candles show price movement, not a trade recommendation.
Actual Forexite GBP/USD H4 quote candles, EMA(50), Williams %R(14), and the frozen model's entry E, exit X, stop S and target T.
First filtered trade with a February entry, selected by date. The six-group cap spans a weekend. E and X identify minute records; S and T are model levels. The chart ends at the exit and does not add later H4 candles. Financing is not included in the transaction allowance.

12. Inspect every trade and change the transaction allowance

Start with a rule set and an allowance. The totals describe that entire variant; the trade selector and Previous / Next choose one row of its journal. The chart marks that row's fixed E, X, S and T. Changing the allowance recalculates net values and leaves trade selection and model fills unchanged.

13. What to validate before using the rule elsewhere

The independent replay agrees on all signal decisions and 30 trades across the two variants. That checks implementation, not trading merit. Eight filtered trades and two months cannot establish a durable edge. Next evidence would require frozen rules on additional periods and feeds, observed execution costs and financing, realistic sizing and a separate forward test. Do not retune this sample's threshold or filter and present the revised result as independent confirmation.

Frequently asked questions

Did the EMA filter make this strategy profitable?

No. At 1.2 pips, the EMA-filtered 8 trades total −0.556444R versus −0.109531R for 22 control trades. The filter performs worse in R in this sample. Fewer trades and positive net pips do not establish a trading edge.

Why are net pips positive while net R is negative?

Pips have equal weight; R divides each trade by its own initial risk. Filtered risks vary from 38 to 59 pips, so +4.4 net pips and −0.556444R use different weightings. Neither number is an account percentage return.

Does changing the allowance rerun entries?

No. It changes only the net accounting of the same recorded trades. The base comparisons use 0.0, 1.2 and 2.4 pips; historical spread and financing are not reconstructed.

Are the displayed exit times exact broker fills?

No. Stop/target times identify the source minute record. The model handles gaps and assumes stop first if both levels occur in one minute. Its quotes do not reveal tick order or actual broker execution.

Data, timing and reproducibility

The download preserves the 61 972 source minute records and provenance for 60 original Forexite archives, including URLs and original SHA-256 hashes. Source OHLC retain four decimal places. This release verified the saved source package's internal hashes and reproduced the calculation from its unchanged minute CSV.

The replay uses 61 792 minute records through 2024-02-29 20:00 UTC, with 266 H4 groups and 17 short or sparse groups. It supplies all signals and rejection reasons, every trade in both variants, fixed protocol, indicator history and independent numerical checks. Nothing is presented as an observed Ask or historical spread.

The rules were frozen before the first replay. The ZIP includes offline reproduction and a separate Decimal70, minute-by-minute verification. The public CSV lists all 30 trades across the two independent variants. These are educational model records, not a combined portfolio or a broker statement.

Sources