Add can_short to sample strategies

This commit is contained in:
Matthias 2022-03-12 07:00:57 +01:00
parent 0aa170ac95
commit 12c909d8a8
4 changed files with 16 additions and 6 deletions

View File

@ -81,6 +81,7 @@ class IStrategy(ABC, HyperStrategyMixin):
trailing_only_offset_is_reached = False
use_custom_stoploss: bool = False
# Can this strategy go short?
can_short: bool = False
# associated timeframe

View File

@ -40,6 +40,9 @@ class {{ strategy }}(IStrategy):
# Optimal timeframe for the strategy.
timeframe = '5m'
# Can this strategy go short?
can_short: bool = False
# Minimal ROI designed for the strategy.
# This attribute will be overridden if the config file contains "minimal_roi".
minimal_roi = {

View File

@ -38,6 +38,9 @@ class SampleShortStrategy(IStrategy):
# Check the documentation or the Sample strategy to get the latest version.
INTERFACE_VERSION = 2
# Can this strategy go short?
can_short: bool = True
# Minimal ROI designed for the strategy.
# This attribute will be overridden if the config file contains "minimal_roi".
minimal_roi = {

View File

@ -37,6 +37,9 @@ class SampleStrategy(IStrategy):
# Check the documentation or the Sample strategy to get the latest version.
INTERFACE_VERSION = 2
# Can this strategy go short?
can_short: bool = False
# Minimal ROI designed for the strategy.
# This attribute will be overridden if the config file contains "minimal_roi".
minimal_roi = {
@ -55,12 +58,6 @@ class SampleStrategy(IStrategy):
# trailing_stop_positive = 0.01
# trailing_stop_positive_offset = 0.0 # Disabled / not configured
# Hyperoptable parameters
buy_rsi = IntParameter(low=1, high=50, default=30, space='buy', optimize=True, load=True)
sell_rsi = IntParameter(low=50, high=100, default=70, space='sell', optimize=True, load=True)
short_rsi = IntParameter(low=51, high=100, default=70, space='sell', optimize=True, load=True)
exit_short_rsi = IntParameter(low=1, high=50, default=30, space='buy', optimize=True, load=True)
# Optimal timeframe for the strategy.
timeframe = '5m'
@ -72,6 +69,12 @@ class SampleStrategy(IStrategy):
sell_profit_only = False
ignore_roi_if_buy_signal = False
# Hyperoptable parameters
buy_rsi = IntParameter(low=1, high=50, default=30, space='buy', optimize=True, load=True)
sell_rsi = IntParameter(low=50, high=100, default=70, space='sell', optimize=True, load=True)
short_rsi = IntParameter(low=51, high=100, default=70, space='sell', optimize=True, load=True)
exit_short_rsi = IntParameter(low=1, high=50, default=30, space='buy', optimize=True, load=True)
# Number of candles the strategy requires before producing valid signals
startup_candle_count: int = 30