mirror of
https://github.com/wassname/pandas-ta.git
synced 2026-08-11 11:22:48 +08:00
BUG apo correctly calculated and talib correlated
This commit is contained in:
@@ -42,6 +42,7 @@ All the indicators return a named Series or a DataFrame in uppercase underscore
|
||||
- __Aberration__ (aberration)
|
||||
- __BRAR__ (brar)
|
||||
* Corrected Indicators:
|
||||
- __Absolute Price Oscillator__ (apo)
|
||||
- __Aroon & Aroon Oscillator__ (aroon)
|
||||
* Fixed indicator and included oscillator in returned dataframe
|
||||
- __Bollinger Bands__ (bbands)
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
from ..overlap.ema import ema
|
||||
from ..overlap.sma import sma
|
||||
from ..utils import get_offset, verify_series
|
||||
|
||||
def apo(close, fast=None, slow=None, offset=None, **kwargs):
|
||||
@@ -14,9 +14,8 @@ def apo(close, fast=None, slow=None, offset=None, **kwargs):
|
||||
offset = get_offset(offset)
|
||||
|
||||
# Calculate Result
|
||||
fastma = ema(close, length=fast, **kwargs)
|
||||
slowma = ema(close, length=slow, **kwargs)
|
||||
# EMAs are equivalent with talib, only their difference is minutely off
|
||||
fastma = sma(close, length=fast)
|
||||
slowma = sma(close, length=slow)
|
||||
apo = fastma - slowma
|
||||
|
||||
# Offset
|
||||
@@ -45,13 +44,13 @@ momentum. It is simply the difference of two Exponential Moving Averages
|
||||
(EMA) of two different periods. Note: APO and MACD lines are equivalent.
|
||||
|
||||
Sources:
|
||||
https://www.investopedia.com/terms/p/ppo.asp
|
||||
https://www.tradingtechnologies.com/xtrader-help/x-study/technical-indicator-definitions/absolute-price-oscillator-apo/
|
||||
|
||||
Calculation:
|
||||
Default Inputs:
|
||||
fast=12, slow=26
|
||||
EMA = Exponential Moving Average
|
||||
APO = EMA(close, fast) - EMA(close, slow)
|
||||
SMA = Simple Moving Average
|
||||
APO = SMA(close, fast) - SMA(close, slow)
|
||||
|
||||
Args:
|
||||
close (pd.Series): Series of 'close's
|
||||
|
||||
@@ -6,7 +6,7 @@ long_description = "An easy to use Python 3 Pandas Extension with 100+ Technical
|
||||
setup(
|
||||
name ="pandas_ta",
|
||||
packages =['pandas_ta', 'pandas_ta.momentum', 'pandas_ta.overlap', 'pandas_ta.performance', 'pandas_ta.statistics', 'pandas_ta.trend', 'pandas_ta.volatility', 'pandas_ta.volume'],
|
||||
version ="0.1.53b",
|
||||
version ="0.1.54b",
|
||||
description =long_description,
|
||||
long_description =long_description,
|
||||
author ="Kevin Johnson",
|
||||
|
||||
@@ -70,7 +70,7 @@ class TestMomentum(TestCase):
|
||||
self.assertEqual(result.name, 'APO_12_26')
|
||||
|
||||
try:
|
||||
expected = tal.APO(self.close, 12, 26)
|
||||
expected = tal.APO(self.close)
|
||||
pdt.assert_series_equal(result, expected, check_names=False)
|
||||
except AssertionError as ae:
|
||||
try:
|
||||
|
||||
Reference in New Issue
Block a user