Skip to content

Vector Trigonometric Cos

COS calculates the cosine of a value.

Method

tm.ta.cos(source)

Inputs

ParameterArgument typeDescriptionDefault Value
sourcepd.SeriesInput data series-

Outputs

OutputType
cosnp.ndarray

Example usage

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