diff --git a/README.md b/README.md
index d0a7687..7a98ed5 100644
--- a/README.md
+++ b/README.md
@@ -62,7 +62,7 @@ _Pandas Technical Analysis_ (**Pandas TA**) is an easy to use library that lever
* [Trend](#trend-19)
* [Utility](#utility-5)
* [Volatility](#volatility-14)
- * [Volume](#volume-15)
+ * [Volume](#volume-16)
* [Misc](#misc)
* [Backtesting](#backtesting)
* [Performance Metrics](#performance-metrics)
@@ -118,7 +118,7 @@ $ pip install pandas_ta
Latest Version
--------------
-Best choice! Version: *0.3.38b*
+Best choice! Version: *0.3.41b*
* Includes all fixes and updates between **pypi** and what is covered in this README.
```sh
$ pip install -U git+https://github.com/twopirllc/pandas-ta
@@ -219,7 +219,7 @@ Thanks for using **Pandas TA**!
_Thank you for your contributions!_
-
+
@@ -898,7 +898,7 @@ Use parameter: cumulative=**True** for cumulative results.
-### **Volume** (15)
+### **Volume** (16)
* _Accumulation/Distribution Index_: **ad**
* _Accumulation/Distribution Oscillator_: **adosc**
@@ -915,6 +915,7 @@ Use parameter: cumulative=**True** for cumulative results.
* _Price Volume Rank_: **pvr**
* _Price Volume Trend_: **pvt**
* _Volume Profile_: **vp**
+* _Worden Brothers Time Segmented Value_: **wb_tsv**
| _On-Balance Volume_ (OBV) |
|:--------:|
@@ -1025,6 +1026,7 @@ help(ta.sample)
## **Breaking / Depreciated Indicators**
* _Arnaud Legoux Moving Average_ (**alma**) Updated accuracy and speed with new default ```length=9``` and argument ```distribution_offset``` renamed to ```dist_offset```. See ```help(ta.alma)```.
* _Trend Return_ (**trend_return**) has been removed and replaced with **tsignals**. When given a trend Series like ```close > sma(close, 50)``` it returns the Trend, Trade Entries and Trade Exits of that trend to make it compatible with [**vectorbt**](https://github.com/polakowo/vectorbt) by setting ```asbool=True``` to get boolean Trade Entries and Exits. See ```help(ta.tsignals)```
+* _Volume Profile_ (**vp**) is no longer part of the DataFrame Extension since it does not return a Time Series.
* _Zero Lag Moving Average_ (**zlma**) now using available Moving Averages from ```ta.ma```. See ```help(ta.zlma)``` and ```help(ta.ma)```.
@@ -1039,6 +1041,7 @@ help(ta.sample)
* _Squeeze Pro_ (**squeeze_pro**) is an extended version of "TTM Squeeze" from John Carter. See ```help(ta.squeeze_pro)```
* _Tom DeMark's Sequential_ (**td_seq**) attempts to identify a price point where an uptrend or a downtrend exhausts itself and reverses. Currently exlcuded from ```df.ta.strategy()``` for performance reasons. See ```help(ta.td_seq)```
* _Think or Swim Standard Deviation All_ (**tos_stdevall**) indicator which returns the standard deviation of data for the entire plot or for the interval of the last bars defined by the length parameter. See ```help(ta.tos_stdevall)```
+* _Worden Brothers Time Segmented Value_ (**wb_tsv**) is an oscillator indicator that attempts to indentify money flow in a stock, similar to On Balance Volume (**obv**). See ```help(ta.wb_tsv)```
diff --git a/pandas_ta/__init__.py b/pandas_ta/__init__.py
index 87cd421..11ad7e4 100644
--- a/pandas_ta/__init__.py
+++ b/pandas_ta/__init__.py
@@ -80,10 +80,11 @@ Category = {
"natr", "pdist", "rvi", "thermo", "true_range", "ui"
],
- # Volume, "vp" or "Volume Profile" is unique
+ # Volume.
+ # Note: "vp" or "Volume Profile" is excluded since it does not return a Time Series
"volume": [
"ad", "adosc", "aobv", "cmf", "efi", "eom", "kvo", "mfi", "nvi", "obv",
- "pvi", "pvol", "pvr", "pvt"
+ "pvi", "pvol", "pvr", "pvt", "wb_tsv"
],
}
diff --git a/pandas_ta/candles/cdl_doji.py b/pandas_ta/candles/cdl_doji.py
index 9c053c3..6d41dee 100644
--- a/pandas_ta/candles/cdl_doji.py
+++ b/pandas_ta/candles/cdl_doji.py
@@ -13,17 +13,6 @@ def cdl_doji(open_, high, low, close, length=None, factor=None, scalar=None, asi
Sources:
TA-Lib: 96.56% Correlation
- Calculation:
- Default values:
- length=10, percent=10 (0.1), scalar=100
- ABS = Absolute Value
- SMA = Simple Moving Average
-
- BODY = ABS(close - open)
- HL_RANGE = ABS(high - low)
-
- DOJI = scalar IF BODY < 0.01 * percent * SMA(HL_RANGE, length) ELSE 0
-
Args:
open_ (pd.Series): Series of 'open's
high (pd.Series): Series of 'high's
diff --git a/pandas_ta/candles/cdl_inside.py b/pandas_ta/candles/cdl_inside.py
index 272e85e..1ade4c0 100644
--- a/pandas_ta/candles/cdl_inside.py
+++ b/pandas_ta/candles/cdl_inside.py
@@ -15,14 +15,6 @@ def cdl_inside(open_, high, low, close, asbool=False, offset=None, **kwargs):
Sources:
https://www.tradingview.com/script/IyIGN1WO-Inside-Bar/
- Calculation:
- Default Inputs:
- asbool=False
- inside = (high.diff() < 0) & (low.diff() > 0)
-
- if not asbool:
- inside *= candle_color(open_, close)
-
Args:
open_ (pd.Series): Series of 'open's
high (pd.Series): Series of 'high's
diff --git a/pandas_ta/candles/cdl_z.py b/pandas_ta/candles/cdl_z.py
index a003f2b..b15cc4c 100644
--- a/pandas_ta/candles/cdl_z.py
+++ b/pandas_ta/candles/cdl_z.py
@@ -11,16 +11,6 @@ def cdl_z(open_, high, low, close, length=None, full=None, ddof=None, offset=Non
Source: Kevin Johnson
- Calculation:
- Default values:
- length=30, full=False, ddof=1
- Z = ZSCORE
-
- open = Z( open, length, ddof)
- high = Z( high, length, ddof)
- low = Z( low, length, ddof)
- close = Z(close, length, ddof)
-
Args:
open_ (pd.Series): Series of 'open's
high (pd.Series): Series of 'high's
diff --git a/pandas_ta/candles/ha.py b/pandas_ta/candles/ha.py
index f6b2532..6473a6c 100644
--- a/pandas_ta/candles/ha.py
+++ b/pandas_ta/candles/ha.py
@@ -19,25 +19,6 @@ def ha(open_, high, low, close, offset=None, **kwargs):
Sources:
https://www.investopedia.com/terms/h/heikinashi.asp
- Calculation:
- HA_OPEN[0] = (open[0] + close[0]) / 2
- HA_CLOSE = (open[0] + high[0] + low[0] + close[0]) / 4
-
- for i > 1 in df.index:
- HA_OPEN = (HA_OPEN[iā1] + HA_CLOSE[iā1]) / 2
-
- HA_HIGH = MAX(HA_OPEN, HA_HIGH, HA_CLOSE)
- HA_LOW = MIN(HA_OPEN, HA_LOW, HA_CLOSE)
-
- How to Calculate Heikin-Ashi
-
- Use one period to create the first Heikin-Ashi (HA) candle, using
- the formulas. For example use the high, low, open, and close to
- create the first HA close price. Use the open and close to create
- the first HA open. The high of the period will be the first HA high,
- and the low will be the first HA low. With the first HA calculated,
- it is now possible to continue computing the HA candles per the formulas.
- āā
Args:
open_ (pd.Series): Series of 'open's
high (pd.Series): Series of 'high's
diff --git a/pandas_ta/core.py b/pandas_ta/core.py
index 1307b36..a1c8beb 100644
--- a/pandas_ta/core.py
+++ b/pandas_ta/core.py
@@ -667,7 +667,6 @@ class AnalysisIndicators(BasePandasObject):
"short_run",
"td_seq", # Performance exclusion
"tsignals",
- "vp",
"xsignals",
]
@@ -1834,8 +1833,8 @@ class AnalysisIndicators(BasePandasObject):
result = pvt(close=close, volume=volume, offset=offset, **kwargs)
return self._post_process(result, **kwargs)
- def vp(self, width=None, percent=None, **kwargs):
+ def wb_tsv(self, length=None, signal=None, offset=None, **kwargs):
close = self._get_column(kwargs.pop("close", "close"))
volume = self._get_column(kwargs.pop("volume", "volume"))
- result = vp(close=close, volume=volume, width=width, percent=percent, **kwargs)
+ result = wb_tsv(close=close, volume=volume, signal=signal, offset=offset, **kwargs)
return self._post_process(result, **kwargs)
diff --git a/pandas_ta/cycles/ebsw.py b/pandas_ta/cycles/ebsw.py
index 5cad4b7..c7ed2a5 100644
--- a/pandas_ta/cycles/ebsw.py
+++ b/pandas_ta/cycles/ebsw.py
@@ -36,9 +36,6 @@ def ebsw(close, length=None, bars=None, offset=None, initial_version=False, **kw
- https://www.prorealcode.com/prorealtime-indicators/even-better-sinewave/
- J.F.Ehlers 'Cycle Analytics for Traders', 2014
- Calculation:
- refer to 'sources' or implementation
-
Args:
close (pd.Series): Series of 'close's
length (int): It's max cycle/trend period. Values between 40-48 work like
diff --git a/pandas_ta/cycles/reflex.py b/pandas_ta/cycles/reflex.py
index 63a79c1..c7092e9 100644
--- a/pandas_ta/cycles/reflex.py
+++ b/pandas_ta/cycles/reflex.py
@@ -24,9 +24,6 @@ def reflex(close, length=None, smooth=None, alpha=None, offset=None, **kwargs):
Sources:
https://www.prorealcode.com/prorealtime-indicators/reflex-and-trendflex-indicators-john-f-ehlers/
- Calculation:
- Refer to provided source or the code above.
-
Args:
close (pd.Series): Series of 'close's
length (int): It's period. Default: 20
diff --git a/pandas_ta/momentum/ao.py b/pandas_ta/momentum/ao.py
index e436e1c..8d3bddc 100644
--- a/pandas_ta/momentum/ao.py
+++ b/pandas_ta/momentum/ao.py
@@ -13,13 +13,6 @@ def ao(high, low, fast=None, slow=None, offset=None, **kwargs):
https://www.tradingview.com/wiki/Awesome_Oscillator_(AO)
https://www.ifcm.co.uk/ntx-indicators/awesome-oscillator
- Calculation:
- Default Inputs:
- fast=5, slow=34
- SMA = Simple Moving Average
- median = (high + low) / 2
- AO = SMA(median, fast) - SMA(median, slow)
-
Args:
high (pd.Series): Series of 'high's
low (pd.Series): Series of 'low's
diff --git a/pandas_ta/momentum/apo.py b/pandas_ta/momentum/apo.py
index 74f9883..4866da8 100644
--- a/pandas_ta/momentum/apo.py
+++ b/pandas_ta/momentum/apo.py
@@ -14,12 +14,6 @@ def apo(close, fast=None, slow=None, mamode=None, talib=None, offset=None, **kwa
Sources:
https://www.tradingtechnologies.com/xtrader-help/x-study/technical-indicator-definitions/absolute-price-oscillator-apo/
- Calculation:
- Default Inputs:
- fast=12, slow=26
- SMA = Simple Moving Average
- APO = SMA(close, fast) - SMA(close, slow)
-
Args:
close (pd.Series): Series of 'close's
fast (int): The short period. Default: 12
diff --git a/pandas_ta/momentum/bias.py b/pandas_ta/momentum/bias.py
index f48bc7e..a70bbc2 100644
--- a/pandas_ta/momentum/bias.py
+++ b/pandas_ta/momentum/bias.py
@@ -12,13 +12,6 @@ def bias(close, length=None, mamode=None, offset=None, **kwargs):
Few internet resources on definitive definition.
Request by Github user homily, issue #46
- Calculation:
- Default Inputs:
- length=26, MA='sma'
-
- BIAS = (close - MA(close, length)) / MA(close, length)
- = (close / MA(close, length)) - 1
-
Args:
close (pd.Series): Series of 'close's
length (int): The period. Default: 26
diff --git a/pandas_ta/momentum/bop.py b/pandas_ta/momentum/bop.py
index 224deb8..51ef086 100644
--- a/pandas_ta/momentum/bop.py
+++ b/pandas_ta/momentum/bop.py
@@ -11,9 +11,6 @@ def bop(open_, high, low, close, scalar=None, talib=None, offset=None, **kwargs)
Sources:
http://www.worden.com/TeleChartHelp/Content/Indicators/Balance_of_Power.htm
- Calculation:
- BOP = scalar * (close - open) / (high - low)
-
Args:
open (pd.Series): Series of 'open's
high (pd.Series): Series of 'high's
diff --git a/pandas_ta/momentum/brar.py b/pandas_ta/momentum/brar.py
index ec601c6..eb8d258 100644
--- a/pandas_ta/momentum/brar.py
+++ b/pandas_ta/momentum/brar.py
@@ -12,20 +12,6 @@ def brar(open_, high, low, close, length=None, scalar=None, drift=None, offset=N
No internet resources on definitive definition.
Request by Github user homily, issue #46
- Calculation:
- Default Inputs:
- length=26, scalar=100
- SUM = Sum
-
- HO_Diff = high - open
- OL_Diff = open - low
- HCY = high - close[-1]
- CYL = close[-1] - low
- HCY[HCY < 0] = 0
- CYL[CYL < 0] = 0
- AR = scalar * SUM(HO, length) / SUM(OL, length)
- BR = scalar * SUM(HCY, length) / SUM(CYL, length)
-
Args:
open_ (pd.Series): Series of 'open's
high (pd.Series): Series of 'high's
diff --git a/pandas_ta/momentum/cci.py b/pandas_ta/momentum/cci.py
index cf62515..b4f5f1c 100644
--- a/pandas_ta/momentum/cci.py
+++ b/pandas_ta/momentum/cci.py
@@ -14,16 +14,6 @@ def cci(high, low, close, length=None, c=None, talib=None, offset=None, **kwargs
Sources:
https://www.tradingview.com/wiki/Commodity_Channel_Index_(CCI)
- Calculation:
- Default Inputs:
- length=14, c=0.015
- SMA = Simple Moving Average
- MAD = Mean Absolute Deviation
- tp = typical_price = hlc3 = (high + low + close) / 3
- mean_tp = SMA(tp, length)
- mad_tp = MAD(tp, length)
- CCI = (tp - mean_tp) / (c * mad_tp)
-
Args:
high (pd.Series): Series of 'high's
low (pd.Series): Series of 'low's
diff --git a/pandas_ta/momentum/cfo.py b/pandas_ta/momentum/cfo.py
index 94fe4ce..38b9297 100644
--- a/pandas_ta/momentum/cfo.py
+++ b/pandas_ta/momentum/cfo.py
@@ -12,13 +12,6 @@ def cfo(close, length=None, scalar=None, drift=None, offset=None, **kwargs):
Sources:
https://www.fmlabs.com/reference/default.htm?url=ForecastOscillator.htm
- Calculation:
- Default Inputs:
- length=9, drift=1, scalar=100
- LINREG = Linear Regression
-
- CFO = scalar * (close - LINERREG(length, tdf=True)) / close
-
Args:
close (pd.Series): Series of 'close's
length (int): The period. Default: 9
diff --git a/pandas_ta/momentum/cg.py b/pandas_ta/momentum/cg.py
index a63abe4..a6544f4 100644
--- a/pandas_ta/momentum/cg.py
+++ b/pandas_ta/momentum/cg.py
@@ -11,10 +11,6 @@ def cg(close, length=None, offset=None, **kwargs):
Sources:
http://www.mesasoftware.com/papers/TheCGOscillator.pdf
- Calculation:
- Default Inputs:
- length=10
-
Args:
close (pd.Series): Series of 'close's
length (int): The length of the period. Default: 10
diff --git a/pandas_ta/momentum/cmo.py b/pandas_ta/momentum/cmo.py
index 6893e1c..9b425a4 100644
--- a/pandas_ta/momentum/cmo.py
+++ b/pandas_ta/momentum/cmo.py
@@ -14,13 +14,6 @@ def cmo(close, length=None, scalar=None, talib=None, drift=None, offset=None, **
https://www.tradingtechnologies.com/help/x-study/technical-indicator-definitions/chande-momentum-oscillator-cmo/
https://www.tradingview.com/script/hdrf0fXV-Variable-Index-Dynamic-Average-VIDYA/
- Calculation:
- Default Inputs:
- drift=1, scalar=100
-
- # Same Calculation as RSI except for this step
- CMO = scalar * (PSUM - NSUM) / (PSUM + NSUM)
-
Args:
close (pd.Series): Series of 'close's
scalar (float): How much to magnify. Default: 100
diff --git a/pandas_ta/momentum/coppock.py b/pandas_ta/momentum/coppock.py
index 6329437..12f8aa7 100644
--- a/pandas_ta/momentum/coppock.py
+++ b/pandas_ta/momentum/coppock.py
@@ -16,16 +16,6 @@ def coppock(close, length=None, fast=None, slow=None, offset=None, **kwargs):
Sources:
https://en.wikipedia.org/wiki/Coppock_curve
- Calculation:
- Default Inputs:
- length=10, fast=11, slow=14
- SMA = Simple Moving Average
- MAD = Mean Absolute Deviation
- tp = typical_price = hlc3 = (high + low + close) / 3
- mean_tp = SMA(tp, length)
- mad_tp = MAD(tp, length)
- CCI = (tp - mean_tp) / (c * mad_tp)
-
Args:
close (pd.Series): Series of 'close's
length (int): WMA period. Default: 10
diff --git a/pandas_ta/momentum/cti.py b/pandas_ta/momentum/cti.py
index 4d74c01..a55bb28 100644
--- a/pandas_ta/momentum/cti.py
+++ b/pandas_ta/momentum/cti.py
@@ -17,6 +17,10 @@ def cti(close, length=None, offset=None, **kwargs) -> Series:
length (int): It's period. Default: 12
offset (int): How many periods to offset the result. Default: 0
+ Kwargs:
+ fillna (value, optional): pd.DataFrame.fillna(value)
+ fill_method (value, optional): Type of fill method
+
Returns:
pd.Series: Series of the CTI values for the given period.
"""
diff --git a/pandas_ta/momentum/dm.py b/pandas_ta/momentum/dm.py
index 0ff2701..a3fb986 100644
--- a/pandas_ta/momentum/dm.py
+++ b/pandas_ta/momentum/dm.py
@@ -16,22 +16,6 @@ def dm(high, low, length=None, mamode=None, talib=None, drift=None, offset=None,
https://www.tradingview.com/pine-script-reference/#fun_dmi
https://www.sierrachart.com/index.php?page=doc/StudiesReference.php&ID=24&Name=Directional_Movement_Index
- Calculation:
- Default Inputs:
- length=14, mamode="rma", drift=1
- up = high - high.shift(drift)
- dn = low.shift(drift) - low
-
- pos_ = ((up > dn) & (up > 0)) * up
- neg_ = ((dn > up) & (dn > 0)) * dn
-
- pos_ = pos_.apply(zero)
- neg_ = neg_.apply(zero)
-
- # Not the same values as TA Lib's -+DM
- pos = ma(mamode, pos_, length=length)
- neg = ma(mamode, neg_, length=length)
-
Args:
high (pd.Series): Series of 'high's
low (pd.Series): Series of 'low's
@@ -41,6 +25,10 @@ def dm(high, low, length=None, mamode=None, talib=None, drift=None, offset=None,
drift (int): The difference period. Default: 1
offset (int): How many periods to offset the result. Default: 0
+ Kwargs:
+ fillna (value, optional): pd.DataFrame.fillna(value)
+ fill_method (value, optional): Type of fill method
+
Returns:
pd.DataFrame: DMP (+DM) and DMN (-DM) columns.
"""
diff --git a/pandas_ta/momentum/er.py b/pandas_ta/momentum/er.py
index 79e9c12..e6bf876 100644
--- a/pandas_ta/momentum/er.py
+++ b/pandas_ta/momentum/er.py
@@ -13,16 +13,6 @@ def er(close, length=None, drift=None, offset=None, **kwargs):
Sources:
https://help.tc2000.com/m/69404/l/749623-kaufman-efficiency-ratio
- Calculation:
- Default Inputs:
- length=10
- ABS = Absolute Value
- EMA = Exponential Moving Average
-
- abs_diff = ABS(close.diff(length))
- volatility = ABS(close.diff(1))
- ER = abs_diff / SUM(volatility, length)
-
Args:
close (pd.Series): Series of 'close's
length (int): It's period. Default: 1
diff --git a/pandas_ta/momentum/eri.py b/pandas_ta/momentum/eri.py
index 2570ca0..46f3e52 100644
--- a/pandas_ta/momentum/eri.py
+++ b/pandas_ta/momentum/eri.py
@@ -20,14 +20,6 @@ def eri(high, low, close, length=None, offset=None, **kwargs):
Sources:
https://admiralmarkets.com/education/articles/forex-indicators/bears-and-bulls-power-indicator
- Calculation:
- Default Inputs:
- length=13
- EMA = Exponential Moving Average
-
- BULLPOWER = high - EMA(close, length)
- BEARPOWER = low - EMA(close, length)
-
Args:
high (pd.Series): Series of 'high's
low (pd.Series): Series of 'low's
diff --git a/pandas_ta/momentum/fisher.py b/pandas_ta/momentum/fisher.py
index bd765a2..e6d3e73 100644
--- a/pandas_ta/momentum/fisher.py
+++ b/pandas_ta/momentum/fisher.py
@@ -16,29 +16,6 @@ def fisher(high, low, length=None, signal=None, offset=None, **kwargs):
Sources:
TradingView (Correlation >99%)
- Calculation:
- Default Inputs:
- length=9, signal=1
- HL2 = hl2(high, low)
- HHL2 = HL2.rolling(length).max()
- LHL2 = HL2.rolling(length).min()
-
- HLR = HHL2 - LHL2
- HLR[HLR < 0.001] = 0.001
-
- position = ((HL2 - LHL2) / HLR) - 0.5
-
- v = 0
- m = high.size
- FISHER = [npNaN for _ in range(0, length - 1)] + [0]
- for i in range(length, m):
- v = 0.66 * position[i] + 0.67 * v
- if v < -0.99: v = -0.999
- if v > 0.99: v = 0.999
- FISHER.append(0.5 * (nplog((1 + v) / (1 - v)) + FISHER[i - 1]))
-
- SIGNAL = FISHER.shift(signal)
-
Args:
high (pd.Series): Series of 'high's
low (pd.Series): Series of 'low's
diff --git a/pandas_ta/momentum/inertia.py b/pandas_ta/momentum/inertia.py
index 2387ce0..372f480 100644
--- a/pandas_ta/momentum/inertia.py
+++ b/pandas_ta/momentum/inertia.py
@@ -15,13 +15,6 @@ def inertia(close=None, high=None, low=None, length=None, rvi_length=None, scala
Sources:
https://www.investopedia.com/terms/r/relative_vigor_index.asp
- Calculation:
- Default Inputs:
- length=14, ma_length=20
- LSQRMA = Least Squares Moving Average
-
- INERTIA = LSQRMA(RVI(length), ma_length)
-
Args:
open_ (pd.Series): Series of 'open's
high (pd.Series): Series of 'high's
diff --git a/pandas_ta/momentum/kdj.py b/pandas_ta/momentum/kdj.py
index 991572c..f48ae4a 100644
--- a/pandas_ta/momentum/kdj.py
+++ b/pandas_ta/momentum/kdj.py
@@ -16,18 +16,6 @@ def kdj(high=None, low=None, close=None, length=None, signal=None, offset=None,
https://www.prorealcode.com/prorealtime-indicators/kdj/
https://docs.anychart.com/Stock_Charts/Technical_Indicators/Mathematical_Description#kdj
- Calculation:
- Default Inputs:
- length=9, signal=3
- LL = low for last 9 periods
- HH = high for last 9 periods
-
- FAST_K = 100 * (close - LL) / (HH - LL)
-
- K = RMA(FAST_K, signal)
- D = RMA(K, signal)
- J = 3K - 2D
-
Args:
high (pd.Series): Series of 'high's
low (pd.Series): Series of 'low's
diff --git a/pandas_ta/momentum/kst.py b/pandas_ta/momentum/kst.py
index 7a3985e..f38a298 100644
--- a/pandas_ta/momentum/kst.py
+++ b/pandas_ta/momentum/kst.py
@@ -13,20 +13,6 @@ def kst(close, roc1=None, roc2=None, roc3=None, roc4=None, sma1=None, sma2=None,
https://www.tradingview.com/wiki/Know_Sure_Thing_(KST)
https://www.incrediblecharts.com/indicators/kst.php
- Calculation:
- Default Inputs:
- roc1=10, roc2=15, roc3=20, roc4=30,
- sma1=10, sma2=10, sma3=10, sma4=15, signal=9, drift=1
- ROC = Rate of Change
- SMA = Simple Moving Average
- rocsma1 = SMA(ROC(close, roc1), sma1)
- rocsma2 = SMA(ROC(close, roc2), sma2)
- rocsma3 = SMA(ROC(close, roc3), sma3)
- rocsma4 = SMA(ROC(close, roc4), sma4)
-
- KST = 100 * (rocsma1 + 2 * rocsma2 + 3 * rocsma3 + 4 * rocsma4)
- KST_Signal = SMA(KST, signal)
-
Args:
close (pd.Series): Series of 'close's
roc1 (int): ROC 1 period. Default: 10
diff --git a/pandas_ta/momentum/macd.py b/pandas_ta/momentum/macd.py
index c3fff77..5fb2295 100644
--- a/pandas_ta/momentum/macd.py
+++ b/pandas_ta/momentum/macd.py
@@ -17,19 +17,6 @@ def macd(close, fast=None, slow=None, signal=None, talib=None, offset=None, **kw
https://www.tradingview.com/wiki/MACD_(Moving_Average_Convergence/Divergence)
AS Mode: https://tr.tradingview.com/script/YFlKXHnP/
- Calculation:
- Default Inputs:
- fast=12, slow=26, signal=9
- EMA = Exponential Moving Average
- MACD = EMA(close, fast) - EMA(close, slow)
- Signal = EMA(MACD, signal)
- Histogram = MACD - Signal
-
- if asmode:
- MACD = MACD - Signal
- Signal = EMA(MACD, signal)
- Histogram = MACD - Signal
-
Args:
close (pd.Series): Series of 'close's
fast (int): The short period. Default: 12
diff --git a/pandas_ta/momentum/mom.py b/pandas_ta/momentum/mom.py
index 39fd3fd..3d5d502 100644
--- a/pandas_ta/momentum/mom.py
+++ b/pandas_ta/momentum/mom.py
@@ -12,11 +12,6 @@ def mom(close, length=None, talib=None, offset=None, **kwargs):
Sources:
http://www.onlinetradingconcepts.com/TechnicalAnalysis/Momentum.html
- Calculation:
- Default Inputs:
- length=1
- MOM = close.diff(length)
-
Args:
close (pd.Series): Series of 'close's
length (int): It's period. Default: 1
diff --git a/pandas_ta/momentum/pgo.py b/pandas_ta/momentum/pgo.py
index 1b04840..882b53b 100644
--- a/pandas_ta/momentum/pgo.py
+++ b/pandas_ta/momentum/pgo.py
@@ -14,15 +14,6 @@ def pgo(high, low, close, length=None, offset=None, **kwargs):
Sources:
https://library.tradingtechnologies.com/trade/chrt-ti-pretty-good-oscillator.html
- Calculation:
- Default Inputs:
- length=14
- ATR = Average True Range
- SMA = Simple Moving Average
- EMA = Exponential Moving Average
-
- PGO = (close - SMA(close, length)) / EMA(ATR(high, low, close, length), length)
-
Args:
high (pd.Series): Series of 'high's
low (pd.Series): Series of 'low's
diff --git a/pandas_ta/momentum/ppo.py b/pandas_ta/momentum/ppo.py
index 28baf0c..c363812 100644
--- a/pandas_ta/momentum/ppo.py
+++ b/pandas_ta/momentum/ppo.py
@@ -14,17 +14,6 @@ def ppo(close, fast=None, slow=None, signal=None, scalar=None, mamode=None, tali
Sources:
https://www.tradingview.com/wiki/MACD_(Moving_Average_Convergence/Divergence)
- Calculation:
- Default Inputs:
- fast=12, slow=26
- SMA = Simple Moving Average
- EMA = Exponential Moving Average
- fast_sma = SMA(close, fast)
- slow_sma = SMA(close, slow)
- PPO = 100 * (fast_sma - slow_sma) / slow_sma
- Signal = EMA(PPO, signal)
- Histogram = PPO - Signal
-
Args:
close(pandas.Series): Series of 'close's
fast(int): The short period. Default: 12
diff --git a/pandas_ta/momentum/psl.py b/pandas_ta/momentum/psl.py
index 82f40d9..d732d31 100644
--- a/pandas_ta/momentum/psl.py
+++ b/pandas_ta/momentum/psl.py
@@ -14,20 +14,6 @@ def psl(close, open_=None, length=None, scalar=None, drift=None, offset=None, **
Sources:
https://www.quantshare.com/item-851-psychological-line
- Calculation:
- Default Inputs:
- length=12, scalar=100, drift=1
-
- IF NOT open:
- DIFF = SIGN(close - close[drift])
- ELSE:
- DIFF = SIGN(close - open)
-
- DIFF.fillna(0)
- DIFF[DIFF <= 0] = 0
-
- PSL = scalar * SUM(DIFF, length) / length
-
Args:
close (pd.Series): Series of 'close's
open_ (pd.Series, optional): Series of 'open's
diff --git a/pandas_ta/momentum/pvo.py b/pandas_ta/momentum/pvo.py
index 751b4d5..1239128 100644
--- a/pandas_ta/momentum/pvo.py
+++ b/pandas_ta/momentum/pvo.py
@@ -12,15 +12,6 @@ def pvo(volume, fast=None, slow=None, signal=None, scalar=None, offset=None, **k
Sources:
https://www.fmlabs.com/reference/default.htm?url=PVO.htm
- Calculation:
- Default Inputs:
- fast=12, slow=26, signal=9
- EMA = Exponential Moving Average
-
- PVO = (EMA(volume, fast) - EMA(volume, slow)) / EMA(volume, slow)
- Signal = EMA(PVO, signal)
- Histogram = PVO - Signal
-
Args:
volume (pd.Series): Series of 'volume's
fast (int): The short period. Default: 12
diff --git a/pandas_ta/momentum/qqe.py b/pandas_ta/momentum/qqe.py
index 82ac2e4..b730351 100644
--- a/pandas_ta/momentum/qqe.py
+++ b/pandas_ta/momentum/qqe.py
@@ -21,10 +21,6 @@ def qqe(close, length=None, smooth=None, factor=None, mamode=None, drift=None, o
https://www.tradingpedia.com/forex-trading-indicators/quantitative-qualitative-estimation
https://www.prorealcode.com/prorealtime-indicators/qqe-quantitative-qualitative-estimation/
- Calculation:
- Default Inputs:
- length=14, smooth=5, factor=4.236, mamode="ema", drift=1
-
Args:
close (pd.Series): Series of 'close's
length (int): RSI period. Default: 14
diff --git a/pandas_ta/momentum/roc.py b/pandas_ta/momentum/roc.py
index ac847bf..18b1ae8 100644
--- a/pandas_ta/momentum/roc.py
+++ b/pandas_ta/momentum/roc.py
@@ -14,12 +14,6 @@ def roc(close, length=None, scalar=None, talib=None, offset=None, **kwargs):
Sources:
https://www.tradingview.com/wiki/Rate_of_Change_(ROC)
- Calculation:
- Default Inputs:
- length=1
- MOM = Momentum
- ROC = 100 * MOM(close, length) / close.shift(length)
-
Args:
close (pd.Series): Series of 'close's
length (int): It's period. Default: 1
diff --git a/pandas_ta/momentum/rsi.py b/pandas_ta/momentum/rsi.py
index 7bf49b0..8a4d208 100644
--- a/pandas_ta/momentum/rsi.py
+++ b/pandas_ta/momentum/rsi.py
@@ -14,21 +14,6 @@ def rsi(close, length=None, scalar=None, talib=None, drift=None, offset=None, **
Sources:
https://www.tradingview.com/wiki/Relative_Strength_Index_(RSI)
- Calculation:
- Default Inputs:
- length=14, scalar=100, drift=1
- ABS = Absolute Value
- RMA = Rolling Moving Average
-
- diff = close.diff(drift)
- positive = diff if diff > 0 else 0
- negative = diff if diff < 0 else 0
-
- pos_avg = RMA(positive, length)
- neg_avg = ABS(RMA(negative, length))
-
- RSI = scalar * pos_avg / (pos_avg + neg_avg)
-
Args:
close (pd.Series): Series of 'close's
length (int): It's period. Default: 14
diff --git a/pandas_ta/momentum/rsx.py b/pandas_ta/momentum/rsx.py
index d735fff..58834b5 100644
--- a/pandas_ta/momentum/rsx.py
+++ b/pandas_ta/momentum/rsx.py
@@ -17,9 +17,6 @@ def rsx(close, length=None, drift=None, offset=None, **kwargs):
http://www.jurikres.com/catalog1/ms_rsx.htm
https://www.prorealcode.com/prorealtime-indicators/jurik-rsx/
- Calculation:
- Refer to the sources above for information as well as code example.
-
Args:
close (pd.Series): Series of 'close's
length (int): It's period. Default: 14
diff --git a/pandas_ta/momentum/rvgi.py b/pandas_ta/momentum/rvgi.py
index a903a93..064d2a8 100644
--- a/pandas_ta/momentum/rvgi.py
+++ b/pandas_ta/momentum/rvgi.py
@@ -15,14 +15,6 @@ def rvgi(open_, high, low, close, length=None, swma_length=None, offset=None, **
Sources:
https://www.investopedia.com/terms/r/relative_vigor_index.asp
- Calculation:
- Default Inputs:
- length=14, swma_length=4
- SWMA = Symmetrically Weighted Moving Average
- numerator = SUM(SWMA(close - open, swma_length), length)
- denominator = SUM(SWMA(high - low, swma_length), length)
- RVGI = numerator / denominator
-
Args:
open_ (pd.Series): Series of 'open's
high (pd.Series): Series of 'high's
diff --git a/pandas_ta/momentum/slope.py b/pandas_ta/momentum/slope.py
index 731ca44..b88525a 100644
--- a/pandas_ta/momentum/slope.py
+++ b/pandas_ta/momentum/slope.py
@@ -24,12 +24,12 @@ def slope( close, length=None, as_angle=None, to_degrees=None, vertical=None, of
Args:
close (pd.Series): Series of 'close's
- length (int): It's period. Default: 1
+ length (int): It's period. Default: 1
+ as_angle (value, optional): Converts slope to an angle. Default: False
+ to_degrees (value, optional): Converts slope angle to degrees. Default: False
offset (int): How many periods to offset the result. Default: 0
Kwargs:
- as_angle (value, optional): Converts slope to an angle. Default: False
- to_degrees (value, optional): Converts slope angle to degrees. Default: False
fillna (value, optional): pd.DataFrame.fillna(value)
fill_method (value, optional): Type of fill method
diff --git a/pandas_ta/momentum/smi.py b/pandas_ta/momentum/smi.py
index ebfa9c5..9e13695 100644
--- a/pandas_ta/momentum/smi.py
+++ b/pandas_ta/momentum/smi.py
@@ -21,16 +21,6 @@ def smi(close, fast=None, slow=None, signal=None, scalar=None, offset=None, **kw
https://www.tradingview.com/script/Xh5Q0une-SMI-Ergodic-Oscillator/
https://www.tradingview.com/script/cwrgy4fw-SMIIO/
- Calculation:
- Default Inputs:
- fast=5, slow=20, signal=5
- TSI = True Strength Index
- EMA = Exponential Moving Average
-
- ERG = TSI(close, fast, slow)
- Signal = EMA(ERG, signal)
- OSC = ERG - Signal
-
Args:
close (pd.Series): Series of 'close's
fast (int): The short period. Default: 5
diff --git a/pandas_ta/momentum/squeeze.py b/pandas_ta/momentum/squeeze.py
index 1f56126..e764b1f 100644
--- a/pandas_ta/momentum/squeeze.py
+++ b/pandas_ta/momentum/squeeze.py
@@ -24,37 +24,6 @@ def squeeze(high, low, close, bb_length=None, bb_std=None, kc_length=None, kc_sc
https://www.tradingview.com/scripts/lazybear/
https://tlc.thinkorswim.com/center/reference/Tech-Indicators/studies-library/T-U/TTM-Squeeze
- Calculation:
- Default Inputs:
- bb_length=20, bb_std=2, kc_length=20, kc_scalar=1.5, mom_length=12,
- mom_smooth=12, tr=True, lazybear=False,
- BB = Bollinger Bands
- KC = Keltner Channels
- MOM = Momentum
- SMA = Simple Moving Average
- EMA = Exponential Moving Average
- TR = True Range
-
- RANGE = TR(high, low, close) if using_tr else high - low
- BB_LOW, BB_MID, BB_HIGH = BB(close, bb_length, std=bb_std)
- KC_LOW, KC_MID, KC_HIGH = KC(high, low, close, kc_length, kc_scalar, TR)
-
- if lazybear:
- HH = high.rolling(kc_length).max()
- LL = low.rolling(kc_length).min()
- AVG = 0.25 * (HH + LL) + 0.5 * KC_MID
- SQZ = linreg(close - AVG, kc_length)
- else:
- MOMO = MOM(close, mom_length)
- if mamode == "ema":
- SQZ = EMA(MOMO, mom_smooth)
- else:
- SQZ = EMA(momo, mom_smooth)
-
- SQZ_ON = (BB_LOW > KC_LOW) and (BB_HIGH < KC_HIGH)
- SQZ_OFF = (BB_LOW < KC_LOW) and (BB_HIGH > KC_HIGH)
- NO_SQZ = !SQZ_ON and !SQZ_OFF
-
Args:
high (pd.Series): Series of 'high's
low (pd.Series): Series of 'low's
diff --git a/pandas_ta/momentum/squeeze_pro.py b/pandas_ta/momentum/squeeze_pro.py
index 2899996..b8f5612 100644
--- a/pandas_ta/momentum/squeeze_pro.py
+++ b/pandas_ta/momentum/squeeze_pro.py
@@ -24,36 +24,6 @@ def squeeze_pro(high, low, close, bb_length=None, bb_std=None, kc_length=None, k
https://usethinkscript.com/threads/john-carters-squeeze-pro-indicator-for-thinkorswim-free.4021/
https://www.tradingview.com/script/TAAt6eRX-Squeeze-PRO-Indicator-Makit0/
- Calculation:
- Default Inputs:
- bb_length=20, bb_std=2, kc_length=20, kc_scalar_wide=2,
- kc_scalar_normal=1.5, kc_scalar_narrow=1, mom_length=12,
- mom_smooth=6, tr=True,
- BB = Bollinger Bands
- KC = Keltner Channels
- MOM = Momentum
- SMA = Simple Moving Average
- EMA = Exponential Moving Average
- TR = True Range
-
- RANGE = TR(high, low, close) if using_tr else high - low
- BB_LOW, BB_MID, BB_HIGH = BB(close, bb_length, std=bb_std)
- KC_LOW_WIDE, KC_MID_WIDE, KC_HIGH_WIDE = KC(high, low, close, kc_length, kc_scalar_wide, TR)
- KC_LOW_NORMAL, KC_MID_NORMAL, KC_HIGH_NORMAL = KC(high, low, close, kc_length, kc_scalar_normal, TR)
- KC_LOW_NARROW, KC_MID_NARROW, KC_HIGH_NARROW = KC(high, low, close, kc_length, kc_scalar_narrow, TR)
-
- MOMO = MOM(close, mom_length)
- if mamode == "ema":
- SQZPRO = EMA(MOMO, mom_smooth)
- else:
- SQZPRO = EMA(momo, mom_smooth)
-
- SQZPRO_ON_WIDE = (BB_LOW > KC_LOW_WIDE) and (BB_HIGH < KC_HIGH_WIDE)
- SQZPRO_ON_NORMAL = (BB_LOW > KC_LOW_NORMAL) and (BB_HIGH < KC_HIGH_NORMAL)
- SQZPRO_ON_NARROW = (BB_LOW > KC_LOW_NARROW) and (BB_HIGH < KC_HIGH_NARROW)
- SQZPRO_OFF_WIDE = (BB_LOW < KC_LOW_WIDE) and (BB_HIGH > KC_HIGH_WIDE)
- SQZPRO_NO = !SQZ_ON_WIDE and !SQZ_OFF_WIDE
-
Args:
high (pd.Series): Series of 'high's
low (pd.Series): Series of 'low's
diff --git a/pandas_ta/momentum/stc.py b/pandas_ta/momentum/stc.py
index 5ec975a..0a0d6b1 100644
--- a/pandas_ta/momentum/stc.py
+++ b/pandas_ta/momentum/stc.py
@@ -26,17 +26,10 @@ def stc(close, tclength=None, fast=None, slow=None, factor=None, offset=None, **
The same goes for osc=, which allows the input of an externally calculated oscillator, overriding ma1 & ma2.
-
Sources:
Implemented by rengel8 based on work found here:
https://www.prorealcode.com/prorealtime-indicators/schaff-trend-cycle2/
- Calculation:
- STCmacd = Moving Average Convergance/Divergance or Oscillator
- STCstoch = Intermediate Stochastic of MACD/Osc.
- 2nd Stochastic including filtering with results in the
- STC = Schaff Trend Cycle
-
Args:
close (pd.Series): Series of 'close's, used for indexing Series, mandatory
tclen (int): SchaffTC Signal-Line length. Default: 10 (adjust to the half of cycle)
diff --git a/pandas_ta/momentum/stoch.py b/pandas_ta/momentum/stoch.py
index c20df25..e83537d 100644
--- a/pandas_ta/momentum/stoch.py
+++ b/pandas_ta/momentum/stoch.py
@@ -1,10 +1,11 @@
# -*- coding: utf-8 -*-
from pandas import DataFrame
+from pandas_ta import Imports
from pandas_ta.overlap import ma
-from pandas_ta.utils import get_offset, non_zero_range, verify_series
+from pandas_ta.utils import get_offset, non_zero_range, tal_ma, verify_series
-def stoch(high, low, close, k=None, d=None, smooth_k=None, mamode=None, offset=None, **kwargs):
+def stoch(high, low, close, k=None, d=None, smooth_k=None, mamode=None, talib=None, offset=None, **kwargs):
"""Stochastic (STOCH)
The Stochastic Oscillator (STOCH) was developed by George Lane in the 1950's.
@@ -20,17 +21,6 @@ def stoch(high, low, close, k=None, d=None, smooth_k=None, mamode=None, offset=N
https://www.tradingview.com/wiki/Stochastic_(STOCH)
https://www.sierrachart.com/index.php?page=doc/StudiesReference.php&ID=332&Name=KD_-_Slow
- Calculation:
- Default Inputs:
- k=14, d=3, smooth_k=3
- SMA = Simple Moving Average
- LL = low for last k periods
- HH = high for last k periods
-
- STOCH = 100 * (close - LL) / (HH - LL)
- STOCHk = SMA(STOCH, smooth_k)
- STOCHd = SMA(FASTK, d)
-
Args:
high (pd.Series): Series of 'high's
low (pd.Series): Series of 'low's
@@ -39,6 +29,8 @@ def stoch(high, low, close, k=None, d=None, smooth_k=None, mamode=None, offset=N
d (int): The Slow %D period. Default: 3
smooth_k (int): The Slow %K period. Default: 3
mamode (str): See ```help(ta.ma)```. Default: 'sma'
+ talib (bool): If TA Lib is installed and talib is True, Returns the TA Lib
+ version. Default: True
offset (int): How many periods to offset the result. Default: 0
Kwargs:
@@ -58,18 +50,24 @@ def stoch(high, low, close, k=None, d=None, smooth_k=None, mamode=None, offset=N
close = verify_series(close, _length)
offset = get_offset(offset)
mamode = mamode if isinstance(mamode, str) else "sma"
+ mode_tal = bool(talib) if isinstance(talib, bool) else True
if high is None or low is None or close is None: return
# Calculate Result
- lowest_low = low.rolling(k).min()
- highest_high = high.rolling(k).max()
+ if Imports["talib"] and mode_tal:
+ from talib import STOCH
+ stoch_ = STOCH(high, low, close, k, d, tal_ma(mamode), d, tal_ma(mamode))
+ stoch_k, stoch_d = stoch_[0], stoch_[1]
+ else:
+ lowest_low = low.rolling(k).min()
+ highest_high = high.rolling(k).max()
- stoch = 100 * (close - lowest_low)
- stoch /= non_zero_range(highest_high, lowest_low)
+ stoch = 100 * (close - lowest_low)
+ stoch /= non_zero_range(highest_high, lowest_low)
- stoch_k = ma(mamode, stoch.loc[stoch.first_valid_index():,], length=smooth_k)
- stoch_d = ma(mamode, stoch_k.loc[stoch_k.first_valid_index():,], length=d)
+ stoch_k = ma(mamode, stoch.loc[stoch.first_valid_index():,], length=smooth_k)
+ stoch_d = ma(mamode, stoch_k.loc[stoch_k.first_valid_index():,], length=d)
# Offset
if offset != 0:
diff --git a/pandas_ta/momentum/stochf.py b/pandas_ta/momentum/stochf.py
index 40cdbd9..f5e536e 100644
--- a/pandas_ta/momentum/stochf.py
+++ b/pandas_ta/momentum/stochf.py
@@ -16,16 +16,6 @@ def stochf(high, low, close, k=None, d=None, mamode=None, talib=None, offset=Non
https://www.sierrachart.com/index.php?page=doc/StudiesReference.php&ID=333&Name=KD_-_Fast
https://corporatefinanceinstitute.com/resources/knowledge/trading-investing/fast-stochastic-indicator/
- Calculation:
- Default Inputs:
- k=14, d=3, mamode="sma",
- SMA = Simple Moving Average
- LL = low for last k periods
- HH = high for last k periods
-
- STOCHFk = 100 * (close - LL) / (HH - LL)
- STOCHFd = MA(SMA, STOCH, d)
-
Args:
high (pd.Series): Series of 'high's
low (pd.Series): Series of 'low's
diff --git a/pandas_ta/momentum/stochrsi.py b/pandas_ta/momentum/stochrsi.py
index c5fe145..eb545a3 100644
--- a/pandas_ta/momentum/stochrsi.py
+++ b/pandas_ta/momentum/stochrsi.py
@@ -18,20 +18,6 @@ def stochrsi(close, length=None, rsi_length=None, k=None, d=None, mamode=None, o
Sources:
https://www.tradingview.com/wiki/Stochastic_(STOCH)
- Calculation:
- Default Inputs:
- length=14, rsi_length=14, k=3, d=3
- RSI = Relative Strength Index
- SMA = Simple Moving Average
-
- RSI = RSI(high, low, close, rsi_length)
- LL = lowest RSI for last rsi_length periods
- HH = highest RSI for last rsi_length periods
-
- STOCHRSI = 100 * (RSI - LL) / (HH - LL)
- STOCHRSIk = SMA(STOCHRSI, k)
- STOCHRSId = SMA(STOCHRSIk, d)
-
Args:
high (pd.Series): Series of 'high's
low (pd.Series): Series of 'low's
diff --git a/pandas_ta/momentum/td_seq.py b/pandas_ta/momentum/td_seq.py
index 0c0d9bc..de1babe 100644
--- a/pandas_ta/momentum/td_seq.py
+++ b/pandas_ta/momentum/td_seq.py
@@ -14,11 +14,6 @@ def td_seq(close, asint=None, offset=None, **kwargs):
Sources:
https://tradetrekker.wordpress.com/tdsequential/
- Calculation:
- Compare current close price with 4 days ago price, up to 13 days. For the
- consecutive ascending or descending price sequence, display 6th to 9th day
- value.
-
Args:
close (pd.Series): Series of 'close's
asint (bool): If True, fillnas with 0 and change type to int. Default: False
diff --git a/pandas_ta/momentum/trix.py b/pandas_ta/momentum/trix.py
index 90d7978..e4a0dbe 100644
--- a/pandas_ta/momentum/trix.py
+++ b/pandas_ta/momentum/trix.py
@@ -12,16 +12,6 @@ def trix(close, length=None, signal=None, scalar=None, drift=None, offset=None,
Sources:
https://www.tradingview.com/wiki/TRIX
- Calculation:
- Default Inputs:
- length=18, drift=1
- EMA = Exponential Moving Average
- ROC = Rate of Change
- ema1 = EMA(close, length)
- ema2 = EMA(ema1, length)
- ema3 = EMA(ema2, length)
- TRIX = 100 * ROC(ema3, drift)
-
Args:
close (pd.Series): Series of 'close's
length (int): It's period. Default: 18
diff --git a/pandas_ta/momentum/tsi.py b/pandas_ta/momentum/tsi.py
index 8d7c366..46fddeb 100644
--- a/pandas_ta/momentum/tsi.py
+++ b/pandas_ta/momentum/tsi.py
@@ -14,21 +14,6 @@ def tsi(close, fast=None, slow=None, signal=None, scalar=None, mamode=None, drif
Sources:
https://www.investopedia.com/terms/t/tsi.asp
- Calculation:
- Default Inputs:
- fast=13, slow=25, signal=13, scalar=100, drift=1
- EMA = Exponential Moving Average
- diff = close.diff(drift)
-
- slow_ema = EMA(diff, slow)
- fast_slow_ema = EMA(slow_ema, slow)
-
- abs_diff_slow_ema = absolute_diff_ema = EMA(ABS(diff), slow)
- abema = abs_diff_fast_slow_ema = EMA(abs_diff_slow_ema, fast)
-
- TSI = scalar * fast_slow_ema / abema
- Signal = EMA(TSI, signal)
-
Args:
close (pd.Series): Series of 'close's
fast (int): The short period. Default: 13
diff --git a/pandas_ta/momentum/uo.py b/pandas_ta/momentum/uo.py
index f224d71..9b9fbbd 100644
--- a/pandas_ta/momentum/uo.py
+++ b/pandas_ta/momentum/uo.py
@@ -13,24 +13,6 @@ def uo(high, low, close, fast=None, medium=None, slow=None, fast_w=None, medium_
Sources:
https://www.tradingview.com/wiki/Ultimate_Oscillator_(UO)
- Calculation:
- Default Inputs:
- fast=7, medium=14, slow=28,
- fast_w=4.0, medium_w=2.0, slow_w=1.0, drift=1
- min_low_or_pc = close.shift(drift).combine(low, min)
- max_high_or_pc = close.shift(drift).combine(high, max)
-
- bp = buying pressure = close - min_low_or_pc
- tr = true range = max_high_or_pc - min_low_or_pc
-
- fast_avg = SUM(bp, fast) / SUM(tr, fast)
- medium_avg = SUM(bp, medium) / SUM(tr, medium)
- slow_avg = SUM(bp, slow) / SUM(tr, slow)
-
- total_weight = fast_w + medium_w + slow_w
- weights = (fast_w * fast_avg) + (medium_w * medium_avg) + (slow_w * slow_avg)
- UO = 100 * weights / total_weight
-
Args:
high (pd.Series): Series of 'high's
low (pd.Series): Series of 'low's
diff --git a/pandas_ta/momentum/willr.py b/pandas_ta/momentum/willr.py
index 98f2140..38eaa57 100644
--- a/pandas_ta/momentum/willr.py
+++ b/pandas_ta/momentum/willr.py
@@ -12,14 +12,6 @@ def willr(high, low, close, length=None, talib=None, offset=None, **kwargs):
Sources:
https://www.tradingview.com/wiki/Williams_%25R_(%25R)
- Calculation:
- Default Inputs:
- length=20
- LL = low.rolling(length).min()
- HH = high.rolling(length).max()
-
- WILLR = 100 * ((close - LL) / (HH - LL) - 1)
-
Args:
high (pd.Series): Series of 'high's
low (pd.Series): Series of 'low's
diff --git a/pandas_ta/overlap/alligator.py b/pandas_ta/overlap/alligator.py
index 5a14e9c..2ed3d4e 100644
--- a/pandas_ta/overlap/alligator.py
+++ b/pandas_ta/overlap/alligator.py
@@ -20,15 +20,6 @@ def alligator(close, jaw=None, teeth=None, lips=None, talib=None, offset=None, *
https://www.tradingview.com/scripts/alligator/
https://www.sierrachart.com/index.php?page=doc/StudiesReference.php&ID=175&Name=Bill_Williams_Alligator
- Calculation:
- Default Inputs:
- jaw=13, teeth=8, lips=5, mamode="sma"
- SMMA = SMoothed Moving Average
-
- JAW = SMMA(close, jaw)
- TEETH = SMMA(close, teeth)
- LIPS = SMMA(close, lips)
-
Args:
close (pd.Series): Series of 'close's
jaw (int): The Jaw period. Default: 13
diff --git a/pandas_ta/overlap/alma.py b/pandas_ta/overlap/alma.py
index 9a8dc24..72690c1 100644
--- a/pandas_ta/overlap/alma.py
+++ b/pandas_ta/overlap/alma.py
@@ -24,14 +24,6 @@ def alma(close, length=None, sigma=None, dist_offset=None, offset=None, **kwargs
https://www.sierrachart.com/index.php?page=doc/StudiesReference.php&ID=475&Name=Moving_Average_-_Arnaud_Legoux
https://www.prorealcode.com/prorealtime-indicators/alma-arnaud-legoux-moving-average/
- Calculation:
- length=9, sigma=6.0, dist_offset=0.85
-
- X = [0, 1, ..., length - 1]
- WEIGHTS = e^(-0.5 * (X - FLOOR(dist_offset(length - 1)))^2 / (length / sigma)^2)
-
- ALMA = close.rolling(length).apply(WEIGHTS)
-
Args:
close (pd.Series): Series of 'close's
length (int): It's period, window size. Default: 9
diff --git a/pandas_ta/overlap/dema.py b/pandas_ta/overlap/dema.py
index fa45a62..149e8f1 100644
--- a/pandas_ta/overlap/dema.py
+++ b/pandas_ta/overlap/dema.py
@@ -13,15 +13,6 @@ def dema(close, length=None, talib=None, offset=None, **kwargs):
Sources:
https://www.tradingtechnologies.com/help/x-study/technical-indicator-definitions/double-exponential-moving-average-dema/
- Calculation:
- Default Inputs:
- length=10
- EMA = Exponential Moving Average
- ema1 = EMA(close, length)
- ema2 = EMA(ema1, length)
-
- DEMA = 2 * ema1 - ema2
-
Args:
close (pd.Series): Series of 'close's
length (int): It's period. Default: 10
diff --git a/pandas_ta/overlap/ema.py b/pandas_ta/overlap/ema.py
index 4ba812d..70682ef 100644
--- a/pandas_ta/overlap/ema.py
+++ b/pandas_ta/overlap/ema.py
@@ -17,15 +17,6 @@ def ema(close, length=None, talib=None, offset=None, **kwargs):
https://stockcharts.com/school/doku.php?id=chart_school:technical_indicators:moving_averages
https://www.investopedia.com/ask/answers/122314/what-exponential-moving-average-ema-formula-and-how-ema-calculated.asp
- Calculation:
- Default Inputs:
- length=10, adjust=False, sma=True
- if sma:
- sma_nth = close[0:length].sum() / length
- close[:length - 1] = np.NaN
- close.iloc[length - 1] = sma_nth
- EMA = close.ewm(span=length, adjust=adjust).mean()
-
Args:
close (pd.Series): Series of 'close's
length (int): It's period. Default: 10
diff --git a/pandas_ta/overlap/fwma.py b/pandas_ta/overlap/fwma.py
index 161b0cb..cdd7733 100644
--- a/pandas_ta/overlap/fwma.py
+++ b/pandas_ta/overlap/fwma.py
@@ -10,18 +10,6 @@ def fwma(close, length=None, asc=None, offset=None, **kwargs):
Source: Kevin Johnson
- Calculation:
- Default Inputs:
- length=10,
-
- def weights(w):
- def _compute(x):
- return np.dot(w * x)
- return _compute
-
- fibs = utils.fibonacci(length - 1)
- FWMA = close.rolling(length)_.apply(weights(fibs), raw=True)
-
Args:
close (pd.Series): Series of 'close's
length (int): It's period. Default: 10
diff --git a/pandas_ta/overlap/hilo.py b/pandas_ta/overlap/hilo.py
index 5bfc7da..c467442 100644
--- a/pandas_ta/overlap/hilo.py
+++ b/pandas_ta/overlap/hilo.py
@@ -23,33 +23,6 @@ def hilo(high, low, close, high_length=None, low_length=None, mamode=None, offse
https://www.tradingtechnologies.com/help/x-study/technical-indicator-definitions/simple-moving-average-sma/
https://www.tradingview.com/script/XNQSLIYb-Gann-High-Low/
- Calculation:
- Default Inputs:
- high_length=13, low_length=21, mamode="sma"
- EMA = Exponential Moving Average
- HMA = Hull Moving Average
- SMA = Simple Moving Average # Default
-
- if "ema":
- high_ma = EMA(high, high_length)
- low_ma = EMA(low, low_length)
- elif "hma":
- high_ma = HMA(high, high_length)
- low_ma = HMA(low, low_length)
- else: # "sma"
- high_ma = SMA(high, high_length)
- low_ma = SMA(low, low_length)
-
- # Similar to Supertrend MA selection
- hilo = Series(npNaN, index=close.index)
- for i in range(1, m):
- if close.iloc[i] > high_ma.iloc[i - 1]:
- hilo.iloc[i] = low_ma.iloc[i]
- elif close.iloc[i] < low_ma.iloc[i - 1]:
- hilo.iloc[i] = high_ma.iloc[i]
- else:
- hilo.iloc[i] = hilo.iloc[i - 1]
-
Args:
high (pd.Series): Series of 'high's
low (pd.Series): Series of 'low's
diff --git a/pandas_ta/overlap/hl2.py b/pandas_ta/overlap/hl2.py
index d6383c9..a5236e9 100644
--- a/pandas_ta/overlap/hl2.py
+++ b/pandas_ta/overlap/hl2.py
@@ -5,12 +5,12 @@ from pandas_ta.utils import get_offset, verify_series
def hl2(high, low, offset=None, **kwargs):
"""HL2
- Calculation:
- HL2 = 0.5 * (high + low)
+ HL2 is the midpoint/average of high and low.
Args:
high (pd.Series): Series of 'high's
low (pd.Series): Series of 'low's
+ offset (int): How many periods to offset the result. Default: 0
Returns:
pd.Series: New feature generated.
diff --git a/pandas_ta/overlap/hlc3.py b/pandas_ta/overlap/hlc3.py
index 20558f1..4c3b241 100644
--- a/pandas_ta/overlap/hlc3.py
+++ b/pandas_ta/overlap/hlc3.py
@@ -6,13 +6,13 @@ from pandas_ta.utils import get_offset, verify_series
def hlc3(high, low, close, talib=None, offset=None, **kwargs):
"""HLC3
- Calculation:
- HLC3 = (high + low + close) / 3.0
+ HLC3 is the average of high, low and close.
Args:
high (pd.Series): Series of 'high's
low (pd.Series): Series of 'low's
close (pd.Series): Series of 'close's
+ offset (int): How many periods to offset the result. Default: 0
Returns:
pd.Series: New feature generated.
diff --git a/pandas_ta/overlap/hma.py b/pandas_ta/overlap/hma.py
index 0b7f8c5..05413bd 100644
--- a/pandas_ta/overlap/hma.py
+++ b/pandas_ta/overlap/hma.py
@@ -13,17 +13,6 @@ def hma(close, length=None, offset=None, **kwargs):
Sources:
https://alanhull.com/hull-moving-average
- Calculation:
- Default Inputs:
- length=10
- WMA = Weighted Moving Average
- half_length = int(0.5 * length)
- sqrt_length = int(sqrt(length))
-
- wmaf = WMA(close, half_length)
- wmas = WMA(close, length)
- HMA = WMA(2 * wmaf - wmas, sqrt_length)
-
Args:
close (pd.Series): Series of 'close's
length (int): It's period. Default: 10
diff --git a/pandas_ta/overlap/hwma.py b/pandas_ta/overlap/hwma.py
index 0616c19..a03f769 100644
--- a/pandas_ta/overlap/hwma.py
+++ b/pandas_ta/overlap/hwma.py
@@ -16,19 +16,12 @@ def hwma(close, na=None, nb=None, nc=None, offset=None, **kwargs):
Sources:
https://www.mql5.com/en/code/20856
- Calculation:
- HWMA[i] = F[i] + V[i] + 0.5 * A[i]
- where..
- F[i] = (1-na) * (F[i-1] + V[i-1] + 0.5 * A[i-1]) + na * Price[i]
- V[i] = (1-nb) * (V[i-1] + A[i-1]) + nb * (F[i] - F[i-1])
- A[i] = (1-nc) * A[i-1] + nc * (V[i] - V[i-1])
-
Args:
close (pd.Series): Series of 'close's
na (float): Smoothed series parameter (from 0 to 1). Default: 0.2
nb (float): Trend parameter (from 0 to 1). Default: 0.1
nc (float): Seasonality parameter (from 0 to 1). Default: 0.1
- close (pd.Series): Series of 'close's
+ offset (int): How many periods to offset the result. Default: 0
Kwargs:
fillna (value, optional): pd.DataFrame.fillna(value)
diff --git a/pandas_ta/overlap/ichimoku.py b/pandas_ta/overlap/ichimoku.py
index 2aec18c..f0cc4c1 100644
--- a/pandas_ta/overlap/ichimoku.py
+++ b/pandas_ta/overlap/ichimoku.py
@@ -12,20 +12,6 @@ def ichimoku(high, low, close, tenkan=None, kijun=None, senkou=None, include_chi
Sources:
https://www.tradingtechnologies.com/help/x-study/technical-indicator-definitions/ichimoku-ich/
- Calculation:
- Default Inputs:
- tenkan=9, kijun=26, senkou=52
- MIDPRICE = Midprice
- TENKAN_SEN = MIDPRICE(high, low, close, length=tenkan)
- KIJUN_SEN = MIDPRICE(high, low, close, length=kijun)
- CHIKOU_SPAN = close.shift(-kijun)
-
- SPAN_A = 0.5 * (TENKAN_SEN + KIJUN_SEN)
- SPAN_A = SPAN_A.shift(kijun)
-
- SPAN_B = MIDPRICE(high, low, close, length=senkou)
- SPAN_B = SPAN_B.shift(kijun)
-
Args:
high (pd.Series): Series of 'high's
low (pd.Series): Series of 'low's
diff --git a/pandas_ta/overlap/jma.py b/pandas_ta/overlap/jma.py
index e20f8f5..ebd851b 100644
--- a/pandas_ta/overlap/jma.py
+++ b/pandas_ta/overlap/jma.py
@@ -20,10 +20,6 @@ def jma(close, length=None, phase=None, offset=None, **kwargs):
https://c.mql5.com/forextsd/forum/164/jurik_1.pdf
https://www.prorealcode.com/prorealtime-indicators/jurik-volatility-bands/
- Calculation:
- Default Inputs:
- length=7, phase=0
-
Args:
close (pd.Series): Series of 'close's
length (int): Period of calculation. Default: 7
@@ -99,8 +95,8 @@ def jma(close, length=None, phase=None, offset=None, **kwargs):
jma[i] = jma[i-1] + det1
# Remove initial lookback data and convert to pandas frame
- jma[0:_length - 1] = npNaN
jma = Series(jma, index=close.index)
+ jma.iloc[0:_length - 1] = npNaN
# Offset
if offset != 0:
diff --git a/pandas_ta/overlap/kama.py b/pandas_ta/overlap/kama.py
index 009616d..aa75b40 100644
--- a/pandas_ta/overlap/kama.py
+++ b/pandas_ta/overlap/kama.py
@@ -18,10 +18,6 @@ def kama(close, length=None, fast=None, slow=None, mamode=None, drift=None, offs
https://stockcharts.com/school/doku.php?id=chart_school:technical_indicators:kaufman_s_adaptive_moving_average
https://www.tradingview.com/script/wZGOIz9r-REPOST-Indicators-3-Different-Adaptive-Moving-Averages/
- Calculation:
- Default Inputs:
- length=10
-
Args:
close (pd.Series): Series of 'close's
length (int): It's period. Default: 10
diff --git a/pandas_ta/overlap/linreg.py b/pandas_ta/overlap/linreg.py
index 58e61ad..f673ef2 100644
--- a/pandas_ta/overlap/linreg.py
+++ b/pandas_ta/overlap/linreg.py
@@ -18,25 +18,6 @@ def linreg(close, length=None, talib=None, offset=None, **kwargs):
Source: TA Lib
- Calculation:
- Default Inputs:
- length=14
- x = [1, 2, ..., n]
- x_sum = 0.5 * length * (length + 1)
- x2_sum = length * (length + 1) * (2 * length + 1) / 6
- divisor = length * x2_sum - x_sum * x_sum
-
- lr(series):
- y_sum = series.sum()
- y2_sum = (series* series).sum()
- xy_sum = (x * series).sum()
-
- m = (length * xy_sum - x_sum * y_sum) / divisor
- b = (y_sum * x2_sum - x_sum * xy_sum) / divisor
- return m * (length - 1) + b
-
- linreg = close.rolling(length).apply(lr)
-
Args:
close (pd.Series): Series of 'close's
length (int): It's period. Default: 10
diff --git a/pandas_ta/overlap/mcgd.py b/pandas_ta/overlap/mcgd.py
index 54f63f6..8607314 100644
--- a/pandas_ta/overlap/mcgd.py
+++ b/pandas_ta/overlap/mcgd.py
@@ -16,24 +16,11 @@ def mcgd(close, length=None, offset=None, c=None, **kwargs):
Sources:
https://www.investopedia.com/articles/forex/09/mcginley-dynamic-indicator.asp
- Calculation:
- Default Inputs:
- length=10
- offset=0
- c=1
-
- def mcg_(series):
- denom = (constant * length * (series.iloc[1] / series.iloc[0]) ** 4)
- series.iloc[1] = (series.iloc[0] + ((series.iloc[1] - series.iloc[0]) / denom))
- return series.iloc[1]
- mcg_cell = close[0:].rolling(2, min_periods=2).apply(mcg_, raw=False)
- mcg_ds = close[:1].append(mcg_cell[1:])
-
Args:
close (pd.Series): Series of 'close's
length (int): Indicator's period. Default: 10
- offset (int): Number of periods to offset the result. Default: 0
c (float): Multiplier for the denominator, sometimes set to 0.6. Default: 1
+ offset (int): Number of periods to offset the result. Default: 0
Kwargs:
fillna (value, optional): pd.DataFrame.fillna(value)
diff --git a/pandas_ta/overlap/midpoint.py b/pandas_ta/overlap/midpoint.py
index f432f8b..dd678d0 100644
--- a/pandas_ta/overlap/midpoint.py
+++ b/pandas_ta/overlap/midpoint.py
@@ -8,15 +8,6 @@ def midpoint(close, length=None, talib=None, offset=None, **kwargs):
The Midpoint is the average of the rolling high and low of period length.
- Sources:
-
- Calculation:
- Default Inputs:
- length=2
- HC = close.rolling(length).max()
- LC = close.rolling(length).min()
- MID = 0.5 * (HC + LC)
-
Args:
close (pd.Series): Series of 'close's
length (int): It's period. Default: 2
diff --git a/pandas_ta/overlap/midprice.py b/pandas_ta/overlap/midprice.py
index 4531b5c..08d1aff 100644
--- a/pandas_ta/overlap/midprice.py
+++ b/pandas_ta/overlap/midprice.py
@@ -8,15 +8,6 @@ def midprice(high, low, length=None, talib=None, offset=None, **kwargs):
The Midprice is the average of the rolling high and low of period length.
- Sources:
-
- Calculation:
- Default Inputs:
- length=2
- HH = high.rolling(length).max()
- LL = low.rolling(length).min()
- MID = 0.5 * (HH + LL)
-
Args:
high (pd.Series): Series of 'high's
low (pd.Series): Series of 'low's
diff --git a/pandas_ta/overlap/ohlc4.py b/pandas_ta/overlap/ohlc4.py
index 75ca8fc..02495aa 100644
--- a/pandas_ta/overlap/ohlc4.py
+++ b/pandas_ta/overlap/ohlc4.py
@@ -5,14 +5,14 @@ from pandas_ta.utils import get_offset, verify_series
def ohlc4(open_, high, low, close, offset=None, **kwargs):
"""OHLC4
- Calculation:
- OHLC4 = 0.25 * (open + high + low + close)
+ OHLC4 is the average of open, high, low and close.
Args:
open_ (pd.Series): Series of 'open's
high (pd.Series): Series of 'high's
low (pd.Series): Series of 'low's
close (pd.Series): Series of 'close's
+ offset (int): How many periods to offset the result. Default: 0
Returns:
pd.Series: New feature generated.
diff --git a/pandas_ta/overlap/pwma.py b/pandas_ta/overlap/pwma.py
index 6f33786..c0fe60e 100644
--- a/pandas_ta/overlap/pwma.py
+++ b/pandas_ta/overlap/pwma.py
@@ -10,18 +10,6 @@ def pwma(close, length=None, asc=None, offset=None, **kwargs):
Source: Kevin Johnson
- Calculation:
- Default Inputs:
- length=10
-
- def weights(w):
- def _compute(x):
- return np.dot(w * x)
- return _compute
-
- triangle = utils.pascals_triangle(length + 1)
- PWMA = close.rolling(length)_.apply(weights(triangle), raw=True)
-
Args:
close (pd.Series): Series of 'close's
length (int): It's period. Default: 10
diff --git a/pandas_ta/overlap/rma.py b/pandas_ta/overlap/rma.py
index 1cdeb0f..0e1e5fb 100644
--- a/pandas_ta/overlap/rma.py
+++ b/pandas_ta/overlap/rma.py
@@ -12,13 +12,6 @@ def rma(close, length=None, offset=None, **kwargs):
https://tlc.thinkorswim.com/center/reference/Tech-Indicators/studies-library/V-Z/WildersSmoothing
https://www.incrediblecharts.com/indicators/wilder_moving_average.php
- Calculation:
- Default Inputs:
- length=10
- EMA = Exponential Moving Average
- alpha = 1 / length
- RMA = EMA(close, alpha=alpha)
-
Args:
close (pd.Series): Series of 'close's
length (int): It's period. Default: 10
diff --git a/pandas_ta/overlap/sinwma.py b/pandas_ta/overlap/sinwma.py
index c8ee00a..f7a50bd 100644
--- a/pandas_ta/overlap/sinwma.py
+++ b/pandas_ta/overlap/sinwma.py
@@ -15,19 +15,6 @@ def sinwma(close, length=None, offset=None, **kwargs):
https://www.tradingview.com/script/6MWFvnPO-Sine-Weighted-Moving-Average/
Author: Everget (https://www.tradingview.com/u/everget/)
- Calculation:
- Default Inputs:
- length=10
-
- def weights(w):
- def _compute(x):
- return np.dot(w * x)
- return _compute
-
- sines = Series([sin((i + 1) * pi / (length + 1)) for i in range(0, length)])
- w = sines / sines.sum()
- SINWMA = close.rolling(length, min_periods=length).apply(weights(w), raw=True)
-
Args:
close (pd.Series): Series of 'close's
length (int): It's period. Default: 10
diff --git a/pandas_ta/overlap/sma.py b/pandas_ta/overlap/sma.py
index a6a9dcc..59381f7 100644
--- a/pandas_ta/overlap/sma.py
+++ b/pandas_ta/overlap/sma.py
@@ -12,11 +12,6 @@ def sma(close, length=None, talib=None, offset=None, **kwargs):
Sources:
https://www.tradingtechnologies.com/help/x-study/technical-indicator-definitions/simple-moving-average-sma/
- Calculation:
- Default Inputs:
- length=10
- SMA = SUM(close, length) / length
-
Args:
close (pd.Series): Series of 'close's
length (int): It's period. Default: 10
diff --git a/pandas_ta/overlap/smma.py b/pandas_ta/overlap/smma.py
index 9f37804..1c6f3cc 100644
--- a/pandas_ta/overlap/smma.py
+++ b/pandas_ta/overlap/smma.py
@@ -20,14 +20,6 @@ def smma(close, length=None, mamode=None, talib=None, offset=None, **kwargs):
https://www.tradingview.com/scripts/smma/
https://www.sierrachart.com/index.php?page=doc/StudiesReference.php&ID=173&Name=Moving_Average_-_Smoothed
- Calculation:
- Default Inputs:
- length=10, mamode="sma"
- MA = Moving Average
-
- SMMA[0:length] = MA(mamode, close, length)
- SMMA[:length] = ((length - 1) * SMMA[i] + close[i]) / length
-
Args:
close (pd.Series): Series of 'close's
length (int): It's period. Default: 10
@@ -57,7 +49,7 @@ def smma(close, length=None, mamode=None, talib=None, offset=None, **kwargs):
m = close.size
smma = close.copy()
smma[:length - 1] = npNaN
- smma.iloc[length - 1] = ma(mamode, close[0:length], length=length, talib=mode_tal)[-1]
+ smma.iloc[length - 1] = ma(mamode, close[0:length], length=length, talib=mode_tal).iloc[-1]
for i in range(length, m):
smma.iloc[i] = ((length - 1) * smma.iloc[i - 1] + smma.iloc[i]) / length
diff --git a/pandas_ta/overlap/ssf.py b/pandas_ta/overlap/ssf.py
index e13995e..5707b74 100644
--- a/pandas_ta/overlap/ssf.py
+++ b/pandas_ta/overlap/ssf.py
@@ -24,12 +24,6 @@ def ssf(close, length=None, poles=None, offset=None, **kwargs):
https://www.mql5.com/en/code/588
https://www.mql5.com/en/code/589
- Calculation:
- Default Inputs:
- length=10, poles=[2, 3]
-
- See the source code or Sources listed above.
-
Args:
close (pd.Series): Series of 'close's
length (int): It's period. Default: 10
diff --git a/pandas_ta/overlap/supertrend.py b/pandas_ta/overlap/supertrend.py
index 5be59f5..d192eca 100644
--- a/pandas_ta/overlap/supertrend.py
+++ b/pandas_ta/overlap/supertrend.py
@@ -16,31 +16,6 @@ def supertrend(high, low, close, length=None, multiplier=None, offset=None, **kw
Sources:
http://www.freebsensetips.com/blog/detail/7/What-is-supertrend-indicator-its-calculation
- Calculation:
- Default Inputs:
- length=7, multiplier=3.0
- Default Direction:
- Set to +1 or bullish trend at start
-
- MID = multiplier * ATR
- LOWERBAND = HL2 - MID
- UPPERBAND = HL2 + MID
-
- if UPPERBAND[i] < FINAL_UPPERBAND[i-1] and close[i-1] > FINAL_UPPERBAND[i-1]:
- FINAL_UPPERBAND[i] = UPPERBAND[i]
- else:
- FINAL_UPPERBAND[i] = FINAL_UPPERBAND[i-1])
-
- if LOWERBAND[i] > FINAL_LOWERBAND[i-1] and close[i-1] < FINAL_LOWERBAND[i-1]:
- FINAL_LOWERBAND[i] = LOWERBAND[i]
- else:
- FINAL_LOWERBAND[i] = FINAL_LOWERBAND[i-1])
-
- if close[i] <= FINAL_UPPERBAND[i]:
- SUPERTREND[i] = FINAL_UPPERBAND[i]
- else:
- SUPERTREND[i] = FINAL_LOWERBAND[i]
-
Args:
high (pd.Series): Series of 'high's
low (pd.Series): Series of 'low's
diff --git a/pandas_ta/overlap/swma.py b/pandas_ta/overlap/swma.py
index f0ebf23..91d32bb 100644
--- a/pandas_ta/overlap/swma.py
+++ b/pandas_ta/overlap/swma.py
@@ -13,18 +13,6 @@ def swma(close, length=None, asc=None, offset=None, **kwargs):
Source:
https://www.tradingview.com/study-script-reference/#fun_swma
- Calculation:
- Default Inputs:
- length=10
-
- def weights(w):
- def _compute(x):
- return np.dot(w * x)
- return _compute
-
- triangle = utils.symmetric_triangle(length - 1)
- SWMA = close.rolling(length)_.apply(weights(triangle), raw=True)
-
Args:
close (pd.Series): Series of 'close's
length (int): It's period. Default: 10
diff --git a/pandas_ta/overlap/t3.py b/pandas_ta/overlap/t3.py
index c16c170..e37f157 100644
--- a/pandas_ta/overlap/t3.py
+++ b/pandas_ta/overlap/t3.py
@@ -13,22 +13,6 @@ def t3(close, length=None, a=None, talib=None, offset=None, **kwargs):
Sources:
http://www.binarytribune.com/forex-trading-indicators/t3-moving-average-indicator/
- Calculation:
- Default Inputs:
- length=10, a=0.7
- c1 = -a^3
- c2 = 3a^2 + 3a^3 = 3a^2 * (1 + a)
- c3 = -6a^2 - 3a - 3a^3
- c4 = a^3 + 3a^2 + 3a + 1
-
- ema1 = EMA(close, length)
- ema2 = EMA(ema1, length)
- ema3 = EMA(ema2, length)
- ema4 = EMA(ema3, length)
- ema5 = EMA(ema4, length)
- ema6 = EMA(ema5, length)
- T3 = c1 * ema6 + c2 * ema5 + c3 * ema4 + c4 * ema3
-
Args:
close (pd.Series): Series of 'close's
length (int): It's period. Default: 10
diff --git a/pandas_ta/overlap/tema.py b/pandas_ta/overlap/tema.py
index d963e08..10b3096 100644
--- a/pandas_ta/overlap/tema.py
+++ b/pandas_ta/overlap/tema.py
@@ -12,15 +12,6 @@ def tema(close, length=None, talib=None, offset=None, **kwargs):
Sources:
https://www.tradingtechnologies.com/help/x-study/technical-indicator-definitions/triple-exponential-moving-average-tema/
- Calculation:
- Default Inputs:
- length=10
- EMA = Exponential Moving Average
- ema1 = EMA(close, length)
- ema2 = EMA(ema1, length)
- ema3 = EMA(ema2, length)
- TEMA = 3 * (ema1 - ema2) + ema3
-
Args:
close (pd.Series): Series of 'close's
length (int): It's period. Default: 10
diff --git a/pandas_ta/overlap/trima.py b/pandas_ta/overlap/trima.py
index b364c9a..76f0bdc 100644
--- a/pandas_ta/overlap/trima.py
+++ b/pandas_ta/overlap/trima.py
@@ -15,14 +15,6 @@ def trima(close, length=None, talib=None, offset=None, **kwargs):
tma = sma(sma(src, ceil(length / 2)), floor(length / 2) + 1) # Tradingview
trima = sma(sma(x, n), n) # Tradingview
- Calculation:
- Default Inputs:
- length=10
- SMA = Simple Moving Average
- half_length = round(0.5 * (length + 1))
- SMA1 = SMA(close, half_length)
- TRIMA = SMA(SMA1, half_length)
-
Args:
close (pd.Series): Series of 'close's
length (int): It's period. Default: 10
diff --git a/pandas_ta/overlap/vidya.py b/pandas_ta/overlap/vidya.py
index b529614..0c0273a 100644
--- a/pandas_ta/overlap/vidya.py
+++ b/pandas_ta/overlap/vidya.py
@@ -17,15 +17,6 @@ def vidya(close, length=None, drift=None, offset=None, **kwargs):
https://www.tradingview.com/script/hdrf0fXV-Variable-Index-Dynamic-Average-VIDYA/
https://www.perfecttrendsystem.com/blog_mt4_2/en/vidya-indicator-for-mt4
- Calculation:
- Default Inputs:
- length=10, adjust=False, sma=True
- if sma:
- sma_nth = close[0:length].sum() / length
- close[:length - 1] = np.NaN
- close.iloc[length - 1] = sma_nth
- EMA = close.ewm(span=length, adjust=adjust).mean()
-
Args:
close (pd.Series): Series of 'close's
length (int): It's period. Default: 14
diff --git a/pandas_ta/overlap/vwap.py b/pandas_ta/overlap/vwap.py
index cce8d14..591a378 100644
--- a/pandas_ta/overlap/vwap.py
+++ b/pandas_ta/overlap/vwap.py
@@ -14,11 +14,6 @@ def vwap(high, low, close, volume, anchor=None, offset=None, **kwargs):
https://www.tradingtechnologies.com/help/x-study/technical-indicator-definitions/volume-weighted-average-price-vwap/
https://stockcharts.com/school/doku.php?id=chart_school:technical_indicators:vwap_intraday
- Calculation:
- tp = typical_price = hlc3(high, low, close)
- tpv = tp * volume
- VWAP = tpv.cumsum() / volume.cumsum()
-
Args:
high (pd.Series): Series of 'high's
low (pd.Series): Series of 'low's
diff --git a/pandas_ta/overlap/vwma.py b/pandas_ta/overlap/vwma.py
index 7da8115..205fa7c 100644
--- a/pandas_ta/overlap/vwma.py
+++ b/pandas_ta/overlap/vwma.py
@@ -11,13 +11,6 @@ def vwma(close, volume, length=None, offset=None, **kwargs):
Sources:
https://www.motivewave.com/studies/volume_weighted_moving_average.htm
- Calculation:
- Default Inputs:
- length=10
- SMA = Simple Moving Average
- pv = close * volume
- VWMA = SMA(pv, length) / SMA(volume, length)
-
Args:
close (pd.Series): Series of 'close's
volume (pd.Series): Series of 'volume's
diff --git a/pandas_ta/overlap/wcp.py b/pandas_ta/overlap/wcp.py
index 72ba149..a234eeb 100644
--- a/pandas_ta/overlap/wcp.py
+++ b/pandas_ta/overlap/wcp.py
@@ -12,9 +12,6 @@ def wcp(high, low, close, talib=None, offset=None, **kwargs):
Sources:
https://www.fmlabs.com/reference/default.htm?url=WeightedCloses.htm
- Calculation:
- WCP = (2 * close + high + low) / 4
-
Args:
high (pd.Series): Series of 'high's
low (pd.Series): Series of 'low's
diff --git a/pandas_ta/overlap/wma.py b/pandas_ta/overlap/wma.py
index 2bf00ba..b77a70a 100644
--- a/pandas_ta/overlap/wma.py
+++ b/pandas_ta/overlap/wma.py
@@ -13,20 +13,6 @@ def wma(close, length=None, asc=None, talib=None, offset=None, **kwargs):
Sources:
https://en.wikipedia.org/wiki/Moving_average#Weighted_moving_average
- Calculation:
- Default Inputs:
- length=10, asc=True
- total_weight = 0.5 * length * (length + 1)
- weights_ = [1, 2, ..., length + 1] # Ascending
- weights = weights if asc else weights[::-1]
-
- def linear_weights(w):
- def _compute(x):
- return (w * x).sum() / total_weight
- return _compute
-
- WMA = close.rolling(length)_.apply(linear_weights(weights), raw=True)
-
Args:
close (pd.Series): Series of 'close's
length (int): It's period. Default: 10
diff --git a/pandas_ta/overlap/zlma.py b/pandas_ta/overlap/zlma.py
index a370d13..a2a0c83 100644
--- a/pandas_ta/overlap/zlma.py
+++ b/pandas_ta/overlap/zlma.py
@@ -15,15 +15,6 @@ def zlma(close, length=None, mamode=None, offset=None, **kwargs):
Sources:
https://en.wikipedia.org/wiki/Zero_lag_exponential_moving_average
- Calculation:
- Default Inputs:
- length=10, mamode=EMA
- EMA = Exponential Moving Average
- lag = int(0.5 * (length - 1))
-
- SOURCE = 2 * close - close.shift(lag)
- ZLMA = MA(kind=mamode, SOURCE, length)
-
Args:
close (pd.Series): Series of 'close's
length (int): It's period. Default: 10
diff --git a/pandas_ta/performance/drawdown.py b/pandas_ta/performance/drawdown.py
index ef6b385..021da08 100644
--- a/pandas_ta/performance/drawdown.py
+++ b/pandas_ta/performance/drawdown.py
@@ -15,12 +15,6 @@ def drawdown(close, offset=None, **kwargs) -> DataFrame:
Sources:
https://www.investopedia.com/terms/d/drawdown.asp
- Calculation:
- PEAKDD = close.cummax()
- DD = PEAKDD - close
- DD% = 1 - (close / PEAKDD)
- DDlog = log(PEAKDD / close)
-
Args:
close (pd.Series): Series of 'close's.
offset (int): How many periods to offset the result. Default: 0
diff --git a/pandas_ta/performance/log_return.py b/pandas_ta/performance/log_return.py
index a2b9fe4..9c125d7 100644
--- a/pandas_ta/performance/log_return.py
+++ b/pandas_ta/performance/log_return.py
@@ -12,12 +12,6 @@ def log_return(close, length=None, cumulative=None, offset=None, **kwargs):
Sources:
https://stackoverflow.com/questions/31287552/logarithmic-returns-in-pandas-dataframe
- Calculation:
- Default Inputs:
- length=1, cumulative=False
- LOGRET = log( close.diff(periods=length) )
- CUMLOGRET = LOGRET.cumsum() if cumulative
-
Args:
close (pd.Series): Series of 'close's
length (int): It's period. Default: 20
diff --git a/pandas_ta/performance/percent_return.py b/pandas_ta/performance/percent_return.py
index 0ab8369..864a909 100644
--- a/pandas_ta/performance/percent_return.py
+++ b/pandas_ta/performance/percent_return.py
@@ -11,12 +11,6 @@ def percent_return(close, length=None, cumulative=None, offset=None, **kwargs):
Sources:
https://stackoverflow.com/questions/31287552/logarithmic-returns-in-pandas-dataframe
- Calculation:
- Default Inputs:
- length=1, cumulative=False
- PCTRET = close.pct_change(length)
- CUMPCTRET = PCTRET.cumsum() if cumulative
-
Args:
close (pd.Series): Series of 'close's
length (int): It's period. Default: 20
diff --git a/pandas_ta/statistics/entropy.py b/pandas_ta/statistics/entropy.py
index 11c74a0..0fa515a 100644
--- a/pandas_ta/statistics/entropy.py
+++ b/pandas_ta/statistics/entropy.py
@@ -13,13 +13,6 @@ def entropy(close, length=None, base=None, offset=None, **kwargs):
Sources:
https://en.wikipedia.org/wiki/Entropy_(information_theory)
- Calculation:
- Default Inputs:
- length=10, base=2
-
- P = close / SUM(close, length)
- E = SUM(-P * npLog(P) / npLog(base), length)
-
Args:
close (pd.Series): Series of 'close's
length (int): It's period. Default: 10
diff --git a/pandas_ta/statistics/kurtosis.py b/pandas_ta/statistics/kurtosis.py
index d5641f8..a269c46 100644
--- a/pandas_ta/statistics/kurtosis.py
+++ b/pandas_ta/statistics/kurtosis.py
@@ -7,11 +7,6 @@ def kurtosis(close, length=None, offset=None, **kwargs):
Calculates the Kurtosis over a rolling period.
- Calculation:
- Default Inputs:
- length=30
- KURTOSIS = close.rolling(length).kurt()
-
Args:
close (pd.Series): Series of 'close's
length (int): It's period. Default: 30
diff --git a/pandas_ta/statistics/mad.py b/pandas_ta/statistics/mad.py
index b23462e..57c9035 100644
--- a/pandas_ta/statistics/mad.py
+++ b/pandas_ta/statistics/mad.py
@@ -8,11 +8,6 @@ def mad(close, length=None, offset=None, **kwargs):
Calculates the Mean Absolute Deviation over a rolling period.
- Calculation:
- Default Inputs:
- length=30
- mad = close.rolling(length).mad()
-
Args:
close (pd.Series): Series of 'close's
length (int): It's period. Default: 30
diff --git a/pandas_ta/statistics/median.py b/pandas_ta/statistics/median.py
index e650bfd..f9757ba 100644
--- a/pandas_ta/statistics/median.py
+++ b/pandas_ta/statistics/median.py
@@ -10,11 +10,6 @@ def median(close, length=None, offset=None, **kwargs):
Sources:
https://www.incrediblecharts.com/indicators/median_price.php
- Calculation:
- Default Inputs:
- length=30
- MEDIAN = close.rolling(length).median()
-
Args:
close (pd.Series): Series of 'close's
length (int): It's period. Default: 30
diff --git a/pandas_ta/statistics/quantile.py b/pandas_ta/statistics/quantile.py
index fd01af2..3d11ad7 100644
--- a/pandas_ta/statistics/quantile.py
+++ b/pandas_ta/statistics/quantile.py
@@ -7,11 +7,6 @@ def quantile(close, length=None, q=None, offset=None, **kwargs):
Calculates the Quantile over a rolling period.
- Calculation:
- Default Inputs:
- length=30, q=0.5
- QUANTILE = close.rolling(length).quantile(q)
-
Args:
close (pd.Series): Series of 'close's
length (int): It's period. Default: 30
diff --git a/pandas_ta/statistics/skew.py b/pandas_ta/statistics/skew.py
index 4af7b37..f89e50f 100644
--- a/pandas_ta/statistics/skew.py
+++ b/pandas_ta/statistics/skew.py
@@ -7,11 +7,6 @@ def skew(close, length=None, offset=None, **kwargs):
Calculates the Skew over a rolling period.
- Calculation:
- Default Inputs:
- length=30
- SKEW = close.rolling(length).skew()
-
Args:
close (pd.Series): Series of 'close's
length (int): It's period. Default: 30
diff --git a/pandas_ta/statistics/stdev.py b/pandas_ta/statistics/stdev.py
index 013144a..1bc1d52 100644
--- a/pandas_ta/statistics/stdev.py
+++ b/pandas_ta/statistics/stdev.py
@@ -10,12 +10,6 @@ def stdev(close, length=None, ddof=None, talib=None, offset=None, **kwargs):
Calculates the Standard Deviation over a rolling period.
- Calculation:
- Default Inputs:
- length=30
- VAR = Variance
- STDEV = variance(close, length).apply(np.sqrt)
-
Args:
close (pd.Series): Series of 'close's
length (int): It's period. Default: 30
diff --git a/pandas_ta/statistics/tos_stdevall.py b/pandas_ta/statistics/tos_stdevall.py
index 796e729..64432f6 100644
--- a/pandas_ta/statistics/tos_stdevall.py
+++ b/pandas_ta/statistics/tos_stdevall.py
@@ -17,18 +17,6 @@ def tos_stdevall(close, length=None, stds=None, ddof=None, offset=None, **kwargs
Sources:
https://tlc.thinkorswim.com/center/reference/thinkScript/Functions/Statistical/StDevAll
- Calculation:
- Default Inputs:
- length=None (All), stds=[1, 2, 3], ddof=1
- LR = Linear Regression
- STDEV = Standard Deviation
-
- LR = LR(close, length)
- STDEV = STDEV(close, length, ddof)
- for level in stds:
- LOWER = LR - level * STDEV
- UPPER = LR + level * STDEV
-
Args:
close (pd.Series): Series of 'close's
length (int): Bars from current bar. Default: None
diff --git a/pandas_ta/statistics/variance.py b/pandas_ta/statistics/variance.py
index 1216f2d..c4443e6 100644
--- a/pandas_ta/statistics/variance.py
+++ b/pandas_ta/statistics/variance.py
@@ -8,11 +8,6 @@ def variance(close, length=None, ddof=None, talib=None, offset=None, **kwargs):
Calculates the Variance over a rolling period.
- Calculation:
- Default Inputs:
- length=30
- VARIANCE = close.rolling(length).var()
-
Args:
close (pd.Series): Series of 'close's
length (int): It's period. Default: 30
diff --git a/pandas_ta/statistics/zscore.py b/pandas_ta/statistics/zscore.py
index 9dbb9c2..c432a29 100644
--- a/pandas_ta/statistics/zscore.py
+++ b/pandas_ta/statistics/zscore.py
@@ -9,15 +9,6 @@ def zscore(close, length=None, std=None, offset=None, **kwargs):
Calculates the Z Score over a rolling period.
- Calculation:
- Default Inputs:
- length=30, std=1
- SMA = Simple Moving Average
- STDEV = Standard Deviation
- std = std * STDEV(close, length)
- mean = SMA(close, length)
- ZSCORE = (close - mean) / std
-
Args:
close (pd.Series): Series of 'close's
length (int): It's period. Default: 30
diff --git a/pandas_ta/trend/adx.py b/pandas_ta/trend/adx.py
index ee78eaa..df0943c 100644
--- a/pandas_ta/trend/adx.py
+++ b/pandas_ta/trend/adx.py
@@ -12,58 +12,8 @@ def adx(high, low, close, length=None, lensig=None, scalar=None, mamode=None, dr
the amount of movement in a single direction.
Sources:
- https://www.tradingtechnologies.com/help/x-study/technical-indicator-definitions/average-directional-movement-adx/
TA Lib Correlation: >99%
-
- Calculation:
- DMI ADX TREND 2.0 by @TraderR0BERT, NETWORTHIE.COM
- //Created by @TraderR0BERT, NETWORTHIE.COM, last updated 01/26/2016
- //DMI Indicator
- //Resolution input option for higher/lower time frames
- study(title="DMI ADX TREND 2.0", shorttitle="ADX TREND 2.0")
-
- adxlen = input(14, title="ADX Smoothing")
- dilen = input(14, title="DI Length")
- thold = input(20, title="Threshold")
-
- threshold = thold
-
- //Script for Indicator
- dirmov(len) =>
- up = change(high)
- down = -change(low)
- truerange = rma(tr, len)
- plus = fixnan(100 * rma(up > down and up > 0 ? up : 0, len) / truerange)
- minus = fixnan(100 * rma(down > up and down > 0 ? down : 0, len) / truerange)
- [plus, minus]
-
- adx(dilen, adxlen) =>
- [plus, minus] = dirmov(dilen)
- sum = plus + minus
- adx = 100 * rma(abs(plus - minus) / (sum == 0 ? 1 : sum), adxlen)
- [adx, plus, minus]
-
- [sig, up, down] = adx(dilen, adxlen)
- osob=input(40,title="Exhaustion Level for ADX, default = 40")
- col = sig >= sig[1] ? green : sig <= sig[1] ? red : gray
-
- //Plot Definitions Current Timeframe
- p1 = plot(sig, color=col, linewidth = 3, title="ADX")
- p2 = plot(sig, color=col, style=circles, linewidth=3, title="ADX")
- p3 = plot(up, color=blue, linewidth = 3, title="+DI")
- p4 = plot(up, color=blue, style=circles, linewidth=3, title="+DI")
- p5 = plot(down, color=fuchsia, linewidth = 3, title="-DI")
- p6 = plot(down, color=fuchsia, style=circles, linewidth=3, title="-DI")
- h1 = plot(threshold, color=black, linewidth =3, title="Threshold")
-
- trender = (sig >= up or sig >= down) ? 1 : 0
- bgcolor(trender>0?black:gray, transp=85)
-
- //Alert Function for ADX crossing Threshold
- Up_Cross = crossover(up, threshold)
- alertcondition(Up_Cross, title="DMI+ cross", message="DMI+ Crossing Threshold")
- Down_Cross = crossover(down, threshold)
- alertcondition(Down_Cross, title="DMI- cross", message="DMI- Crossing Threshold")
+ https://www.tradingtechnologies.com/help/x-study/technical-indicator-definitions/average-directional-movement-adx/
Args:
high (pd.Series): Series of 'high's
diff --git a/pandas_ta/trend/amat.py b/pandas_ta/trend/amat.py
index fb040e8..77c33e4 100644
--- a/pandas_ta/trend/amat.py
+++ b/pandas_ta/trend/amat.py
@@ -18,19 +18,6 @@ def amat(close=None, fast=None, slow=None, lookback=None, mamode=None, offset=No
Sources:
https://www.tradingview.com/script/Z2mq63fE-Trade-Archer-Moving-Averages-v1-4F/
- Calculation:
- Default Inputs:
- fast=8, slow=21, mamode="ema", lookback=2
- OBV = On Balance Volume
- LR = Long Run Trend
- SR = Short Run Trend
-
- FMA = ma(close, mamode, fast)
- SMA = ma(close, mamode, slow)
-
- AMAT_LR = LR(FMA, SMA, lookback)
- AMAT_SR = SR(FMA, SMA, lookback)
-
Args:
close (pd.Series): Series of 'close's
fast (int): The period of the fast moving average. Default: 8
diff --git a/pandas_ta/trend/aroon.py b/pandas_ta/trend/aroon.py
index 4265583..28066b3 100644
--- a/pandas_ta/trend/aroon.py
+++ b/pandas_ta/trend/aroon.py
@@ -14,21 +14,6 @@ def aroon(high, low, length=None, scalar=None, talib=None, offset=None, **kwargs
https://www.tradingview.com/wiki/Aroon
https://www.tradingtechnologies.com/help/x-study/technical-indicator-definitions/aroon-ar/
- Calculation:
- Default Inputs:
- length=1, scalar=100
-
- recent_maximum_index(x): return int(np.argmax(x[::-1]))
- recent_minimum_index(x): return int(np.argmin(x[::-1]))
-
- periods_from_hh = high.rolling(length + 1).apply(recent_maximum_index, raw=True)
- AROON_UP = scalar * (1 - (periods_from_hh / length))
-
- periods_from_ll = low.rolling(length + 1).apply(recent_minimum_index, raw=True)
- AROON_DN = scalar * (1 - (periods_from_ll / length))
-
- AROON_OSC = AROON_UP - AROON_DN
-
Args:
close (pd.Series): Series of 'close's
length (int): It's period. Default: 14
diff --git a/pandas_ta/trend/chop.py b/pandas_ta/trend/chop.py
index db7fd48..6cc0798 100644
--- a/pandas_ta/trend/chop.py
+++ b/pandas_ta/trend/chop.py
@@ -18,16 +18,6 @@ def chop(high, low, close, length=None, atr_length=None, ln=None, scalar=None, d
https://www.tradingview.com/scripts/choppinessindex/
https://www.motivewave.com/studies/choppiness_index.htm
- Calculation:
- Default Inputs:
- length=14, scalar=100, drift=1
- HH = high.rolling(length).max()
- LL = low.rolling(length).min()
-
- ATR_SUM = SUM(ATR(drift), length)
- CHOP = scalar * (LOG10(ATR_SUM) - LOG10(HH - LL))
- CHOP /= LOG10(length)
-
Args:
high (pd.Series): Series of 'high's
low (pd.Series): Series of 'low's
diff --git a/pandas_ta/trend/cksp.py b/pandas_ta/trend/cksp.py
index ec19ac0..65de6a7 100644
--- a/pandas_ta/trend/cksp.py
+++ b/pandas_ta/trend/cksp.py
@@ -16,21 +16,14 @@ def cksp(high, low, close, p=None, x=None, q=None, tvmode=None, offset=None, **k
view implementation uses the Welles Wilder moving average, the book uses a
simple moving average.
+ Defaults:
+ Book: p=10, x=3, q=20
+ Trading View: p=10, x=1, q=9
+
Sources:
https://www.multicharts.com/discussion/viewtopic.php?t=48914
"The New Technical Trader", Wikey 1st ed. ISBN 9780471597803, page 95
- Calculation:
- Default Inputs:
- p=10, x=1, q=9, tvmode=True
- ATR = Average True Range
-
- LS0 = high.rolling(p).max() - x * ATR(length=p)
- LS = LS0.rolling(q).max()
-
- SS0 = high.rolling(p).min() + x * ATR(length=p)
- SS = SS0.rolling(q).min()
-
Args:
close (pd.Series): Series of 'close's
p (int): ATR and first stop period. Default: 10 in both modes
@@ -47,7 +40,6 @@ def cksp(high, low, close, p=None, x=None, q=None, tvmode=None, offset=None, **k
pd.DataFrame: long and short columns.
"""
# Validate Arguments
- # TV defaults=(10,1,9), book defaults = (10,3,20)
p = int(p) if p and p > 0 else 10
x = float(x) if x and x > 0 else 1 if tvmode is True else 3
q = int(q) if q and q > 0 else 9 if tvmode is True else 20
diff --git a/pandas_ta/trend/decay.py b/pandas_ta/trend/decay.py
index 8191f5b..fe20e7e 100644
--- a/pandas_ta/trend/decay.py
+++ b/pandas_ta/trend/decay.py
@@ -13,15 +13,6 @@ def decay(close, kind=None, length=None, mode=None, offset=None, **kwargs):
Sources:
https://tulipindicators.org/decay
- Calculation:
- Default Inputs:
- length=5, mode=None
-
- if mode == "exponential" or mode == "exp":
- max(close, close[-1] - exp(-length), 0)
- else:
- max(close, close[-1] - (1 / length), 0)
-
Args:
close (pd.Series): Series of 'close's
length (int): It's period. Default: 1
diff --git a/pandas_ta/trend/decreasing.py b/pandas_ta/trend/decreasing.py
index 5860d74..b9a1b4c 100644
--- a/pandas_ta/trend/decreasing.py
+++ b/pandas_ta/trend/decreasing.py
@@ -9,15 +9,6 @@ def decreasing(close, length=None, strict=None, asint=None, percent=None, drift=
over the period. When using the kwarg 'asint', then it returns 1 for True
or 0 for False.
- Calculation:
- if strict:
- decreasing = all(i > j for i, j in zip(close[-length:], close[1:]))
- else:
- decreasing = close.diff(length) < 0
-
- if asint:
- decreasing = decreasing.astype(int)
-
Args:
close (pd.Series): Series of 'close's
length (int): It's period. Default: 1
diff --git a/pandas_ta/trend/dpo.py b/pandas_ta/trend/dpo.py
index 2a06673..1a9b106 100644
--- a/pandas_ta/trend/dpo.py
+++ b/pandas_ta/trend/dpo.py
@@ -14,16 +14,6 @@ def dpo(close, length=None, centered=True, offset=None, **kwargs):
https://www.fidelity.com/learning-center/trading-investing/technical-analysis/technical-indicator-guide/dpo
http://stockcharts.com/school/doku.php?id=chart_school:technical_indicators:detrended_price_osci
- Calculation:
- Default Inputs:
- length=20, centered=True
- SMA = Simple Moving Average
- t = int(0.5 * length) + 1
-
- DPO = close.shift(t) - SMA(close, length)
- if centered:
- DPO = DPO.shift(-t)
-
Args:
close (pd.Series): Series of 'close's
length (int): It's period. Default: 1
diff --git a/pandas_ta/trend/increasing.py b/pandas_ta/trend/increasing.py
index d4aa916..bbbb691 100644
--- a/pandas_ta/trend/increasing.py
+++ b/pandas_ta/trend/increasing.py
@@ -9,15 +9,6 @@ def increasing(close, length=None, strict=None, asint=None, percent=None, drift=
over the period. When using the kwarg 'asint', then it returns 1 for True
or 0 for False.
- Calculation:
- if strict:
- increasing = all(i < j for i, j in zip(close[-length:], close[1:]))
- else:
- increasing = close.diff(length) > 0
-
- if asint:
- increasing = increasing.astype(int)
-
Args:
close (pd.Series): Series of 'close's
length (int): It's period. Default: 1
diff --git a/pandas_ta/trend/long_run.py b/pandas_ta/trend/long_run.py
index 96798c9..9e13343 100644
--- a/pandas_ta/trend/long_run.py
+++ b/pandas_ta/trend/long_run.py
@@ -21,18 +21,6 @@ def long_run(fast, slow, length=None, offset=None, **kwargs):
It is part of the Converging and Diverging Conditional logic in:
https://www.tradingview.com/script/Z2mq63fE-Trade-Archer-Moving-Averages-v1-4F/
- Calculation:
- Default Inputs:
- length=2
- INC = increasing
- DEC = decreasing
- BINC = Both increasing
- PBOT = Potential Bottom
-
- BINC = INC(fast, length) & INC(slow, length)
- PBOT = INC(fast, length) & DEC(slow, length)
- LR = BINC | PBOT
-
Args:
fast (pd.Series): Series of 'fast' values.
slow (pd.Series): Series of 'slow' values.
diff --git a/pandas_ta/trend/psar.py b/pandas_ta/trend/psar.py
index e14c191..f617038 100644
--- a/pandas_ta/trend/psar.py
+++ b/pandas_ta/trend/psar.py
@@ -21,12 +21,6 @@ def psar(high, low, close=None, af0=None, af=None, max_af=None, offset=None, **k
https://www.tradingview.com/pine-script-reference/#fun_sar
https://www.sierrachart.com/index.php?page=doc/StudiesReference.php&ID=66&Name=Parabolic
- Calculation:
- Default Inputs:
- af0=0.02, af=0.02, max_af=0.2
-
- See Source links
-
Args:
high (pd.Series): Series of 'high's
low (pd.Series): Series of 'low's
diff --git a/pandas_ta/trend/qstick.py b/pandas_ta/trend/qstick.py
index 8d2f970..37cd46b 100644
--- a/pandas_ta/trend/qstick.py
+++ b/pandas_ta/trend/qstick.py
@@ -12,12 +12,6 @@ def qstick(open_, close, length=None, offset=None, **kwargs):
Sources:
https://library.tradingtechnologies.com/trade/chrt-ti-qstick.html
- Calculation:
- Default Inputs:
- length=10
- xMA is one of: sma (default), dema, ema, hma, rma
- qstick = xMA(close - open, length)
-
Args:
open (pd.Series): Series of 'open's
close (pd.Series): Series of 'close's
diff --git a/pandas_ta/trend/short_run.py b/pandas_ta/trend/short_run.py
index 2330d15..8d87788 100644
--- a/pandas_ta/trend/short_run.py
+++ b/pandas_ta/trend/short_run.py
@@ -21,18 +21,6 @@ def short_run(fast, slow, length=None, offset=None, **kwargs):
It is part of the Converging and Diverging Conditional logic in:
https://www.tradingview.com/script/Z2mq63fE-Trade-Archer-Moving-Averages-v1-4F/
- Calculation:
- Default Inputs:
- length=2
- INC = increasing
- DEC = decreasing
- BDEC = Both decreasing
- PTOP = Potential Top
-
- BDEC = DEC(fast, length) & DEC(slow, length)
- PTOP = DEC(fast, length) & INC(slow, length)
- SR = BDEC | PTOP
-
Args:
fast (pd.Series): Series of 'fast' values.
slow (pd.Series): Series of 'slow' values.
diff --git a/pandas_ta/trend/trendflex.py b/pandas_ta/trend/trendflex.py
index 8ae0bb9..9aee235 100644
--- a/pandas_ta/trend/trendflex.py
+++ b/pandas_ta/trend/trendflex.py
@@ -25,9 +25,6 @@ def trendflex(close, length=None, smooth=None, alpha=None, offset=None, **kwargs
Sources:
https://www.prorealcode.com/prorealtime-indicators/reflex-and-trendflex-indicators-john-f-ehlers/
- Calculation:
- Refer to provided source or the code above.
-
Args:
close (pd.Series): Series of 'close's
length (int): It's period. Default: 20
diff --git a/pandas_ta/trend/tsignals.py b/pandas_ta/trend/tsignals.py
index c8e2bb7..91075ef 100644
--- a/pandas_ta/trend/tsignals.py
+++ b/pandas_ta/trend/tsignals.py
@@ -20,14 +20,6 @@ def tsignals(trend, asbool=None, trend_reset=0, trade_offset=None, drift=None, o
Source: Kevin Johnson
- Calculation:
- Default Inputs:
- asbool=False, trend_reset=0, trade_offset=0, drift=1
-
- trades = trends.diff().shift(trade_offset).fillna(0).astype(int)
- entries = (trades > 0).astype(int)
- exits = (trades < 0).abs().astype(int)
-
Args:
trend (pd.Series): Series of 'trend's. The trend can be either a boolean or
integer series of '0's and '1's
diff --git a/pandas_ta/trend/ttm_trend.py b/pandas_ta/trend/ttm_trend.py
index c6cd8ac..d755d21 100644
--- a/pandas_ta/trend/ttm_trend.py
+++ b/pandas_ta/trend/ttm_trend.py
@@ -15,26 +15,17 @@ def ttm_trend(high, low, close, length=None, offset=None, **kwargs):
Sources:
https://www.prorealcode.com/prorealtime-indicators/ttm-trend-price/
- Calculation:
- Default Inputs:
- length=6
- averageprice = (((high[5]+low[5])/2)+((high[4]+low[4])/2)+((high[3]+low[3])/2)+((high[2]+low[2])/2)+((high[1]+low[1])/2)+((high[6]+low[6])/2)) / 6
-
- if close > averageprice:
- drawcandle(open,high,low,close) coloured(0,255,0)
-
- if close < averageprice:
- drawcandle(open,high,low,close) coloured(255,0,0)
-
Args:
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: 6
offset (int): How many periods to offset the result. Default: 0
+
Kwargs:
fillna (value, optional): pd.DataFrame.fillna(value)
fill_method (value, optional): Type of fill method
+
Returns:
pd.DataFrame: ttm_trend.
"""
diff --git a/pandas_ta/trend/vhf.py b/pandas_ta/trend/vhf.py
index e5b3b88..d461433 100644
--- a/pandas_ta/trend/vhf.py
+++ b/pandas_ta/trend/vhf.py
@@ -11,14 +11,6 @@ def vhf(close, length=None, drift=None, offset=None, **kwargs):
Sources:
https://www.incrediblecharts.com/indicators/vertical_horizontal_filter.php
- Calculation:
- Default Inputs:
- length = 28
- HCP = Highest Close Price in Period
- LCP = Lowest Close Price in Period
- Change = abs(Ct - Ct-1)
- VHF = (HCP - LCP) / RollingSum[length] of Change
-
Args:
source (pd.Series): Series of prices (usually close).
length (int): The period length. Default: 28
diff --git a/pandas_ta/trend/vortex.py b/pandas_ta/trend/vortex.py
index a1af6f1..929a817 100644
--- a/pandas_ta/trend/vortex.py
+++ b/pandas_ta/trend/vortex.py
@@ -12,20 +12,6 @@ def vortex(high, low, close, length=None, drift=None, offset=None, **kwargs):
Sources:
https://stockcharts.com/school/doku.php?id=chart_school:technical_indicators:vortex_indicator
- Calculation:
- Default Inputs:
- length=14, drift=1
- TR = True Range
- SMA = Simple Moving Average
- tr = TR(high, low, close)
- tr_sum = tr.rolling(length).sum()
-
- vmp = (high - low.shift(drift)).abs()
- vmn = (low - high.shift(drift)).abs()
-
- VIP = vmp.rolling(length).sum() / tr_sum
- VIM = vmn.rolling(length).sum() / tr_sum
-
Args:
high (pd.Series): Series of 'high's
low (pd.Series): Series of 'low's
diff --git a/pandas_ta/trend/xsignals.py b/pandas_ta/trend/xsignals.py
index 28d3dad..6962b1e 100644
--- a/pandas_ta/trend/xsignals.py
+++ b/pandas_ta/trend/xsignals.py
@@ -34,14 +34,6 @@ def xsignals(signal, xa, xb, above:bool=True, long:bool=True, asbool:bool=None,
Source: Kevin Johnson
- Calculation:
- Default Inputs:
- asbool=False, trend_reset=0, trade_offset=0, drift=1
-
- trades = trends.diff().shift(trade_offset).fillna(0).astype(int)
- entries = (trades > 0).astype(int)
- exits = (trades < 0).abs().astype(int)
-
Args:
signal (pd.Series): The Signal to compare from. Commonly the 'close'.
xa (pd.Series): The Series the Signal crosses above if 'above=True'.
diff --git a/pandas_ta/volatility/accbands.py b/pandas_ta/volatility/accbands.py
index de21502..28b7184 100644
--- a/pandas_ta/volatility/accbands.py
+++ b/pandas_ta/volatility/accbands.py
@@ -13,24 +13,6 @@ def accbands(high, low, close, length=None, c=None, drift=None, mamode=None, off
Sources:
https://www.tradingtechnologies.com/help/x-study/technical-indicator-definitions/acceleration-bands-abands/
- Calculation:
- Default Inputs:
- length=10, c=4
- EMA = Exponential Moving Average
- SMA = Simple Moving Average
- HL_RATIO = c * (high - low) / (high + low)
- LOW = low * (1 - HL_RATIO)
- HIGH = high * (1 + HL_RATIO)
-
- if 'ema':
- LOWER = EMA(LOW, length)
- MID = EMA(close, length)
- UPPER = EMA(HIGH, length)
- else:
- LOWER = SMA(LOW, length)
- MID = SMA(close, length)
- UPPER = SMA(HIGH, length)
-
Args:
high (pd.Series): Series of 'high's
low (pd.Series): Series of 'low's
diff --git a/pandas_ta/volatility/atr.py b/pandas_ta/volatility/atr.py
index 3ab80a1..0c8f60f 100644
--- a/pandas_ta/volatility/atr.py
+++ b/pandas_ta/volatility/atr.py
@@ -14,28 +14,6 @@ def atr(high, low, close, length=None, mamode=None, talib=None, drift=None, offs
Sources:
https://www.tradingview.com/wiki/Average_True_Range_(ATR)
- Calculation:
- Default Inputs:
- length=14, drift=1, percent=False
- EMA = Exponential Moving Average
- SMA = Simple Moving Average
- WMA = Weighted Moving Average
- RMA = WildeR's Moving Average
- TR = True Range
-
- tr = TR(high, low, close, drift)
- if 'ema':
- ATR = EMA(tr, length)
- elif 'sma':
- ATR = SMA(tr, length)
- elif 'wma':
- ATR = WMA(tr, length)
- else:
- ATR = RMA(tr, length)
-
- if percent:
- ATR *= 100 / close
-
Args:
high (pd.Series): Series of 'high's
low (pd.Series): Series of 'low's
diff --git a/pandas_ta/volatility/bbands.py b/pandas_ta/volatility/bbands.py
index b068c9a..c06db7d 100644
--- a/pandas_ta/volatility/bbands.py
+++ b/pandas_ta/volatility/bbands.py
@@ -14,24 +14,6 @@ def bbands(close, length=None, std=None, ddof=0, mamode=None, talib=None, offset
Sources:
https://www.tradingview.com/wiki/Bollinger_Bands_(BB)
- Calculation:
- Default Inputs:
- length=5, std=2, mamode="sma", ddof=0
- EMA = Exponential Moving Average
- SMA = Simple Moving Average
- STDEV = Standard Deviation
- stdev = STDEV(close, length, ddof)
- if "ema":
- MID = EMA(close, length)
- else:
- MID = SMA(close, length)
-
- LOWER = MID - std * stdev
- UPPER = MID + std * stdev
-
- BANDWIDTH = 100 * (UPPER - LOWER) / MID
- PERCENT = (close - LOWER) / (UPPER - LOWER)
-
Args:
close (pd.Series): Series of 'close's
length (int): The short period. Default: 5
diff --git a/pandas_ta/volatility/donchian.py b/pandas_ta/volatility/donchian.py
index 761c9c3..9b098eb 100644
--- a/pandas_ta/volatility/donchian.py
+++ b/pandas_ta/volatility/donchian.py
@@ -12,13 +12,6 @@ def donchian(high, low, lower_length=None, upper_length=None, offset=None, **kwa
Sources:
https://www.tradingview.com/wiki/Donchian_Channels_(DC)
- Calculation:
- Default Inputs:
- lower_length=upper_length=20
- LOWER = low.rolling(lower_length).min()
- UPPER = high.rolling(upper_length).max()
- MID = 0.5 * (LOWER + UPPER)
-
Args:
high (pd.Series): Series of 'high's
low (pd.Series): Series of 'low's
diff --git a/pandas_ta/volatility/hwc.py b/pandas_ta/volatility/hwc.py
index 5bcc16e..9bd08f6 100644
--- a/pandas_ta/volatility/hwc.py
+++ b/pandas_ta/volatility/hwc.py
@@ -17,31 +17,21 @@ def hwc(close, na=None, nb=None, nc=None, nd=None, scalar=None, channel_eval=Non
Sources:
https://www.mql5.com/en/code/20857
- Calculation:
- HWMA[i] = F[i] + V[i] + 0.5 * A[i]
- where..
- F[i] = (1-na) * (F[i-1] + V[i-1] + 0.5 * A[i-1]) + na * Price[i]
- V[i] = (1-nb) * (V[i-1] + A[i-1]) + nb * (F[i] - F[i-1])
- A[i] = (1-nc) * A[i-1] + nc * (V[i] - V[i-1])
-
- Top = HWMA + Multiplier * StDt
- Bottom = HWMA - Multiplier * StDt
- where..
- StDt[i] = Sqrt(Var[i-1])
- Var[i] = (1-d) * Var[i-1] + nD * (Price[i-1] - HWMA[i-1]) * (Price[i-1] - HWMA[i-1])
-
Args:
- na - parameter of the equation that describes a smoothed series (from 0 to 1)
- nb - parameter of the equation to assess the trend (from 0 to 1)
- nc - parameter of the equation to assess seasonality (from 0 to 1)
- nd - parameter of the channel equation (from 0 to 1)
- scaler - multiplier for the width of the channel calculated
- channel_eval - boolean to return width and percentage price position against price
close (pd.Series): Series of 'close's
+ na (float): Smoothed series (from 0 to 1). Default: 0.2
+ nb (float): Trend value (from 0 to 1). Default: 0.1
+ nc (float): Seasonality value (from 0 to 1). Default: 0.1
+ nd (float): Channel value (from 0 to 1). Default: 0.1
+ scaler (float): Width multiplier of the channel. Default: 1
+ channel_eval (bool): Return width and percentage price position against
+ price. Default: False
+ offset (int): How many periods to offset the result. Default: 0
Kwargs:
fillna (value, optional): pd.DataFrame.fillna(value)
fill_method (value, optional): Type of fill method
+
Returns:
pd.DataFrame: HWM (Mid), HWU (Upper), HWL (Lower) columns.
"""
diff --git a/pandas_ta/volatility/kc.py b/pandas_ta/volatility/kc.py
index 4e5274a..176bb73 100644
--- a/pandas_ta/volatility/kc.py
+++ b/pandas_ta/volatility/kc.py
@@ -14,28 +14,6 @@ def kc(high, low, close, length=None, scalar=None, mamode=None, offset=None, **k
Sources:
https://www.tradingview.com/wiki/Keltner_Channels_(KC)
- Calculation:
- Default Inputs:
- length=20, scalar=2, mamode=None, tr=True
- TR = True Range
- SMA = Simple Moving Average
- EMA = Exponential Moving Average
-
- if tr:
- RANGE = TR(high, low, close)
- else:
- RANGE = high - low
-
- if mamode == "ema":
- BASIS = sma(close, length)
- BAND = sma(RANGE, length)
- elif mamode == "sma":
- BASIS = sma(close, length)
- BAND = sma(RANGE, length)
-
- LOWER = BASIS - scalar * BAND
- UPPER = BASIS + scalar * BAND
-
Args:
high (pd.Series): Series of 'high's
low (pd.Series): Series of 'low's
diff --git a/pandas_ta/volatility/massi.py b/pandas_ta/volatility/massi.py
index 1aa24c1..da3c951 100644
--- a/pandas_ta/volatility/massi.py
+++ b/pandas_ta/volatility/massi.py
@@ -11,17 +11,6 @@ def massi(high, low, fast=None, slow=None, offset=None, **kwargs):
Sources:
https://stockcharts.com/school/doku.php?id=chart_school:technical_indicators:mass_index
- mi = sum(ema(high - low, 9) / ema(ema(high - low, 9), 9), length)
-
- Calculation:
- Default Inputs:
- fast: 9, slow: 25
- EMA = Exponential Moving Average
- hl = high - low
- hl_ema1 = EMA(hl, fast)
- hl_ema2 = EMA(hl_ema1, fast)
- hl_ratio = hl_ema1 / hl_ema2
- MASSI = SUM(hl_ratio, slow)
Args:
high (pd.Series): Series of 'high's
diff --git a/pandas_ta/volatility/natr.py b/pandas_ta/volatility/natr.py
index dca5890..46fc339 100644
--- a/pandas_ta/volatility/natr.py
+++ b/pandas_ta/volatility/natr.py
@@ -12,12 +12,6 @@ def natr(high, low, close, length=None, scalar=None, mamode=None, talib=None, dr
Sources:
https://www.tradingtechnologies.com/help/x-study/technical-indicator-definitions/normalized-average-true-range-natr/
- Calculation:
- Default Inputs:
- length=20
- ATR = Average True Range
- NATR = (100 / close) * ATR(high, low, close)
-
Args:
high (pd.Series): Series of 'high's
low (pd.Series): Series of 'low's
diff --git a/pandas_ta/volatility/pdist.py b/pandas_ta/volatility/pdist.py
index ae3ce9e..24c1d4c 100644
--- a/pandas_ta/volatility/pdist.py
+++ b/pandas_ta/volatility/pdist.py
@@ -10,12 +10,6 @@ def pdist(open_, high, low, close, drift=None, offset=None, **kwargs):
Sources:
https://www.prorealcode.com/prorealtime-indicators/pricedistance/
- Calculation:
- Default Inputs:
- drift=1
-
- PDIST = 2(high - low) - ABS(close - open) + ABS(open - close[drift])
-
Args:
open_ (pd.Series): Series of 'opens's
high (pd.Series): Series of 'high's
diff --git a/pandas_ta/volatility/rvi.py b/pandas_ta/volatility/rvi.py
index abd7712..857f5c9 100644
--- a/pandas_ta/volatility/rvi.py
+++ b/pandas_ta/volatility/rvi.py
@@ -15,20 +15,6 @@ def rvi(close, high=None, low=None, length=None, scalar=None, refined=None, thir
Sources:
https://www.tradingview.com/wiki/Keltner_Channels_(KC)
- Calculation:
- Default Inputs:
- length=14, scalar=100, refined=None, thirds=None
- EMA = Exponential Moving Average
- STDEV = Standard Deviation
-
- UP = STDEV(src, length) IF src.diff() > 0 ELSE 0
- DOWN = STDEV(src, length) IF src.diff() <= 0 ELSE 0
-
- UPSUM = EMA(UP, length)
- DOWNSUM = EMA(DOWN, length
-
- RVI = scalar * (UPSUM / (UPSUM + DOWNSUM))
-
Args:
high (pd.Series): Series of 'high's
low (pd.Series): Series of 'low's
diff --git a/pandas_ta/volatility/thermo.py b/pandas_ta/volatility/thermo.py
index 457671e..7a4b20d 100644
--- a/pandas_ta/volatility/thermo.py
+++ b/pandas_ta/volatility/thermo.py
@@ -13,22 +13,6 @@ def thermo(high, low, length=None, long=None, short=None, mamode=None, drift=Non
https://www.motivewave.com/studies/elders_thermometer.htm
https://www.tradingview.com/script/HqvTuEMW-Elder-s-Market-Thermometer-LazyBear/
- Calculation:
- Default Inputs:
- length=20, drift=1, mamode=EMA, long=2, short=0.5
- EMA = Exponential Moving Average
-
- thermoL = (low.shift(drift) - low).abs()
- thermoH = (high - high.shift(drift)).abs()
-
- thermo = np.where(thermoH > thermoL, thermoH, thermoL)
- thermo_ma = ema(thermo, length)
-
- thermo_long = thermo < (thermo_ma * long)
- thermo_short = thermo > (thermo_ma * short)
- thermo_long = thermo_long.astype(int)
- thermo_short = thermo_short.astype(int)
-
Args:
high (pd.Series): Series of 'high's
low (pd.Series): Series of 'low's
diff --git a/pandas_ta/volatility/true_range.py b/pandas_ta/volatility/true_range.py
index e73f905..9504d95 100644
--- a/pandas_ta/volatility/true_range.py
+++ b/pandas_ta/volatility/true_range.py
@@ -14,13 +14,6 @@ def true_range(high, low, close, talib=None, drift=None, offset=None, **kwargs):
Sources:
https://www.macroption.com/true-range/
- Calculation:
- Default Inputs:
- drift=1
- ABS = Absolute Value
- prev_close = close.shift(drift)
- TRUE_RANGE = ABS([high - low, high - prev_close, low - prev_close])
-
Args:
high (pd.Series): Series of 'high's
low (pd.Series): Series of 'low's
diff --git a/pandas_ta/volatility/ui.py b/pandas_ta/volatility/ui.py
index 428c4b0..d10f390 100644
--- a/pandas_ta/volatility/ui.py
+++ b/pandas_ta/volatility/ui.py
@@ -15,19 +15,6 @@ def ui(close, length=None, scalar=None, offset=None, **kwargs):
https://en.wikipedia.org/wiki/Ulcer_index
http://www.tangotools.com/ui/ui.htm
- Calculation:
- Default Inputs:
- length=14, scalar=100
- HC = Highest Close
- SMA = Simple Moving Average
-
- HCN = HC(close, length)
- DOWNSIDE = scalar * (close - HCN) / HCN
- if kwargs["everget"]:
- UI = SQRT(SMA(DOWNSIDE^2, length) / length)
- else:
- UI = SQRT(SUM(DOWNSIDE^2, length) / length)
-
Args:
high (pd.Series): Series of 'high's
close (pd.Series): Series of 'close's
diff --git a/pandas_ta/volume/__init__.py b/pandas_ta/volume/__init__.py
index 1539555..70a5030 100644
--- a/pandas_ta/volume/__init__.py
+++ b/pandas_ta/volume/__init__.py
@@ -13,5 +13,5 @@ from .pvi import pvi
from .pvol import pvol
from .pvr import pvr
from .pvt import pvt
-from .tv_tsv import tv_tsv
from .vp import vp
+from .wb_tsv import wb_tsv
diff --git a/pandas_ta/volume/ad.py b/pandas_ta/volume/ad.py
index 53f81f3..4911380 100644
--- a/pandas_ta/volume/ad.py
+++ b/pandas_ta/volume/ad.py
@@ -12,17 +12,6 @@ def ad(high, low, close, volume, open_=None, talib=None, offset=None, **kwargs):
Sources:
https://www.tradingtechnologies.com/help/x-study/technical-indicator-definitions/accumulationdistribution-ad/
- Calculation:
- CUM = Cumulative Sum
- if 'open':
- AD = close - open
- else:
- AD = 2 * close - high - low
-
- hl_range = high - low
- AD = AD * volume / hl_range
- AD = CUM(AD)
-
Args:
high (pd.Series): Series of 'high's
low (pd.Series): Series of 'low's
diff --git a/pandas_ta/volume/adosc.py b/pandas_ta/volume/adosc.py
index b488b0e..fb93ba8 100644
--- a/pandas_ta/volume/adosc.py
+++ b/pandas_ta/volume/adosc.py
@@ -15,15 +15,6 @@ def adosc(high, low, close, volume, open_=None, fast=None, slow=None, talib=None
Sources:
https://www.investopedia.com/articles/active-trading/031914/understanding-chaikin-oscillator.asp
- Calculation:
- Default Inputs:
- fast=12, slow=26
- AD = Accum/Dist
- ad = AD(high, low, close, open)
- fast_ad = EMA(ad, fast)
- slow_ad = EMA(ad, slow)
- ADOSC = fast_ad - slow_ad
-
Args:
high (pd.Series): Series of 'high's
low (pd.Series): Series of 'low's
diff --git a/pandas_ta/volume/aobv.py b/pandas_ta/volume/aobv.py
index cdb8d22..3b8bc90 100644
--- a/pandas_ta/volume/aobv.py
+++ b/pandas_ta/volume/aobv.py
@@ -18,23 +18,6 @@ def aobv(close, volume, fast=None, slow=None, max_lookback=None, min_lookback=No
Sources:
https://www.tradingview.com/script/Co1ksara-Trade-Archer-On-balance-Volume-Moving-Averages-v1/
- Calculation:
- Default Inputs:
- fast=4, slow=12, max_lookback=2, min_lookback=2, mamode="ema",
- run_length=2
- OBV = On Balance Volume
- LR = Long Run Trend
- SR = Short Run Trend
-
- OBV_FMA = ma(OBV, mamode, fast)
- OBV_SMA = ma(OBV, mamode, slow)
-
- OBV_LR = LR(OBV_FMA, OBV_SMA, run_length)
- OBV_SR = SR(OBV_FMA, OBV_SMA, run_length)
-
- OBV_MAX = OBV.rolling(max_lookback).max()
- OBV_MIN = OBV.rolling(min_lookback).min()
-
Args:
close (pd.Series): Series of 'close's
volume (pd.Series): Series of 'volume's
diff --git a/pandas_ta/volume/cmf.py b/pandas_ta/volume/cmf.py
index ff01bb8..c625c76 100644
--- a/pandas_ta/volume/cmf.py
+++ b/pandas_ta/volume/cmf.py
@@ -12,18 +12,6 @@ def cmf(high, low, close, volume, open_=None, length=None, offset=None, **kwargs
https://www.tradingview.com/wiki/Chaikin_Money_Flow_(CMF)
https://stockcharts.com/school/doku.php?id=chart_school:technical_indicators:chaikin_money_flow_cmf
- Calculation:
- Default Inputs:
- length=20
- if 'open':
- ad = close - open
- else:
- ad = 2 * close - high - low
-
- hl_range = high - low
- ad = ad * volume / hl_range
- CMF = SUM(ad, length) / SUM(volume, length)
-
Args:
high (pd.Series): Series of 'high's
low (pd.Series): Series of 'low's
diff --git a/pandas_ta/volume/efi.py b/pandas_ta/volume/efi.py
index 923389d..394efc7 100644
--- a/pandas_ta/volume/efi.py
+++ b/pandas_ta/volume/efi.py
@@ -13,18 +13,6 @@ def efi(close, volume, length=None, mamode=None, drift=None, offset=None, **kwar
https://www.tradingview.com/wiki/Elder%27s_Force_Index_(EFI)
https://www.motivewave.com/studies/elders_force_index.htm
- Calculation:
- Default Inputs:
- length=20, drift=1, mamode=None
- EMA = Exponential Moving Average
- SMA = Simple Moving Average
-
- pv_diff = close.diff(drift) * volume
- if mamode == 'sma':
- EFI = SMA(pv_diff, length)
- else:
- EFI = EMA(pv_diff, length)
-
Args:
close (pd.Series): Series of 'close's
volume (pd.Series): Series of 'volume's
diff --git a/pandas_ta/volume/eom.py b/pandas_ta/volume/eom.py
index 3405b78..24ee77d 100644
--- a/pandas_ta/volume/eom.py
+++ b/pandas_ta/volume/eom.py
@@ -14,16 +14,6 @@ def eom(high, low, close, volume, length=None, divisor=None, drift=None, offset=
https://www.motivewave.com/studies/ease_of_movement.htm
https://stockcharts.com/school/doku.php?id=chart_school:technical_indicators:ease_of_movement_emv
- Calculation:
- Default Inputs:
- length=14, divisor=100000000, drift=1
- SMA = Simple Moving Average
- hl_range = high - low
- distance = 0.5 * (high - high.shift(drift) + low - low.shift(drift))
- box_ratio = (volume / divisor) / hl_range
- eom = distance / box_ratio
- EOM = SMA(eom, length)
-
Args:
high (pd.Series): Series of 'high's
low (pd.Series): Series of 'low's
diff --git a/pandas_ta/volume/kvo.py b/pandas_ta/volume/kvo.py
index 38fbb30..6b256d9 100644
--- a/pandas_ta/volume/kvo.py
+++ b/pandas_ta/volume/kvo.py
@@ -14,15 +14,6 @@ def kvo(high, low, close, volume, fast=None, slow=None, signal=None, mamode=None
https://www.investopedia.com/terms/k/klingeroscillator.asp
https://www.daytrading.com/klinger-volume-oscillator
- Calculation:
- Default Inputs:
- fast=34, slow=55, signal=13, drift=1
- EMA = Exponential Moving Average
-
- SV = volume * signed_series(HLC3, 1)
- KVO = EMA(SV, fast) - EMA(SV, slow)
- Signal = EMA(KVO, signal)
-
Args:
high (pd.Series): Series of 'high's
low (pd.Series): Series of 'low's
diff --git a/pandas_ta/volume/mfi.py b/pandas_ta/volume/mfi.py
index 8252e68..c6ea9e5 100644
--- a/pandas_ta/volume/mfi.py
+++ b/pandas_ta/volume/mfi.py
@@ -14,18 +14,6 @@ def mfi(high, low, close, volume, length=None, talib=None, drift=None, offset=No
Sources:
https://www.tradingview.com/wiki/Money_Flow_(MFI)
- Calculation:
- Default Inputs:
- length=14, drift=1
- tp = typical_price = hlc3 = (high + low + close) / 3
- rmf = raw_money_flow = tp * volume
-
- pmf = pos_money_flow = SUM(rmf, length) if tp.diff(drift) > 0 else 0
- nmf = neg_money_flow = SUM(rmf, length) if tp.diff(drift) < 0 else 0
-
- MFR = money_flow_ratio = pmf / nmf
- MFI = money_flow_index = 100 * pmf / (pmf + nmf)
-
Args:
high (pd.Series): Series of 'high's
low (pd.Series): Series of 'low's
diff --git a/pandas_ta/volume/nvi.py b/pandas_ta/volume/nvi.py
index 634d872..6c324d1 100644
--- a/pandas_ta/volume/nvi.py
+++ b/pandas_ta/volume/nvi.py
@@ -13,18 +13,6 @@ def nvi(close, volume, length=None, initial=None, offset=None, **kwargs):
https://stockcharts.com/school/doku.php?id=chart_school:technical_indicators:negative_volume_inde
https://www.motivewave.com/studies/negative_volume_index.htm
- Calculation:
- Default Inputs:
- length=1, initial=1000
- ROC = Rate of Change
-
- roc = ROC(close, length)
- signed_volume = signed_series(volume, initial=1)
- nvi = signed_volume[signed_volume < 0].abs() * roc_
- nvi.fillna(0, inplace=True)
- nvi.iloc[0]= initial
- nvi = nvi.cumsum()
-
Args:
close (pd.Series): Series of 'close's
volume (pd.Series): Series of 'volume's
diff --git a/pandas_ta/volume/obv.py b/pandas_ta/volume/obv.py
index a079125..0a19f7e 100644
--- a/pandas_ta/volume/obv.py
+++ b/pandas_ta/volume/obv.py
@@ -14,10 +14,6 @@ def obv(close, volume, talib=None, offset=None, **kwargs):
https://www.tradingtechnologies.com/help/x-study/technical-indicator-definitions/on-balance-volume-obv/
https://www.motivewave.com/studies/on_balance_volume.htm
- Calculation:
- signed_volume = signed_series(close, initial=1) * volume
- obv = signed_volume.cumsum()
-
Args:
close (pd.Series): Series of 'close's
volume (pd.Series): Series of 'volume's
diff --git a/pandas_ta/volume/pvi.py b/pandas_ta/volume/pvi.py
index 9174cd9..f2d4fce 100644
--- a/pandas_ta/volume/pvi.py
+++ b/pandas_ta/volume/pvi.py
@@ -13,18 +13,6 @@ def pvi(close, volume, length=None, initial=None, offset=None, **kwargs):
Sources:
https://www.investopedia.com/terms/p/pvi.asp
- Calculation:
- Default Inputs:
- length=1, initial=1000
- ROC = Rate of Change
-
- roc = ROC(close, length)
- signed_volume = signed_series(volume, initial=1)
- pvi = signed_volume[signed_volume > 0].abs() * roc_
- pvi.fillna(0, inplace=True)
- pvi.iloc[0]= initial
- pvi = pvi.cumsum()
-
Args:
close (pd.Series): Series of 'close's
volume (pd.Series): Series of 'volume's
diff --git a/pandas_ta/volume/pvol.py b/pandas_ta/volume/pvol.py
index 99ed75d..a3cbe05 100644
--- a/pandas_ta/volume/pvol.py
+++ b/pandas_ta/volume/pvol.py
@@ -7,12 +7,6 @@ def pvol(close, volume, offset=None, **kwargs):
Returns a series of the product of price and volume.
- Calculation:
- if signed:
- pvol = signed_series(close, 1) * close * volume
- else:
- pvol = close * volume
-
Args:
close (pd.Series): Series of 'close's
volume (pd.Series): Series of 'volume's
diff --git a/pandas_ta/volume/pvr.py b/pandas_ta/volume/pvr.py
index 19a13d9..7c9455e 100644
--- a/pandas_ta/volume/pvr.py
+++ b/pandas_ta/volume/pvr.py
@@ -16,12 +16,6 @@ def pvr(close, volume):
Sources:
https://www.fmlabs.com/reference/default.htm?url=PVrank.htm
- Calculation:
- return 1 if 'close change' >= 0 and 'volume change' >= 0
- return 2 if 'close change' >= 0 and 'volume change' < 0
- return 3 if 'close change' < 0 and 'volume change' >= 0
- return 4 if 'close change' < 0 and 'volume change' < 0
-
Args:
close (pd.Series): Series of 'close's
volume (pd.Series): Series of 'volume's
diff --git a/pandas_ta/volume/pvt.py b/pandas_ta/volume/pvt.py
index 0b98cf1..10530ca 100644
--- a/pandas_ta/volume/pvt.py
+++ b/pandas_ta/volume/pvt.py
@@ -12,13 +12,6 @@ def pvt(close, volume, drift=None, offset=None, **kwargs):
Sources:
https://www.tradingview.com/wiki/Price_Volume_Trend_(PVT)
- Calculation:
- Default Inputs:
- drift=1
- ROC = Rate of Change
- pv = ROC(close, drift) * volume
- PVT = pv.cumsum()
-
Args:
close (pd.Series): Series of 'close's
volume (pd.Series): Series of 'volume's
diff --git a/pandas_ta/volume/tv_tsv.py b/pandas_ta/volume/tv_tsv.py
deleted file mode 100644
index 6521a52..0000000
--- a/pandas_ta/volume/tv_tsv.py
+++ /dev/null
@@ -1,96 +0,0 @@
-# -*- coding: utf-8 -*-
-import pandas as pd
-from pandas import DataFrame, Series
-from pandas_ta.utils import verify_series, signed_series
-import statistics
-import time
-from datetime import date, datetime, timedelta, timezone
-
-def tv_tsv(close=None, volume=None, length=None, signal=None, mamode=None, **kwargs):
- """Indicator: Time Segmented Value (TSV)"""
- # Validate Arguments
- drift = kwargs.pop("drift", 1)
- length = int(length) if length and length > 0 else 18
- signal = int(signal) if signal and signal > 0 else 10
- mamode = mamode if isinstance(mamode, str) else "sma"
-
- # Trading View
- # https://www.tradingview.com/script/6GR4ht9X-Time-Segmented-Volume/
- # t = sum( close > close[1] ? volume*(close-close[1]) : close < close[1] ? volume*(close-close[1]) : 0,l)
- # m = sma(t ,l_ma )
-
- # Calculate Result
- signed_volume = volume * ta.signed_series(close, 1) # > 0
- signed_volume[signed_volume < 0 ] = -signed_volume # < 0
- signed_volume.apply(ta.zero) # ~ 0
-
- cvd = (close.diff(drift) * signed_volume).fillna(0)
-
- tsv = (cvd.rolling(length).sum()).fillna(0)
- signal = (ta.ma(mamode, tsv, length=signal)).fillna(0)
- tsv_ratio = (tsv / signal).fillna(0)
-
- # Handle fills
- if "fillna" in kwargs:
- tsv.fillna(kwargs["fillna"], inplace=True)
- signal.fillna(kwargs["fillna"], inplace=True)
- tsv_ratio.fillna(kwargs["fillna"], inplace=True)
- if "fill_method" in kwargs:
- tsv.fillna(method=kwargs["fill_method"], inplace=True)
- signal.fillna(method=kwargs["fill_method"], inplace=True)
- tsv_ratio.fillna(method=kwargs["fill_method"], inplace=True)
-
-
-
- # Name & Category
- _props = f"_{length}_{signal}"
- tv_tsv.name = f"TV_TSV{_props}"
- tv_tsv.category = "volume"
-
- #tsv.name = "tsv"
-
-
- df = pd.DataFrame({
- "close": close, "volume": volume,
- "signed_volume": signed_volume, "cvd": cvd,
- "tsv": tsv, "signal": signal, "tsv_ratio": tsv_ratio
- })
-
- return df
-
-
-
-tv_tsv.__doc__ = \
-"""Time Segmented Value (TSV)
-
-TSV is a proprietary technical indicator developed by Worden Brothers Inc., classified as an oscillator.
-It is calculated by comparing various time segments of both price and volume.
-TSV essentially measures the amount of money flowing in or out of a particular stock.
-The baseline represents the zero line.
-
-TSV is a leading indicator because its movement is based on both the stock's price fluctuation and volume.
-Ideal entry and exit points are commonly found as the stock moves across the baseline level.
-This indicator is similar to on-balance volume (OBV) because it measures the amount of money flowing in or out of a particular stock.
-
-Sources:
- https://www.investopedia.com/terms/t/tsv.asp
-
-Calculation:
- Default Inputs:
- length=18, signal=10
-
-
-Args:
- close (pd.Series): Series of 'close's
- volume (pd.Series): Series of 'volume's
- length (int): It's period. Default: 18
- signal (int): It's avg period. Default: 10
- mamode (str): See ```help(ta.ma)```. Default: 'sma'
-
-Kwargs:
- fillna (value, optional): pd.DataFrame.fillna(value)
- fill_method (value, optional): Type of fill method
-
-Returns:
- pd.DataFrame: tsv, signal, tsv_ratio
-"""
diff --git a/pandas_ta/volume/vp.py b/pandas_ta/volume/vp.py
index c1d8a42..6dd88ed 100644
--- a/pandas_ta/volume/vp.py
+++ b/pandas_ta/volume/vp.py
@@ -17,20 +17,6 @@ def vp(close, volume, width=None, **kwargs):
http://www.ranchodinero.com/volume-tpo-essentials/
https://www.tradingtechnologies.com/blog/2013/05/15/volume-at-price/
- Calculation:
- Default Inputs:
- width=10
-
- vp = pd.concat([close, pos_volume, neg_volume], axis=1)
- if sort_close:
- vp_ranges = cut(vp[close_col], width)
- result = ({range_left, mean_close, range_right, pos_volume, neg_volume} foreach range in vp_ranges
- else:
- vp_ranges = np.array_split(vp, width)
- result = ({low_close, mean_close, high_close, pos_volume, neg_volume} foreach range in vp_ranges
- vpdf = pd.DataFrame(result)
- vpdf['total_volume'] = vpdf['pos_volume'] + vpdf['neg_volume']
-
Args:
close (pd.Series): Series of 'close's
volume (pd.Series): Series of 'volume's
diff --git a/pandas_ta/volume/wb_tsv.py b/pandas_ta/volume/wb_tsv.py
new file mode 100644
index 0000000..bae6726
--- /dev/null
+++ b/pandas_ta/volume/wb_tsv.py
@@ -0,0 +1,84 @@
+# -*- coding: utf-8 -*-
+from pandas import DataFrame, Series
+from pandas_ta.overlap import ma
+from pandas_ta.utils import get_drift, get_offset, verify_series, signed_series, zero
+
+
+def wb_tsv(close=None, volume=None, length=None, signal=None, mamode=None, drift=None, offset=None, **kwargs):
+ """Time Segmented Value (TSV)
+
+ TSV is a proprietary technical indicator developed by Worden Brothers Inc.,
+ classified as an oscillator. It compares various time segments of both price
+ and volume. It measures the amount money flowing at various time segments
+ for price and time; similar to On Balance Volume. The zero line is called
+ the baseline. Entry and exit points are commonly determined when crossing
+ the baseline.
+
+ Sources:
+ https://www.tradingview.com/script/6GR4ht9X-Time-Segmented-Volume/
+ https://help.tc2000.com/m/69404/l/747088-time-segmented-volume
+ https://usethinkscript.com/threads/time-segmented-volume-for-thinkorswim.519/
+
+ Args:
+ close (pd.Series): Series of 'close's
+ volume (pd.Series): Series of 'volume's
+ length (int): It's period. Default: 18
+ signal (int): It's avg period. Default: 10
+ mamode (str): See ```help(ta.ma)```. Default: 'sma'
+ drift (int): The difference period. Default: 1
+ offset (int): How many periods to offset the result. Default: 0
+
+ Kwargs:
+ fillna (value, optional): pd.DataFrame.fillna(value)
+ fill_method (value, optional): Type of fill method
+
+ Returns:
+ pd.DataFrame: tsv, signal, ratio
+ """
+ # Validate Arguments
+ length = int(length) if length and length > 0 else 18
+ signal = int(signal) if signal and signal > 0 else 10
+ mamode = mamode if isinstance(mamode, str) else "sma"
+ drift = get_drift(drift)
+ offset = get_offset(offset)
+
+ # Calculate Result
+ signed_volume = volume * signed_series(close, 1) # > 0
+ signed_volume[signed_volume < 0 ] = -signed_volume # < 0
+ signed_volume.apply(zero) # ~ 0
+ cvd = signed_volume * close.diff(drift)
+
+ tsv = cvd.rolling(length).sum()
+ signal_ = ma(mamode, tsv, length=signal)
+ ratio = tsv / signal_
+
+ # Offset
+ if offset != 0:
+ tsv = tsv.shift(offset)
+ signal_ = signal.shift(offset)
+ ratio = ratio.shift(offset)
+
+ # Handle fills
+ if "fillna" in kwargs:
+ tsv.fillna(kwargs["fillna"], inplace=True)
+ signal_.fillna(kwargs["fillna"], inplace=True)
+ ratio.fillna(kwargs["fillna"], inplace=True)
+ if "fill_method" in kwargs:
+ tsv.fillna(method=kwargs["fill_method"], inplace=True)
+ signal_.fillna(method=kwargs["fill_method"], inplace=True)
+ ratio.fillna(method=kwargs["fill_method"], inplace=True)
+
+ # Name and Categorize
+ _props = f"_{length}_{signal}"
+ tsv.name = f"TSV{_props}"
+ signal_.name = f"TSVs{_props}"
+ ratio.name = f"TSVr{_props}"
+ tsv.category = signal_.category = ratio.category = "volume"
+
+ # Prepare DataFrame to return
+ data = {tsv.name: tsv, signal_.name: signal_, ratio.name: ratio}
+ df = DataFrame(data)
+ df.name = f"TSV{_props}"
+ df.category = tsv.category
+
+ return df
\ No newline at end of file
diff --git a/setup.py b/setup.py
index 5394b2f..0789f02 100644
--- a/setup.py
+++ b/setup.py
@@ -19,7 +19,7 @@ setup(
"pandas_ta.volatility",
"pandas_ta.volume"
],
- version=".".join(("0", "3", "38b")),
+ version=".".join(("0", "3", "41b")),
description=long_description,
long_description=long_description,
author="Kevin Johnson",
diff --git a/tests/test_ext_indicator_volume.py b/tests/test_ext_indicator_volume.py
index 1ca417e..70da6f2 100644
--- a/tests/test_ext_indicator_volume.py
+++ b/tests/test_ext_indicator_volume.py
@@ -1,3 +1,4 @@
+from unittest.case import skip
from .config import sample_data
from .context import pandas_ta
@@ -100,7 +101,13 @@ class TestVolumeExtension(TestCase):
self.assertIsInstance(self.data, DataFrame)
self.assertEqual(self.data.columns[-1], "PVT")
+ @skip("\nVP does not return a Time Series")
def test_vp_ext(self):
result = self.data.ta.vp()
self.assertIsInstance(result, DataFrame)
self.assertEqual(result.name, "VP_10")
+
+ def test_wb_tsv_ext(self):
+ self.data.ta.wb_tsv(append=True)
+ self.assertIsInstance(self.data, DataFrame)
+ self.assertEqual(list(self.data.columns[-3:]), ["TSV_18_10", "TSVs_18_10", "TSVr_18_10"])
diff --git a/tests/test_indicator_momentum.py b/tests/test_indicator_momentum.py
index aa467e5..b7f691d 100644
--- a/tests/test_indicator_momentum.py
+++ b/tests/test_indicator_momentum.py
@@ -446,7 +446,7 @@ class TestMomentum(TestCase):
def test_stoch(self):
# TV Correlation
- result = pandas_ta.stoch(self.high, self.low, self.close)
+ result = pandas_ta.stoch(self.high, self.low, self.close, talib=False)
self.assertIsInstance(result, DataFrame)
self.assertEqual(result.name, "STOCH_14_3_3")
@@ -467,6 +467,10 @@ class TestMomentum(TestCase):
except Exception as ex:
error_analysis(result.iloc[:, 1], CORRELATION, ex, newline=False)
+ result = pandas_ta.stoch(self.high, self.low, self.close)
+ self.assertIsInstance(result, DataFrame)
+ self.assertEqual(result.name, "STOCH_14_3_3")
+
def test_stochf(self):
# TV Correlation
result = pandas_ta.stochf(self.high, self.low, self.close, talib=False)
diff --git a/tests/test_indicator_volume.py b/tests/test_indicator_volume.py
index dae1f54..518f7c1 100644
--- a/tests/test_indicator_volume.py
+++ b/tests/test_indicator_volume.py
@@ -174,3 +174,8 @@ class TestVolume(TestCase):
result = pandas_ta.vp(self.close, self.volume_)
self.assertIsInstance(result, DataFrame)
self.assertEqual(result.name, "VP_10")
+
+ def test_wb_tsv(self):
+ result = pandas_ta.wb_tsv(self.close, self.volume_)
+ self.assertIsInstance(result, DataFrame)
+ self.assertEqual(result.name, "TSV_18_10")