diff --git a/freqtrade/templates/base_strategy.py.j2 b/freqtrade/templates/base_strategy.py.j2 index 06d7cbc5c..7f5399672 100644 --- a/freqtrade/templates/base_strategy.py.j2 +++ b/freqtrade/templates/base_strategy.py.j2 @@ -12,6 +12,7 @@ from freqtrade.strategy import (BooleanParameter, CategoricalParameter, DecimalP # -------------------------------- # Add your lib to import here import talib.abstract as ta +import pandas_ta as pta import freqtrade.vendor.qtpylib.indicators as qtpylib @@ -36,6 +37,9 @@ class {{ strategy }}(IStrategy): # Check the documentation or the Sample strategy to get the latest version. INTERFACE_VERSION = 2 + # Optimal timeframe for the strategy. + timeframe = '5m' + # Minimal ROI designed for the strategy. # This attribute will be overridden if the config file contains "minimal_roi". minimal_roi = { @@ -54,9 +58,6 @@ class {{ strategy }}(IStrategy): # trailing_stop_positive = 0.01 # trailing_stop_positive_offset = 0.0 # Disabled / not configured - # Optimal timeframe for the strategy. - timeframe = '5m' - # Run "populate_indicators()" only for new candle. process_only_new_candles = False @@ -68,6 +69,10 @@ class {{ strategy }}(IStrategy): # Number of candles the strategy requires before producing valid signals startup_candle_count: int = 30 + # Strategy parameters + buy_rsi = IntParameter(10, 40, default=30, space="buy") + sell_rsi = IntParameter(60, 90, default=70, space="sell") + # Optional order type mapping. order_types = { 'buy': 'limit', diff --git a/freqtrade/templates/subtemplates/buy_trend_full.j2 b/freqtrade/templates/subtemplates/buy_trend_full.j2 index 1a0d326b3..aac8325a7 100644 --- a/freqtrade/templates/subtemplates/buy_trend_full.j2 +++ b/freqtrade/templates/subtemplates/buy_trend_full.j2 @@ -1,3 +1,3 @@ -(qtpylib.crossed_above(dataframe['rsi'], 30)) & # Signal: RSI crosses above 30 +(qtpylib.crossed_above(dataframe['rsi'], self.buy_rsi.value)) & # Signal: RSI crosses above buy_rsi (dataframe['tema'] <= dataframe['bb_middleband']) & # Guard: tema below BB middle (dataframe['tema'] > dataframe['tema'].shift(1)) & # Guard: tema is raising diff --git a/freqtrade/templates/subtemplates/buy_trend_minimal.j2 b/freqtrade/templates/subtemplates/buy_trend_minimal.j2 index 6a4079cf3..e89d3779e 100644 --- a/freqtrade/templates/subtemplates/buy_trend_minimal.j2 +++ b/freqtrade/templates/subtemplates/buy_trend_minimal.j2 @@ -1 +1 @@ -(qtpylib.crossed_above(dataframe['rsi'], 30)) & # Signal: RSI crosses above 30 +(qtpylib.crossed_above(dataframe['rsi'], self.buy_rsi.value)) & # Signal: RSI crosses above buy_rsi diff --git a/freqtrade/templates/subtemplates/sell_trend_full.j2 b/freqtrade/templates/subtemplates/sell_trend_full.j2 index 36c08c947..3068d8d57 100644 --- a/freqtrade/templates/subtemplates/sell_trend_full.j2 +++ b/freqtrade/templates/subtemplates/sell_trend_full.j2 @@ -1,3 +1,3 @@ -(qtpylib.crossed_above(dataframe['rsi'], 70)) & # Signal: RSI crosses above 70 +(qtpylib.crossed_above(dataframe['rsi'], self.sell_rsi.value)) & # Signal: RSI crosses above sell_rsi (dataframe['tema'] > dataframe['bb_middleband']) & # Guard: tema above BB middle (dataframe['tema'] < dataframe['tema'].shift(1)) & # Guard: tema is falling diff --git a/freqtrade/templates/subtemplates/sell_trend_minimal.j2 b/freqtrade/templates/subtemplates/sell_trend_minimal.j2 index 42a7b81a2..5dabc5910 100644 --- a/freqtrade/templates/subtemplates/sell_trend_minimal.j2 +++ b/freqtrade/templates/subtemplates/sell_trend_minimal.j2 @@ -1 +1 @@ -(qtpylib.crossed_above(dataframe['rsi'], 70)) & # Signal: RSI crosses above 70 +(qtpylib.crossed_above(dataframe['rsi'], self.sell_rsi.value)) & # Signal: RSI crosses above sell_rsi