# Ultimate oscillator

The ultimate oscillator is a theoretical concept in finance developed by Larry Williams as a way to account for the problems experienced in most oscillators when used over different lengths of time.

The oscillator is a technical analysis indicator based on a notion of buying or selling "pressure" represented by where a day's closing price falls within the day's true range.

The calculation starts with "buying pressure", which is the amount by which the close is above the "true low" on a given day. The true low is the lesser of the given day's trading low and the previous close.

$bp=close-\min(low,prev\,close)$ The true range (the same as used in average true range) is the difference between the "true high" and the true low above. The true high is the greater of the given day's trading high and the previous close.

$tr=\max(high,prev\,close)-\min(low,prev\,close)$ The total buying pressure over the past 7 days is expressed as a fraction of the total true range over the same period. If $bp_{1}$ is today, $bp_{2}$ is yesterday, etc., then

$avg_{7}={bp_{1}+bp_{2}+\cdots +bp_{7} \over tr_{1}+tr_{2}+\cdots +tr_{7}}$ The same is done for the past 14 days and past 28 days and the resulting three ratios combined in proportions 4:2:1, and scaled to make a percentage 0 to 100. The idea of the 7-, 14- and 28-day periods is to combine short, intermediate and longer time frames.

$UltOsc=100\times {4\times avg_{7}+2\times avg_{14}+avg_{28} \over 4+2+1}$ 