Skip to content

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

ParameterArgument typeDescriptionDefault Value
source_highpd.SeriesHigh prices series-
source_lowpd.SeriesLow prices series-
source_closepd.SeriesClose prices series-
timeperiodintNumber of periods for the indicator14

Outputs

OutputType
minus_dinp.ndarray

Example usage

strategy.py
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)