Skip to content

Minus Directional Movement

MINUS_DM calculates the negative directional movement.

Method

tm.ta.minus_dm(source_high, source_low, timeperiod)

Inputs

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

Outputs

OutputType
minus_dmnp.ndarray

Example usage

strategy.py
import tradomate as tm
@tm.strategy()
def my_strategy(config: tm.TradomateConfig, data: tm.TradomateData):
# Trying out Minus Directional Movement
minus_dm = tm.ta.minus_dm(data.high, data.low, timeperiod=14)
# Get the last value and print
last_value = minus_dm.iloc[-1]
tm.log(f"Last value of Minus Directional Movement is {last_value}")
# Plot the values of minus_dm
tm.plot(minus_dm, title="Minus Directional Movement", overlay=False)