自訂與社群 MomentumNot built inOverbought/Oversold 在 Builder 中可用

Ultimate Oscillator

Larry Williams' answer to picking a period: measure buying pressure over 7, 14 and 28 bars at once and blend them 4:2:1. The blend pulls the readings towards the middle, so its 70/30 is a far rarer event than RSI's — measured, 1.13% of bars against 4.94%. The version MetaTrader ships matches the textbook exactly, and only because MetaTrader's ATR does not.

Default
7 / 14 / 28
Weights
4 : 2 : 1
RSI-equivalent bands
65 / 35
Bars where the Ultimate Oscillator crosses back above 35 in an uptrend70 / 30 — RSI leaves this band four times as oftenUltimate Oscillator(7,14,28) against RSI(14) — same scale, same lines

示意性 — 合成資料,非即時報價。

What the Ultimate Oscillator tells you

Every oscillator with a single period forces one choice: how many bars count as 'recently'. Larry Williams' answer in 1976 was to refuse the choice and measure three horizons at once — 7, 14 and 28 bars — then blend them with the shortest weighted four times as heavily as the longest. What gets measured on each horizon is buying pressure: how much of the bar's true range the close finished above its true low, summed over the window and divided by the summed range. Because buying pressure can never be negative and can never exceed the true range, the result sits between 0 and 100 with no normalisation step anywhere in the formula. The blending has a consequence that is easy to miss and expensive to ignore: three averaged horizons vary less than one, so the same 70 and 30 lines that RSI reaches several times a month are, here, near the edge of the distribution. Measured on identical series, price spent 4.94% of its time above 70 on RSI(14) and 1.13% on this.

  • Three periods at once, so no single lookback has to be right
  • Bounded 0–100 by construction, not by a normalisation step
  • The 70/30 lines mean something four times rarer here than on RSI
  1. 1 For each bar, measure buying pressure — the close above its true low — and the true range
  2. 2 Sum both over 7, 14 and 28 bars, and take the ratio on each horizon
  3. 3 Blend the three ratios 4:2:1 and multiply by 100
顯示公式與計算詳情

MetaTrader has no iUltimate, but it does ship an Ultimate_Oscillator.mq5 under Indicators/Examples — and that file does not write the formula the way the textbook does.

textbook  : 100 * ( 4*S(BP,7)/S(TR,7) + 2*S(BP,14)/S(TR,14) + S(BP,28)/S(TR,28) ) / 7      S = window sum
bundled   : 100 * ( 4*SMA(BP,7)/iATR(7) + 2*SMA(BP,14)/iATR(14) + SMA(BP,28)/iATR(28) ) / 7

BP = close - min(low, prevclose)                 <- buying pressure
TR = max(high, prevclose) - min(low, prevclose)   <- true range

One sums; the other averages and divides by ATR. They agree anyway — measured over 3,000 bars on each of twenty series, the largest disagreement was 6.1e-13, which is floating-point rounding. The reason is that SMA(x,N) is S(x,N)/N, so the N cancels provided iATR is the N-bar mean of true range. It is: ATR.mq5 computes ATR[i] = ATR[i-1] + (TR[i] - TR[i-N])/N, a running window sum seeded with the mean of the first N bars.

Which leads to the part worth stating plainly:

The bundled Ultimate Oscillator matches the textbook because MetaTrader’s ATR does not.

Wilder’s ATR — the one nearly every description of ATR gives — smooths as (prev*(N-1) + TR)/N, which is not an N-bar mean and would not cancel. Substituting it into the bundled formula:

                 mean |diff|     max |diff|     correlation
fx-quiet            2.349          15.143         0.9488
fx-busy             2.306          14.108         0.9489
index               2.365          16.012         0.9472
crypto              2.315          16.803         0.9505

The departure from the textbook in one indicator is what keeps this one faithful to it.

The 70 and 30 lines are not RSI’s

Both scales run 0–100. Both are conventionally drawn with the same two lines. Applied to identical series:

                  mean     sd     above 70    below 30    up-crossings of 70
UO(7,14,28)      50.23    8.97      1.13%       1.08%            328
RSI(14)          50.48   11.69      4.94%       4.21%            814
Stoch %K(14)     50.75   30.32     33.50%      31.57%          4,193

Averaging three horizons averages away the extremes, so the same number is an order of magnitude rarer here. Measured percentiles: p1 = 29.8, p5 = 35.3, p50 = 50.2, p95 = 65.0, p99 = 70.4 — the 70 line sits at the 99th percentile.

Rather than argue about which threshold is right, the occupancy can be matched. Solving for the bands that leave the same fraction of bars outside them as RSI(14)‘s 70 and 30 gives 65.1 and 34.6, which is where the template’s 65/35 comes from.

