Plus Directional Movement
PLUS_DM calculates the positive directional movement.
Method
tm.ta.plus_dm(source_high, source_low, timeperiod)
Inputs
Parameter | Argument type | Description | Default Value |
---|---|---|---|
source_high | pd.Series | High prices series | - |
source_low | pd.Series | Low prices series | - |
timeperiod | int | Number of periods for the indicator | 14 |
Outputs
Output | Type |
---|---|
plus_dm | np.ndarray |
Example usage
import tradomate as tm
@tm.strategy()def my_strategy(config: tm.TradomateConfig, data: tm.TradomateData):
# Trying out Plus Directional Movement plus_dm = tm.ta.plus_dm(data.high, data.low, timeperiod=14)
# Get the last value and print last_value = plus_dm.iloc[-1] tm.log(f"Last value of Plus Directional Movement is {last_value}")
# Plot the values of plus_dm tm.plot(plus_dm, title="Plus Directional Movement", overlay=False)