← Script Marketplace
Open-source scriptindicator/v1

Ultimate Oscillator

by Kodexius·@kodexius·

Blend short, medium, and long buying-pressure averages into one bounded momentum measure.

#momentum#oscillator#ultimate-oscillator
Ultimate Oscillator chart preview

Description

The Ultimate Oscillator combines buying pressure over three lookback periods with progressively smaller weights. Using multiple horizons reduces dependence on a single cycle length while preserving a zero-to-100 momentum scale.

Open-source script. Everyone can inspect the source code, use the script on a chart, and save an editable copy.

Release notes

Version history · 1 published version

Version 1CurrentChart updatedUltimate Oscillator · Aug 31, 2026
Release notes

Initial classic indicator release.

View current source ↓
Source codempl-2.0View source

indicator("Ultimate Oscillator", { overlay: false });
const shortLength = input.int("Short Length", 7, { min: 1, max: 100 });
const middleLength = input.int("Middle Length", 14, { min: 2, max: 200 });
const longLength = input.int("Long Length", 28, { min: 3, max: 500 });
const buyingPressure = close.map((c, i) => i === 0 ? NaN : c - Math.min(low[i], close[i - 1]));
const trueRange = close.map((_, i) => i === 0 ? NaN : Math.max(high[i], close[i - 1]) - Math.min(low[i], close[i - 1]));
const average = (i, length) => {
  if (i < length) return NaN;
  let pressure = 0;
  let rangeTotal = 0;
  for (let j = i - length + 1; j <= i; j++) {
    pressure += buyingPressure[j];
    rangeTotal += trueRange[j];
  }
  return rangeTotal === 0 ? 0.5 : pressure / rangeTotal;
};
const line = close.map((_, i) => {
  const shortAverage = average(i, shortLength);
  const middleAverage = average(i, middleLength);
  const longAverage = average(i, longLength);
  return 100 * (4 * shortAverage + 2 * middleAverage + longAverage) / 7;
});
plot(line, { title: "UO", color: "#7c4dff", lineWidth: 2 });
hline(70, { title: "Upper", color: "#ef5350", style: "dashed" });
hline(30, { title: "Lower", color: "#26a69a", style: "dashed" });
  

Community discussion

0 comments

Loading…

No comments yet. Start the discussion.