Merge pull request #321 from stash86/fix-recursive
Add startup candle to avoid recursive issue
This commit is contained in:
@@ -19,7 +19,7 @@ __BTC_donation__ = "3FgFaG15yntZYSUzfEpxr5mDt1RArvcQrK"
|
||||
# 199/40000: 30918 trades. 18982/3408/8528 Wins/Draws/Losses. Avg profit 0.39%. Median profit 0.65%. Total profit 119934.26007495 USDT ( 119.93%). Avg duration 8:12:00 min. Objective: -127.60220
|
||||
|
||||
class Bandtastic(IStrategy):
|
||||
INTERFACE_VERSION = 2
|
||||
INTERFACE_VERSION = 3
|
||||
|
||||
timeframe = '15m'
|
||||
|
||||
@@ -34,6 +34,8 @@ class Bandtastic(IStrategy):
|
||||
# Stoploss:
|
||||
stoploss = -0.345
|
||||
|
||||
startup_candle_count = 999
|
||||
|
||||
# Trailing stop:
|
||||
trailing_stop = True
|
||||
trailing_stop_positive = 0.01
|
||||
@@ -42,7 +44,7 @@ class Bandtastic(IStrategy):
|
||||
|
||||
# Hyperopt Buy Parameters
|
||||
buy_fastema = IntParameter(low=1, high=236, default=211, space='buy', optimize=True, load=True)
|
||||
buy_slowema = IntParameter(low=1, high=126, default=364, space='buy', optimize=True, load=True)
|
||||
buy_slowema = IntParameter(low=1, high=250, default=250, space='buy', optimize=True, load=True)
|
||||
buy_rsi = IntParameter(low=15, high=70, default=52, space='buy', optimize=True, load=True)
|
||||
buy_mfi = IntParameter(low=15, high=70, default=30, space='buy', optimize=True, load=True)
|
||||
|
||||
@@ -98,7 +100,7 @@ class Bandtastic(IStrategy):
|
||||
|
||||
return dataframe
|
||||
|
||||
def populate_buy_trend(self, dataframe: DataFrame, metadata: dict) -> DataFrame:
|
||||
def populate_entry_trend(self, dataframe: DataFrame, metadata: dict) -> DataFrame:
|
||||
conditions = []
|
||||
|
||||
# GUARDS
|
||||
@@ -125,11 +127,11 @@ class Bandtastic(IStrategy):
|
||||
if conditions:
|
||||
dataframe.loc[
|
||||
reduce(lambda x, y: x & y, conditions),
|
||||
'buy'] = 1
|
||||
'enter_long'] = 1
|
||||
|
||||
return dataframe
|
||||
|
||||
def populate_sell_trend(self, dataframe: DataFrame, metadata: dict) -> DataFrame:
|
||||
def populate_exit_trend(self, dataframe: DataFrame, metadata: dict) -> DataFrame:
|
||||
conditions = []
|
||||
|
||||
# GUARDS
|
||||
@@ -156,6 +158,6 @@ class Bandtastic(IStrategy):
|
||||
if conditions:
|
||||
dataframe.loc[
|
||||
reduce(lambda x, y: x & y, conditions),
|
||||
'sell'] = 1
|
||||
'exit_long'] = 1
|
||||
|
||||
return dataframe
|
||||
|
||||
@@ -29,6 +29,8 @@ class CustomStoplossWithPSAR(IStrategy):
|
||||
custom_info = {}
|
||||
use_custom_stoploss = True
|
||||
|
||||
startup_candle_count = 199
|
||||
|
||||
def custom_stoploss(self, pair: str, trade: 'Trade', current_time: datetime,
|
||||
current_rate: float, current_profit: float, **kwargs) -> float:
|
||||
|
||||
|
||||
@@ -104,7 +104,7 @@ class FixedRiskRewardLoss(IStrategy):
|
||||
:param dataframe: DataFrame
|
||||
:return: DataFrame with buy column
|
||||
"""
|
||||
# Allways buys
|
||||
# Always buys
|
||||
dataframe.loc[:, 'enter_long'] = 1
|
||||
return dataframe
|
||||
|
||||
|
||||
@@ -63,7 +63,7 @@ class Supertrend(IStrategy):
|
||||
|
||||
timeframe = '1h'
|
||||
|
||||
startup_candle_count = 18
|
||||
startup_candle_count = 199
|
||||
|
||||
buy_m1 = IntParameter(1, 7, default=4)
|
||||
buy_m2 = IntParameter(1, 7, default=4)
|
||||
|
||||
Reference in New Issue
Block a user