The weights only exist while the periods differ

weights        sd      corr to 4:2:1    up-crossings of 70    down-crossings of 30
4:2:1        9.125         1.0000               16                    23
1:1:1        7.631         0.9792                2                     2
7 only      11.835         0.9705               62                    70
28 only      5.904         0.6658                0                     0

Set all three periods equal, though, and every one of those differences disappears: with 14/14/14, the weightings 4:2:1, 1:1:1 and 9:0:0 agree to 1.4e-14. A weighted average of three identical numbers is that number, so the blend collapses into a single window-summed ratio — correlation 0.835 with Stochastic %K(14). It is an easy way to switch half the indicator off without noticing.

True low, and why gaps decide whether it matters

Buying pressure is measured from min(low, prevclose) rather than from the low. On series with no gaps, the distinction is exactly invisible:

gapping bars      mean |diff|     max |diff|
      0%             0.000          0.000
      5%             4.575         38.505
     15%             8.875         44.436
     30%            10.701         48.745

An implementation that reads the bar’s own low is the same indicator on continuous FX and a different one on anything that opens away from its previous close.

Two smaller properties, both measured. The 0–100 range is structural rather than enforced: across 59,980 bars with 20% gapping and triple-width wicks, buying pressure was never negative and never exceeded true range, so no clamping is needed anywhere. And warm-up is the slow period exactly — readings from a truncated history match a full-history baseline from bar 28, because window sums forget everything outside the window. The Wilder-denominator variant needed 889 bars for the same guarantee.

訊號

UO 提供的可回測訊號 — 及每個訊號適合的市場狀態。

Threshold cross

Builder 可實現
條件
The oscillator crosses back above the lower band (mirrored for shorts)
最佳市場狀態
Either regime
典型用法
The template's entry — using 35/65 rather than 30/70, for reasons the measurements below make concrete

Fifty cross

Builder 可實現
條件
The oscillator crosses 50, where buying and selling pressure balance
最佳市場狀態
Trending
典型用法
A slower, more symmetric read than the bands, and the level that survives changing the weights

Williams' three-part divergence

進階邏輯
條件
Price makes a lower low, the oscillator does not, and the oscillator then exceeds the high of the divergence
最佳市場狀態
Ranging
典型用法
The original 1976 rule. The third condition is what makes it a rule rather than an observation, and also what makes it hard to automate

Agreement across timeframes

人工判讀
條件
The oscillator is on the same side of 50 on two timeframes
最佳市場狀態
Trending
典型用法
Redundant here in a way it is not for single-period oscillators — the blend already spans horizons

MT5 實作

MetaTrader 5 實際計算與繪製的內容——本頁每條規則的依據。

平台說明

最佳適用場景 / 謹慎使用

沒有任何指標具有普適優勢。以下是 UO 發揮作用的場景 — 以及可能誤導的場景。

最佳適用場景

  • Thresholds re-measured on the instrument rather than carried over from RSI habits
  • Markets that gap, where the true-low definition is doing real work
  • Setups where a single lookback would have to be chosen and defended
  • Divergences, which compare the oscillator against itself and need no threshold at all

謹慎使用

  • The 70/30 lines — measured, price is above 70 only 1.13% of the time, so rules built on them fire rarely
  • Changing the periods to be equal, which silently deletes the weighting entirely
  • Reading it as a faster RSI: measured correlation to RSI(14) is 0.89, close to its 0.90 with Stochastic %K
  • Assuming the weights are tunable inputs — they are fixed at generation time on purpose

構建 UO 策略

將訊號接入進場和出場規則,然後匯出可編譯的 MT5 EA — 無需撰寫程式碼。

  1. One Ultimate Oscillator node at 7 / 14 / 28 weighted 4:2:1, read on the last closed bar
  2. Constants of 35 and 65 for it to be crossed against, upward and downward
  3. A 50-period EMA compared against the Bid, feeding both directions
  4. Cross up through 35 while price is above the average → Close short, then Open Buy · SL 50 / TP 120
  5. Cross down through 65 while price is below it → Close long, then Open Sell, mirrored

將 UO 與其他指標組合

單一指標很少獨立有效。這些組合彌補了 UO 的盲點。

UO + RSI

  1. Ultimate Oscillator
  2. RSI
  3. And gate
