Zeus_8_3_2_B_4_2 Sell / buy BTC 01/2025 344euros
This commit is contained in:
@@ -70,9 +70,14 @@ class Zeus_8_3_2_B_4_2(IStrategy):
|
||||
stakes = 40
|
||||
|
||||
# Stoploss:
|
||||
stoploss = -1 # 0.256
|
||||
# stoploss = -1 # 0.256
|
||||
# Custom stoploss
|
||||
use_custom_stoploss = True
|
||||
# use_custom_stoploss = False
|
||||
|
||||
trailing_stop = True
|
||||
trailing_stop_positive = 0.15
|
||||
trailing_stop_positive_offset = 0.20
|
||||
trailing_only_offset_is_reached = True
|
||||
|
||||
# Buy hypers
|
||||
timeframe = '5m'
|
||||
@@ -250,14 +255,17 @@ class Zeus_8_3_2_B_4_2(IStrategy):
|
||||
#
|
||||
mise_factor_buy = DecimalParameter(0.01, 0.1, default=0.05, decimals=2, space='buy', optimize=True, load=True)
|
||||
|
||||
indicators = {'sma5', 'sma12', 'sma24', 'sma60', 'mid_smooth_3', 'mid_smooth_5', 'mid_smooth_12', 'mid_smooth_24'}
|
||||
indicators = {'sma5', 'sma12', 'sma24', 'sma60'}
|
||||
indicators_percent = {'percent', 'percent3', 'percent12', 'percent24', 'percent_1h', 'percent3_1h', 'percent12_1h', 'percent24_1h'}
|
||||
|
||||
mises = IntParameter(1, 50, default=10, space='buy', optimize=True, load=True)
|
||||
|
||||
pct = DecimalParameter(0.005, 0.05, default=0.012, decimals=3, space='buy', optimize=True, load=True)
|
||||
pct_inc = DecimalParameter(0.0001, 0.003, default=0.005, decimals=4, space='buy', optimize=True, load=True)
|
||||
pct_inc = DecimalParameter(0.0001, 0.003, default=0.0022, decimals=4, space='buy', optimize=False, load=True)
|
||||
|
||||
indic_5m = CategoricalParameter(indicators, default="sma60", space='buy')
|
||||
indic_deriv_5m_buy = CategoricalParameter(indicators, default="sma12", space='buy', optimize=False, load=False)
|
||||
deriv_5m_buy = DecimalParameter(-0.1, 0.5, default=0, decimals=2, space='buy', optimize=True, load=True)
|
||||
# indic_deriv1_5m = DecimalParameter(-2, 2, default=0, decimals=2, space='buy', optimize=True, load=True)
|
||||
# indic_deriv2_5m = DecimalParameter(-2, 2, default=0, decimals=2, space='buy', optimize=True, load=True)
|
||||
|
||||
@@ -273,6 +281,12 @@ class Zeus_8_3_2_B_4_2(IStrategy):
|
||||
|
||||
|
||||
indic_5m_sell = CategoricalParameter(indicators, default="sma60", space='sell')
|
||||
indic_deriv_5m_sell = CategoricalParameter(indicators, default="sma60", space='sell')
|
||||
deriv_5m_sell = DecimalParameter(-0.1, 0.5, default=0, decimals=2, space='sell', optimize=True, load=True)
|
||||
# indic_percent_sell = CategoricalParameter(indicators_percent, default="sma60", space='sell')
|
||||
|
||||
# percent_5m_sell = DecimalParameter(-0.1, -0.0, default=0, decimals=2, space='sell', optimize=True, load=True)
|
||||
|
||||
# indic_deriv1_5m_sell = DecimalParameter(-2, 2, default=0, decimals=2, space='sell', optimize=True, load=True)
|
||||
# indic_deriv2_5m_sell = DecimalParameter(-2, 2, default=0, decimals=2, space='sell', optimize=True, load=True)
|
||||
|
||||
@@ -401,7 +415,7 @@ class Zeus_8_3_2_B_4_2(IStrategy):
|
||||
last_candle = dataframe.iloc[-1].squeeze()
|
||||
|
||||
force = self.pairs[pair]['force_sell']
|
||||
allow_to_sell = (last_candle['hapercent'] < 0) or force or (exit_reason == 'force_exit')
|
||||
allow_to_sell = (last_candle['hapercent'] < 0 and trade.calc_profit(rate, amount) > 0) or force or (exit_reason == 'force_exit')
|
||||
|
||||
minutes = int(round((current_time - trade.date_last_filled_utc).total_seconds() / 60, 0))
|
||||
|
||||
@@ -1064,6 +1078,8 @@ class Zeus_8_3_2_B_4_2(IStrategy):
|
||||
# tr = DataFrame({'hl': high_low, 'hc': high_close, 'lc': low_close}).max(axis=1)
|
||||
# dataframe['atr'] = tr.rolling(window=self.DEFAULT_PARAMS['atr_period']).mean()
|
||||
|
||||
dataframe['volume_sma_deriv'] = dataframe['volume'] * dataframe['sma5_deriv1'] / (dataframe['volume'].rolling(5).mean())
|
||||
|
||||
self.setTrends(dataframe)
|
||||
|
||||
return dataframe
|
||||
@@ -1131,7 +1147,7 @@ class Zeus_8_3_2_B_4_2(IStrategy):
|
||||
dataframe['up_pct'] = self.calculateUpDownPct(dataframe, 'up_count')
|
||||
|
||||
def calculateDerivation(self, dataframe, window=12, suffixe='', timeframe='5m'):
|
||||
dataframe[f"mid_smooth{suffixe}"] = dataframe['mid']
|
||||
dataframe[f"mid_smooth{suffixe}"] = dataframe['mid'].rolling(window).mean()
|
||||
dataframe = self.calculeDerivees(dataframe, f"mid_smooth{suffixe}", timeframe=timeframe, ema_period=window)
|
||||
return dataframe
|
||||
|
||||
@@ -1322,9 +1338,11 @@ class Zeus_8_3_2_B_4_2(IStrategy):
|
||||
dataframe.loc[
|
||||
(
|
||||
(dataframe[f"{self.indic_5m.value}"].shift(2) >= dataframe[f"{self.indic_5m.value}"].shift(1))
|
||||
& (dataframe[f"{self.indic_5m.value}"].shift(1) <= dataframe['sma5'])
|
||||
& (dataframe[f"sma60_deriv1"] >= -0.2)
|
||||
), ['enter_long', 'enter_tag']] = (1, 'sma5')
|
||||
& (dataframe[f"{self.indic_5m.value}"].shift(1) <= dataframe[f"{self.indic_5m.value}"])
|
||||
& (dataframe[f"{self.indic_deriv_5m_buy.value}_deriv1"] > self.deriv_5m_buy.value)
|
||||
# & (dataframe[f"sma60_deriv1"] >= -0.2)
|
||||
# & (dataframe[f"hapercent"] >= -0.001)
|
||||
), ['enter_long', 'enter_tag']] = (1, f"{self.indic_5m.value}")
|
||||
|
||||
dataframe['test'] = np.where(dataframe['enter_long'] == 1, dataframe['close'] * 1.01, np.nan)
|
||||
|
||||
@@ -1488,8 +1506,13 @@ class Zeus_8_3_2_B_4_2(IStrategy):
|
||||
(
|
||||
(dataframe[f"{self.indic_5m_sell.value}"].shift(2) < dataframe[f"{self.indic_5m_sell.value}"].shift(1))
|
||||
& (dataframe[f"{self.indic_5m_sell.value}"].shift(1) > dataframe[f"{self.indic_5m_sell.value}"])
|
||||
& (dataframe[f"sma60_deriv1"] > 0.3)
|
||||
), ['exit_long', 'exit_tag']] = (1, 'sma5')
|
||||
& (dataframe[f"{self.indic_deriv_5m_sell.value}_deriv1"] < self.deriv_5m_sell.value)
|
||||
), ['exit_long', 'exit_tag']] = (1, f"{self.indic_5m_sell.value}")
|
||||
|
||||
# dataframe.loc[
|
||||
# (
|
||||
# (dataframe[f"{self.indic_percent_sell.value}"] < self.percent_5m_sell.value)
|
||||
# ), ['exit_long', 'exit_tag']] = (1, f"{self.indic_percent_sell.value}")
|
||||
|
||||
return dataframe
|
||||
|
||||
@@ -1559,7 +1582,7 @@ class Zeus_8_3_2_B_4_2(IStrategy):
|
||||
if not self.should_enter_trade(pair, last_candle, current_time):
|
||||
return None
|
||||
|
||||
condition = (last_candle['enter_long'] and last_candle['sma5_deriv1_1h'] > 0) or (last_candle['percent3'] < -0.03 and last_candle['percent'] > 0)
|
||||
condition = (last_candle['enter_long'] and last_candle['sma5_deriv1'] > 0 and last_candle['hapercent'] > 0) or (last_candle['percent3'] < -0.03 and last_candle['percent'] > 0)
|
||||
|
||||
# if (self.getShortName(pair) != 'BTC' and count_of_buys > 3):
|
||||
# condition = before_last_candle_24['mid_smooth_3_1h'] > before_last_candle_12['mid_smooth_3_1h'] and before_last_candle_12['mid_smooth_3_1h'] < last_candle['mid_smooth_3_1h'] #and last_candle['mid_smooth_3_deriv1_1h'] < -1.5
|
||||
|
||||
Reference in New Issue
Block a user