Skip to content

Plus Directional Indicator

PLUS_DI measures the strength of upward price movement.

Method

tm.ta.plus_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
plus_dinp.ndarray

Example usage

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