原因
The pairing to understand before any other, because the numbers look identical and are not. Both run 0–100 and both are drawn with 70 and 30 lines, but the blend of three horizons compresses this one towards the middle. Measured across the same twenty series: time spent above 70 was 1.13% here against 4.94% for RSI(14), and upward crossings of 70 numbered 328 against 814. Solving for the bands that give this oscillator the same occupancy as RSI's 30 and 70 lands on 34.6 and 65.1 — which is where the template's 35/65 comes from. Running both is defensible, but only after the thresholds have been re-measured; running them on the same numbers means one of the two is doing nothing
最佳市場狀態
Either regime

Add an RSI node beside this one and gate on both — with different threshold values on each.

開啟 Builder →

UO + Stochastic

  1. Ultimate Oscillator
  2. Stochastic
  3. And gate
原因
Structurally these are cousins: both ask where the close sits inside a recent range. Stochastic measures the position of the close within the high–low range of the last N bars; this one measures the close within the true range of each bar and then sums. The sums are what separate them — measured correlation is 0.90, but Stochastic %K(14) spent 33.50% of its time above 70 against 1.13% here, because a single bar's position can sit at the extreme while a 28-bar sum of ratios cannot. Reading them together is a way to see a stretched bar inside an unstretched window
最佳市場狀態
Ranging

No shipped template pairs them; add a Stochastic node and gate on both.

開啟 Builder →

UO + Moving Average

  1. Ultimate Oscillator
  2. Moving average
  3. And gate
原因
The template's pairing. The oscillator says the market has stopped falling; the 50-period average says which direction that pause is happening in. Without the filter the same crossing appears in both directions and the rule has no view — with it, the rarity of the signal becomes an advantage rather than a problem, because the few that survive point the same way as the longer trend. Measured, upward crossings of the lower band are rare enough that a filter that halves them still leaves a workable count
最佳市場狀態
Trending

This is the shipped template — the oscillator node, two constants, a 50-period EMA and Compare nodes against price.

開啟 Builder →

UO + ATR

  1. Ultimate Oscillator
原因
Not a pairing on the chart but a dependency worth knowing about. The Ultimate_Oscillator.mq5 that ships with MetaTrader does not sum true range — it divides by iATR instead. That only reproduces the textbook because MetaTrader's iATR is a plain N-bar simple average rather than Wilder's smoothing, so the N cancels out of the ratio. Measured, the two agree to 6.1e-13; substituting a genuine Wilder ATR into the same code moves the reading by 2.3 points on average and 16.8 at worst. The ATR page is where that smoothing is measured
最佳市場狀態
Either regime

Nothing to wire — the Builder's node sums true range directly, so no ATR node is involved.

開啟 Builder →

參數

在您自己的貨幣對和時間框架上驗證的起始值 — 非保證設置。

參數 預設值 建議測試範圍 功能說明
Fast period 7 1–999 The shortest horizon, and the one carrying four sevenths of the weight. It is what makes the blend react at all: measured, running the fast period alone produced 62 upward crossings of 70 where the full 4:2:1 blend produced 16 and a flat 1:1:1 blend produced 2. Shortening it further sharpens the response and starts to reintroduce the noise the blend exists to suppress.
Middle period 14 1–999 The middle horizon at two sevenths. Williams' three periods double at each step, which is what makes them span rather than cluster — the value of the blend comes from the horizons disagreeing. Setting all three equal is the degenerate case: measured, with 14/14/14 the weights stop mattering entirely, and 4:2:1, 1:1:1 and 9:0:0 agree to 1.4e-14.
Slow period 28 1–999 The longest horizon at one seventh, and the one that decides warm-up. Measured against a full-history baseline, the value is exact from the slow period onwards — 28 bars — because the window sums carry nothing forward. That is worth contrasting with the bundled implementation's dependence on ATR: had the denominator been a Wilder average, the same test needed 889 bars to agree exactly.
Fast / Middle / Slow weight 4 / 2 / 1 0–100 each How much each horizon counts, normalised by their sum. These are fixed when the EA is generated rather than exposed as inputs, because changing the balance of horizons changes what the indicator is rather than how it is tuned. Measured, flattening 4:2:1 to 1:1:1 cut upward crossings of 70 from 16 to 2 while reducing the standard deviation from 9.13 to 7.63 — a genuinely different instrument, not a re-tuned one. Note that the weights only do anything while the periods differ.
Shift 1 0–100 Which bar the reading is taken from. The template uses 1 so the crossing is judged on a closed bar. With shift 0 the current bar's close moves with every tick, and since the close enters both the numerator and the denominator of the newest term, a threshold crossing can appear and vanish inside a single bar.
Timeframe Current Current / M1–MN1 Which series is sampled. Because the blend already spans a four-fold range of horizons, reading it on a second timeframe adds less than it does for a single-period oscillator — a 28-bar horizon on H1 already reaches further than a 7-bar horizon on H4.

初始預設

