Skip to content

Ultimate Oscillator

ULTOSC combines multiple timeframes to identify overbought and oversold conditions.

Method

tm.ta.ultosc(source_high, source_low, source_close, timeperiod1, timeperiod2, timeperiod3)

Inputs

ParameterArgument typeDescriptionDefault Value
source_highpd.SeriesHigh prices series-
source_lowpd.SeriesLow prices series-
source_closepd.SeriesClose prices series-
timeperiod1intFirst time period7
timeperiod2intSecond time period14
timeperiod3intThird time period28

Outputs

OutputType
ultoscnp.ndarray

Example usage

strategy.py
import tradomate as tm
@tm.strategy()
def my_strategy(config: tm.TradomateConfig, data: tm.TradomateData):
# Trying out Ultimate Oscillator
ultosc = tm.ta.ultosc(data.high, data.low, data.close, timeperiod1=7, timeperiod2=14, timeperiod3=28)
# Get the last value and print
last_value = ultosc.iloc[-1]
tm.log(f"Last value of Ultimate Oscillator is {last_value}")
# Plot the values of ultosc
tm.plot(ultosc, title="Ultimate Oscillator", overlay=False)