Stochastic Fast
STOCHF is a fast version of the Stochastic oscillator.
Method
Section titled “Method”tm.ta.stochf(source_high, source_low, source_close, fastk_period, fastd_period, fastd_matype)Inputs
Section titled “Inputs”| Parameter | Argument type | Description | Default Value |
|---|---|---|---|
| source_high | pd.Series | High prices series | - |
| source_low | pd.Series | Low prices series | - |
| source_close | pd.Series | Close prices series | - |
| fastk_period | int | Fast %K period for the indicator | 5 |
| fastd_period | int | Fast %D period for the indicator | 3 |
| fastd_matype | int | Fast %D Moving Average type | 0 |
Outputs
Section titled “Outputs”| Output | Type |
|---|---|
| fastk | np.ndarray |
| fastd | np.ndarray |
Example usage
Section titled “Example usage”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)