Template 7 / 14 / 28 at 4:2:1, bands at 35 / 65 Williams' periods with thresholds re-measured to RSI-equivalent rarity
Original 7 / 14 / 28 at 4:2:1, bands at 30 / 70 The 1976 settings. Measured, price is beyond these bands about 1.1% of the time
Single horizon Any period repeated three times Collapses to one window-summed ratio, and the weights stop having any effect at all

市場示例

UO 有效的場景、失效的場景,以及篩選器如何改變結果。

有效

The recovery through the lower band with the trend behind it

The oscillator crosses back above 35 while price is already above its 50-period average. Because readings below 35 occupy only about 5% of bars, the crossing is infrequent by construction — the filter is what decides which of the few are taken.

失效

The band that is never reached

A stretch of falling price where the oscillator bottoms near 38 and turns without touching 30. Measured, the 30 line is crossed downward 295 times where RSI's is crossed 740 times on the same series — a rule waiting at 30 sits out moves that a rule waiting at 35 trades.

已篩選

The gap that changes the reading

A bar opening well away from the previous close. Buying pressure is measured from the true low, which is the previous close here rather than the bar's own low — measured on gapping series, ignoring that distinction moves the reading by 8.9 points on average and 44.4 at worst.

FAQ

Is the Ultimate Oscillator built into MetaTrader 5?
There is no iUltimate function, so an EA cannot create a handle to it directly. The terminal does ship `Ultimate_Oscillator.mq5` under `Indicators/Examples`, so it appears in the Navigator and can be reached with iCustom. The Builder's node computes it from the high, low and close instead, which needs no external file.
Why three periods instead of one?
So that no single lookback has to be correct. A 7-bar oscillator and a 28-bar one disagree about the same market, and Williams' proposal was to hold all three views at once with the shortest weighted most heavily. Measured, the blend behaves like neither extreme: standard deviation 9.13 against 11.84 for the fast period alone and 5.90 for the slow alone.
Should I use 70/30 like on RSI?
Not without re-measuring. The same numbers are much rarer here — measured, price spent 1.13% of bars above 70 against 4.94% for RSI(14), and 70 sits at this oscillator's 99th percentile. Bands of 65 and 35 give the same rate of signals as RSI's 70 and 30, which is what the template uses.
Does MetaTrader's version match the textbook?
Yes, to 6.1e-13 — but for an interesting reason. The bundled source divides by iATR rather than summing true range, and that only reproduces the textbook because iATR is a plain N-bar mean, so the N cancels. Put a genuine Wilder ATR in the same place and the readings drift apart by 2.3 points on average and 16.8 at worst.
What is buying pressure?
The distance from the close down to the true low, where the true low is the lower of this bar's low and the previous close. Dividing it by the true range asks what fraction of the bar's total movement finished as buying. It cannot be negative and cannot exceed the range, which is why the oscillator is bounded 0–100 without any normalisation step.
Why does it use the previous close rather than the bar's low?
So that gaps are measured rather than skipped. If a bar opens far below the previous close and closes back near it, the recovery is real buying pressure that the bar's own low would not show. Measured, on series where 15% of bars gap, using the bar's low instead moved the reading by 8.9 points on average and 44.4 at worst; with no gaps the two are identical.
Can I change the weights?
In the Builder, yes — they are node properties, though they are fixed into the generated EA rather than exposed as runtime inputs, because changing them changes what the indicator is. Measured, flattening 4:2:1 to 1:1:1 dropped upward crossings of 70 from 16 to 2. One caveat: the weights do nothing at all if the three periods are equal, where they agree to 1.4e-14.
How much history does it need?
The slow period, and then it is exact. Measured against a full-history baseline, the readings agree exactly from bar 28 onwards, because window sums forget everything outside the window. A variant built on Wilder smoothing needed 889 bars for the same guarantee — recursion is what makes warm-up long.
How is it different from Stochastic?
Both ask where the close sits inside a recent range. Stochastic takes the position of the close within the high–low range of the last N bars; this one takes the close within each bar's true range and sums over three windows. Measured correlation is 0.90, but Stochastic %K(14) spent 33.50% of its time above 70 against 1.13% here — the summing is what makes extremes rare.
Can I build this without coding?
Yes. The template is one Ultimate Oscillator node at 7/14/28 weighted 4:2:1 on the closed bar, two constants at 35 and 65, two Cross nodes for the two directions, a 50-period EMA with two Compare nodes against the Bid, two And gates, two Close nodes wired ahead of the entries, and Open Buy / Open Sell on a fixed lot. The compiled EA exposes the three periods, stop distances, lot size and maximum spread as inputs.

Glossary

關鍵術語