Skip to content

Typical Price

TYPPRICE calculates the typical price (average of high, low, and close).

Method

tm.ta.typprice(source_high, source_low, source_close)

Inputs

ParameterArgument typeDescriptionDefault Value
source_highpd.SeriesHigh prices series-
source_lowpd.SeriesLow prices series-
source_closepd.SeriesClose prices series-

Outputs

OutputType
typpricenp.ndarray

Example usage

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