From b8099aed61981dad896f4fa9b95f64538be394b6 Mon Sep 17 00:00:00 2001 From: Dario Lopez Padial Date: Wed, 27 Nov 2019 10:03:34 +0100 Subject: [PATCH] adding PSAR to wrapper --- ta/wrapper.py | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/ta/wrapper.py b/ta/wrapper.py index dcbf8dda..682db95c 100644 --- a/ta/wrapper.py +++ b/ta/wrapper.py @@ -8,7 +8,8 @@ DailyReturnIndicator) from ta.trend import (MACD, ADXIndicator, AroonIndicator, CCIIndicator, DPOIndicator, EMAIndicator, IchimokuIndicator, - KSTIndicator, MassIndex, TRIXIndicator, VortexIndicator) + KSTIndicator, MassIndex, PSARIndicator, TRIXIndicator, + VortexIndicator) from ta.volatility import (AverageTrueRange, BollingerBands, DonchianChannel, KeltnerChannel) from ta.volume import (AccDistIndexIndicator, ChaikinMoneyFlowIndicator, @@ -186,11 +187,19 @@ def add_trend_ta(df: pd.DataFrame, high: str, low: str, close: str, fillna: bool df[f'{colprefix}trend_visual_ichimoku_b'] = indicator.ichimoku_b() # Aroon Indicator - indicator = AroonIndicator(df[close], n=25, fillna=fillna) + indicator = AroonIndicator(close=df[close], n=25, fillna=fillna) df[f'{colprefix}trend_aroon_up'] = indicator.aroon_up() df[f'{colprefix}trend_aroon_down'] = indicator.aroon_down() df[f'{colprefix}trend_aroon_ind'] = indicator.aroon_indicator() + # PSAR Indicator + indicator = PSARIndicator(high=df[high], low=df[low], close=df[close], step=0.02, max_step=0.20, fillna=fillna) + df[f'{colprefix}trend_psar'] = indicator.psar() + df[f'{colprefix}trend_psar_up'] = indicator.psar_up() + df[f'{colprefix}trend_psar_down'] = indicator.psar_down() + df[f'{colprefix}trend_psar_up_indicator'] = indicator.psar_up_indicator() + df[f'{colprefix}trend_psar_down_indicator'] = indicator.psar_down_indicator() + return df