Skip to content

Commit

Permalink
ENH adx new lensig arg
Browse files Browse the repository at this point in the history
  • Loading branch information
twopirllc committed Apr 22, 2021
1 parent 31622c2 commit 46836a9
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 7 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ $ pip install pandas_ta

Latest Version
--------------
Best choice! Version: *0.2.74b*
Best choice! Version: *0.2.75b*
```sh
$ pip install -U git+https://github.com/twopirllc/pandas-ta
```
Expand Down Expand Up @@ -913,7 +913,7 @@ cascaded stochastic calculations with additional smoothing. See: ```help(ta.stc)
<br/>

## **Updated Indicators**
* _ADX_ (**adx**): Added ```mamode``` with default "**RMA**" and with the same ```mamode``` options as TradingView. See ```help(ta.adx)```.
* _ADX_ (**adx**): Added ```mamode``` with default "**RMA**" and with the same ```mamode``` options as TradingView. New argument ```lensig``` so it behaves like TradingView's builtin ADX indicator. See ```help(ta.adx)```.
* _Average True Range_ (**atr**): The default ```mamode``` is now "**RMA**" and with the same ```mamode``` options as TradingView. See ```help(ta.atr)```.
* _Bollinger Bands_ (**bbands**): New argument ```ddoff``` to control the Degrees of Freedom. Default is 0. See ```help(ta.bbands)```.
* _Choppiness Index_ (**chop**): New argument ```ln``` to use Natural Logarithm (True) instead of the Standard Logarithm (False). Default is False. See ```help(ta.chop)```.
Expand Down
4 changes: 2 additions & 2 deletions pandas_ta/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -1363,11 +1363,11 @@ def zscore(self, length=None, std=None, offset=None, **kwargs):
return self._post_process(result, **kwargs)

# Trend
def adx(self, length=None, scalar=None, drift=None, offset=None, **kwargs):
def adx(self, length=None, lensig=None, mamode=None, scalar=None, drift=None, offset=None, **kwargs):
high = self._get_column(kwargs.pop("high", "high"))
low = self._get_column(kwargs.pop("low", "low"))
close = self._get_column(kwargs.pop("close", "close"))
result = adx(high=high, low=low, close=close, length=length, scalar=scalar, drift=drift, offset=offset, **kwargs)
result = adx(high=high, low=low, close=close, length=length, lensig=lensig, mamode=mamode, scalar=scalar, drift=drift, offset=offset, **kwargs)
return self._post_process(result, **kwargs)

def amat(self, fast=None, slow=None, mamode=None, lookback=None, offset=None, **kwargs):
Expand Down
5 changes: 3 additions & 2 deletions pandas_ta/trend/adx.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
from pandas_ta.utils import get_drift, get_offset, verify_series, zero


def adx(high, low, close, length=None, scalar=None, mamode=None, drift=None, offset=None, lensig=None, **kwargs):
def adx(high, low, close, length=None, lensig=None, mamode=None, scalar=None, drift=None, offset=None, **kwargs):
"""Indicator: ADX"""
# Validate Arguments
length = length if length and length > 0 else 14
Expand Down Expand Up @@ -135,7 +135,8 @@ def adx(high, low, close, length=None, scalar=None, mamode=None, drift=None, off
high (pd.Series): Series of 'high's
low (pd.Series): Series of 'low's
close (pd.Series): Series of 'close's
length (int): It's period. Default: 14
length (int): It's period. Default: 14
lensig (int): Signal Length. Like TradingView's default ADX. Default: length
scalar (float): How much to magnify. Default: 100
drift (int): The difference period. Default: 1
offset (int): How many periods to offset the result. Default: 0
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
"pandas_ta.volatility",
"pandas_ta.volume"
],
version=".".join(("0", "2", "74b")),
version=".".join(("0", "2", "75b")),
description=long_description,
long_description=long_description,
author="Kevin Johnson",
Expand Down

0 comments on commit 46836a9

Please sign in to comment.