Appearance
Ultimate Oscillator
Weighted buying pressure over three lookbacks, 0 to 100.
Kind indicator · Drawn in its own pane
Try it
On the chart, press / and choose Ultimate Oscillator under Oscillators. To change it, copy the source below into the AlphaScript editor.
Inputs
| Input | Type | Default |
|---|---|---|
| Fast length | int | 7 |
| Middle length | int | 14 |
| Slow length | int | 28 |
| Color | color | "#F23645" |
Source
From packages/alphascript/indicators/uo.as.js.
js
indicator({ name: "Ultimate Oscillator", shortTitle: "UO", overlay: false, precision: 2 });
const fast = input.int("Fast length", 7, { min: 1 }), middle = input.int("Middle length", 14, { min: 1 }), slow = input.int("Slow length", 28, { min: 1 });
const bp = ta.calc([candle.close, candle.low], (c, l) => c - math.min(l, candle.close.at(1)));
const tr = ta.calc([candle.high, candle.low], (h, l) => math.max(h, candle.close.at(1)) - math.min(l, candle.close.at(1)));
/** @param {number} n */
const avg = (n) => ta.calc([ta.sum(bp, n), ta.sum(tr, n)], (b, t) => b / t);
plot(ta.calc([avg(fast), avg(middle), avg(slow)], (a, b, c) => (100 * (4 * a + 2 * b + c)) / 7), { title: "UO", color: input.color("Color", "#F23645", { group: "Style" }) });