Minus Directional Indicator
MINUS_DI measures the strength of downward price movement.
Method
tm.ta.minus_di(source_high, source_low, source_close, timeperiod)
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 | - |
timeperiod | int | Number of periods for the indicator | 14 |
Outputs
Output | Type |
---|---|
minus_di | np.ndarray |
Example usage
import tradomate as tm
@tm.strategy()def my_strategy(config: tm.TradomateConfig, data: tm.TradomateData):
# Trying out Minus Directional Indicator minus_di = tm.ta.minus_di(data.high, data.low, data.close, timeperiod=14)
# Get the last value and print last_value = minus_di.iloc[-1] tm.log(f"Last value of Minus Directional Indicator is {last_value}")
# Plot the values of minus_di tm.plot(minus_di, title="Minus Directional Indicator", overlay=False)