facioquo/stock-indicators-python

Directional Movement Index (DMI) not included in ADX output

Opened this issue · 1 comments

What happened?

In https://python.stockindicators.dev/indicators/#content the URL link for Directional Movement Index (DMI) is acrtually pointing to https://python.stockindicators.dev/indicators/Adx/#content

Code usage

No response

Log output

No response

The Directional Movement Index plus/minus components are included as a component of Average Directional Movement Index (ADX), and are part of the same indicator, which is why the links points to the same page and not really a bug.

image

On inspection, I can see DMI (shown as dx below) is calculated as part of ADX, but am unsure as to why I didn't add it to the output result. You can calculate this yourself from the ADX output as a workaround. I'm converting this to an enhancement in the backlog, to add DMI to the output result.

https://github.com/DaveSkender/Stock.Indicators/blob/7c362fffed60a274058f2ed28259b9f73cae347a/src/a-d/Adx/Adx.Series.cs#L110-L114

// underlying C# source code

double dx = (pdi == mdi) ? 0 
  : (pdi + mdi != 0)
    ? 100 * Math.Abs(pdi - mdi) / (pdi + mdi)
    : double.NaN;

Fix depends on: