Skip to content

Stochastic Fast

STOCHF is a fast version of the Stochastic oscillator.

Method

tm.ta.stochf(source_high, source_low, source_close, fastk_period, fastd_period, fastd_matype)

Inputs

ParameterArgument typeDescriptionDefault Value
source_highpd.SeriesHigh prices series-
source_lowpd.SeriesLow prices series-
source_closepd.SeriesClose prices series-
fastk_periodintFast %K period for the indicator5
fastd_periodintFast %D period for the indicator3
fastd_matypeintFast %D Moving Average type0

Outputs

OutputType
fastknp.ndarray
fastdnp.ndarray

Example usage

strategy.py
import tradomate as tm
@tm.strategy()
def my_strategy(config: tm.TradomateConfig, data: tm.TradomateData):
# Trying out Stochastic Fast
fastk, fastd = tm.ta.stochf(data.high, data.low, data.close, fastk_period=5, fastd_period=3, fastd_matype=0)
# Get the last value and print
last_value = fastk.iloc[-1]
tm.log(f"Last value of Stochastic Fast is {last_value}")
# Plot the values of fastk
tm.plot(fastk, title="Stochastic Fast", overlay=False)