From bd45dcb313e7c63c4704b03d5ab65d3235698e38 Mon Sep 17 00:00:00 2001 From: Joe Schr Date: Fri, 5 Mar 2021 15:42:32 +0100 Subject: [PATCH] fix(custom_stoploss_with_psar): only use one indicator in this example makes the example clearer --- user_data/strategies/custom_stoploss_with_psar.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/user_data/strategies/custom_stoploss_with_psar.py b/user_data/strategies/custom_stoploss_with_psar.py index ac70ace..73cb46d 100644 --- a/user_data/strategies/custom_stoploss_with_psar.py +++ b/user_data/strategies/custom_stoploss_with_psar.py @@ -65,19 +65,20 @@ class CustomStoplossWithPSAR(IStrategy): self.custom_info[metadata['pair']] = dataframe[['date', 'sar']].copy().set_index('date') # all "normal" indicators: - dataframe['rsi'] = ta.RSI(dataframe) + # e.g. + # dataframe['rsi'] = ta.RSI(dataframe) return dataframe def populate_buy_trend(self, dataframe: DataFrame, metadata: dict) -> DataFrame: """ - Placeholder Strategy + Placeholder Strategy: buys when SAR is smaller then candle before Based on TA indicators, populates the buy signal for the given dataframe :param dataframe: DataFrame :return: DataFrame with buy column """ dataframe.loc[ ( - (dataframe['rsi'] < 30) + (dataframe['sar'] < dataframe['sar'].shift()) ), 'buy'] = 1