Compare commits
2 Commits
70ceb76f1b
...
b8da3af406
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b8da3af406 | ||
|
|
1090093735 |
@@ -185,7 +185,8 @@ class Zeus_8_3_2_B_4_2(IStrategy):
|
|||||||
'max_profit': 0,
|
'max_profit': 0,
|
||||||
'last_palier_index': -1,
|
'last_palier_index': -1,
|
||||||
'total_amount': 0,
|
'total_amount': 0,
|
||||||
'has_gain': 0
|
'has_gain': 0,
|
||||||
|
'force_sell': False
|
||||||
}
|
}
|
||||||
for pair in ["BTC/USDC", "ETH/USDC", "DOGE/USDC", "XRP/USDC", "SOL/USDC",
|
for pair in ["BTC/USDC", "ETH/USDC", "DOGE/USDC", "XRP/USDC", "SOL/USDC",
|
||||||
"BTC/USDT", "ETH/USDT", "DOGE/USDT", "XRP/USDT", "SOL/USDT"]
|
"BTC/USDT", "ETH/USDT", "DOGE/USDT", "XRP/USDT", "SOL/USDT"]
|
||||||
@@ -398,6 +399,7 @@ class Zeus_8_3_2_B_4_2(IStrategy):
|
|||||||
dispo=dispo,
|
dispo=dispo,
|
||||||
profit=round(trade.calc_profit(rate, amount), 2)
|
profit=round(trade.calc_profit(rate, amount), 2)
|
||||||
)
|
)
|
||||||
|
self.pairs[pair]['force_sell'] = False
|
||||||
self.pairs[pair]['has_gain'] = 0
|
self.pairs[pair]['has_gain'] = 0
|
||||||
self.pairs[pair]['current_profit'] = 0
|
self.pairs[pair]['current_profit'] = 0
|
||||||
self.pairs[pair]['total_amount'] = 0
|
self.pairs[pair]['total_amount'] = 0
|
||||||
@@ -464,14 +466,12 @@ class Zeus_8_3_2_B_4_2(IStrategy):
|
|||||||
pair=pair,
|
pair=pair,
|
||||||
rate=last_candle['close'],
|
rate=last_candle['close'],
|
||||||
trade_type='',
|
trade_type='',
|
||||||
profit=0, # round(current_profit * trade.stake_amount, 2),
|
profit=round(current_profit * trade.stake_amount, 1),
|
||||||
buys='',
|
buys='',
|
||||||
stake=0
|
stake=0
|
||||||
)
|
)
|
||||||
|
|
||||||
if last_candle['mid_smooth_5_deriv1_1d'] > self.sma5_deriv1_1d_stop_sell.value \
|
if last_candle['mid_smooth_1h_deriv1'] > self.sma5_deriv1_1h_stop_sell.value \
|
||||||
and last_candle['mid_smooth_5_deriv2_1d'] > self.sma5_deriv2_1d_stop_sell.value \
|
|
||||||
and last_candle['mid_smooth_1h_deriv1'] > self.sma5_deriv1_1h_stop_sell.value \
|
|
||||||
and last_candle['mid_smooth_1h_deriv2'] > self.sma5_deriv2_1h_stop_sell.value:
|
and last_candle['mid_smooth_1h_deriv2'] > self.sma5_deriv2_1h_stop_sell.value:
|
||||||
return None
|
return None
|
||||||
|
|
||||||
@@ -488,7 +488,8 @@ class Zeus_8_3_2_B_4_2(IStrategy):
|
|||||||
|
|
||||||
# if 1 <= count_of_buys <= 3:
|
# if 1 <= count_of_buys <= 3:
|
||||||
if last_candle['mid_smooth_1h_deriv1'] < 0 and current_profit > expected_profit:
|
if last_candle['mid_smooth_1h_deriv1'] < 0 and current_profit > expected_profit:
|
||||||
return 'Drv3_' + pair_name + '_' + str(count_of_buys)
|
self.pairs[pair]['force_sell'] = False
|
||||||
|
return 'Drv3_' + pair_name + '_' + str(count_of_buys) + '_' + str(self.pairs[pair]['has_gain'])
|
||||||
|
|
||||||
# if 4 <= count_of_buys <= 6:
|
# if 4 <= count_of_buys <= 6:
|
||||||
# if ((before_last_candle_2['mid_smooth_12_deriv1'] <= before_last_candle['mid_smooth_12_deriv1'])
|
# if ((before_last_candle_2['mid_smooth_12_deriv1'] <= before_last_candle['mid_smooth_12_deriv1'])
|
||||||
@@ -1240,7 +1241,7 @@ class Zeus_8_3_2_B_4_2(IStrategy):
|
|||||||
if trade.has_open_orders:
|
if trade.has_open_orders:
|
||||||
# print("skip open orders")
|
# print("skip open orders")
|
||||||
return None
|
return None
|
||||||
if (self.wallets.get_available_stake_amount() < 50): # or trade.stake_amount >= max_stake:
|
if (self.wallets.get_available_stake_amount() < 0): # or trade.stake_amount >= max_stake:
|
||||||
return 0
|
return 0
|
||||||
|
|
||||||
dataframe, _ = self.dp.get_analyzed_dataframe(trade.pair, self.timeframe)
|
dataframe, _ = self.dp.get_analyzed_dataframe(trade.pair, self.timeframe)
|
||||||
@@ -1333,7 +1334,7 @@ class Zeus_8_3_2_B_4_2(IStrategy):
|
|||||||
# pair=trade.pair,
|
# pair=trade.pair,
|
||||||
# rate=current_rate,
|
# rate=current_rate,
|
||||||
# trade_type=trade_type,
|
# trade_type=trade_type,
|
||||||
# profit=round(current_profit, 4), # round(current_profit * trade.stake_amount, 2),
|
# profit=round(current_profit, 4), # round(current_profit * trade.stake_amount, 1),
|
||||||
# buys=trade.nr_of_successful_entries + 1,
|
# buys=trade.nr_of_successful_entries + 1,
|
||||||
# stake=round(stake_amount, 2)
|
# stake=round(stake_amount, 2)
|
||||||
# )
|
# )
|
||||||
@@ -1362,7 +1363,7 @@ class Zeus_8_3_2_B_4_2(IStrategy):
|
|||||||
# pair=trade.pair,
|
# pair=trade.pair,
|
||||||
# rate=current_rate,
|
# rate=current_rate,
|
||||||
# trade_type=trade_type,
|
# trade_type=trade_type,
|
||||||
# profit=round(current_profit, 4), # round(current_profit * trade.stake_amount, 2),
|
# profit=round(current_profit, 4), # round(current_profit * trade.stake_amount, 1),
|
||||||
# buys=trade.nr_of_successful_entries + 1,
|
# buys=trade.nr_of_successful_entries + 1,
|
||||||
# stake=round(stake_amount, 2)
|
# stake=round(stake_amount, 2)
|
||||||
# )
|
# )
|
||||||
@@ -1415,6 +1416,10 @@ class Zeus_8_3_2_B_4_2(IStrategy):
|
|||||||
limit_buy = 40
|
limit_buy = 40
|
||||||
if (count_of_buys < limit_buy) and condition and (pct_max < lim):
|
if (count_of_buys < limit_buy) and condition and (pct_max < lim):
|
||||||
try:
|
try:
|
||||||
|
|
||||||
|
if self.pairs[pair]['has_gain']:
|
||||||
|
self.pairs[pair]['force_sell'] = True;
|
||||||
|
|
||||||
# if 6 <= count_of_buys:
|
# if 6 <= count_of_buys:
|
||||||
# if not ((before_last_candle_24['sma24_deriv1_1h'] > before_last_candle_12['sma24_deriv1_1h'])
|
# if not ((before_last_candle_24['sma24_deriv1_1h'] > before_last_candle_12['sma24_deriv1_1h'])
|
||||||
# & (before_last_candle_12['sma24_deriv1_1h'] < last_candle['sma24_deriv1_1h'])):
|
# & (before_last_candle_12['sma24_deriv1_1h'] < last_candle['sma24_deriv1_1h'])):
|
||||||
@@ -1437,35 +1442,37 @@ class Zeus_8_3_2_B_4_2(IStrategy):
|
|||||||
stake_amount = min(min(max_amount, self.wallets.get_available_stake_amount()),
|
stake_amount = min(min(max_amount, self.wallets.get_available_stake_amount()),
|
||||||
self.adjust_stake_amount(pair, last_candle) - 10 * pct_first / self.mise_factor_buy.value) # min(200, self.adjust_stake_amount(pair, last_candle) * self.fibo[count_of_buys])
|
self.adjust_stake_amount(pair, last_candle) - 10 * pct_first / self.mise_factor_buy.value) # min(200, self.adjust_stake_amount(pair, last_candle) * self.fibo[count_of_buys])
|
||||||
|
|
||||||
trade_type = last_candle['enter_tag'] if last_candle['enter_long'] == 1 else 'pct48'
|
if self.wallets.get_available_stake_amount() > stake_amount:
|
||||||
self.pairs[trade.pair]['count_of_buys'] += 1
|
trade_type = last_candle['enter_tag'] if last_candle['enter_long'] == 1 else 'pct48'
|
||||||
self.pairs[pair]['total_amount'] += stake_amount
|
self.pairs[trade.pair]['count_of_buys'] += 1
|
||||||
self.log_trade(
|
self.pairs[pair]['total_amount'] += stake_amount
|
||||||
last_candle=last_candle,
|
self.log_trade(
|
||||||
date=current_time,
|
last_candle=last_candle,
|
||||||
action="🟧 Loss -",
|
date=current_time,
|
||||||
dispo=dispo,
|
action="🟧 Loss -",
|
||||||
pair=trade.pair,
|
dispo=dispo,
|
||||||
rate=current_rate,
|
pair=trade.pair,
|
||||||
trade_type=trade_type,
|
rate=current_rate,
|
||||||
profit=round(current_profit, 2), # round(current_profit * trade.stake_amount, 2),
|
trade_type=trade_type,
|
||||||
buys=trade.nr_of_successful_entries + 1,
|
profit=round(current_profit * trade.stake_amount, 1),
|
||||||
stake=round(stake_amount, 2)
|
buys=trade.nr_of_successful_entries + 1,
|
||||||
)
|
stake=round(stake_amount, 2)
|
||||||
|
)
|
||||||
|
|
||||||
self.pairs[trade.pair]['last_buy'] = current_rate
|
self.pairs[trade.pair]['last_buy'] = current_rate
|
||||||
self.pairs[trade.pair]['max_touch'] = last_candle['close']
|
self.pairs[trade.pair]['max_touch'] = last_candle['close']
|
||||||
self.pairs[trade.pair]['last_candle'] = last_candle
|
self.pairs[trade.pair]['last_candle'] = last_candle
|
||||||
|
|
||||||
# df = pd.DataFrame.from_dict(self.pairs, orient='index')
|
# df = pd.DataFrame.from_dict(self.pairs, orient='index')
|
||||||
# colonnes_a_exclure = ['last_candle', 'last_trade', 'last_palier_index', 'stop',
|
# colonnes_a_exclure = ['last_candle', 'last_trade', 'last_palier_index', 'stop',
|
||||||
# 'trade_info', 'last_date', 'expected_profit', 'last_count_of_buys', 'base_stake_amount', 'stop_buy']
|
# 'trade_info', 'last_date', 'expected_profit', 'last_count_of_buys', 'base_stake_amount', 'stop_buy']
|
||||||
# df_filtered = df[df['count_of_buys'] > 0].drop(columns=colonnes_a_exclure)
|
# df_filtered = df[df['count_of_buys'] > 0].drop(columns=colonnes_a_exclure)
|
||||||
# # df_filtered = df_filtered["first_buy", "last_max", "max_touch", "last_sell","last_buy", 'count_of_buys', 'current_profit']
|
# # df_filtered = df_filtered["first_buy", "last_max", "max_touch", "last_sell","last_buy", 'count_of_buys', 'current_profit']
|
||||||
#
|
#
|
||||||
# print(df_filtered)
|
# print(df_filtered)
|
||||||
|
|
||||||
return stake_amount
|
return stake_amount
|
||||||
|
return None
|
||||||
except Exception as exception:
|
except Exception as exception:
|
||||||
# print(exception)
|
# print(exception)
|
||||||
return None
|
return None
|
||||||
@@ -1478,7 +1485,7 @@ class Zeus_8_3_2_B_4_2(IStrategy):
|
|||||||
# pair=trade.pair,
|
# pair=trade.pair,
|
||||||
# rate=current_rate,
|
# rate=current_rate,
|
||||||
# trade_type="Stop loss",
|
# trade_type="Stop loss",
|
||||||
# profit=round(current_profit, 4), # round(current_profit * trade.stake_amount, 2),
|
# profit=round(current_profit, 4), # round(current_profit * trade.stake_amount, 1),
|
||||||
# buys=trade.nr_of_successful_entries + 1,
|
# buys=trade.nr_of_successful_entries + 1,
|
||||||
# stake=-trade.stake_amount
|
# stake=-trade.stake_amount
|
||||||
# )
|
# )
|
||||||
@@ -1487,28 +1494,40 @@ class Zeus_8_3_2_B_4_2(IStrategy):
|
|||||||
# self.pairs[trade.pair]['last_candle'] = last_candle
|
# self.pairs[trade.pair]['last_candle'] = last_candle
|
||||||
# return -trade.stake_amount
|
# return -trade.stake_amount
|
||||||
|
|
||||||
if (False and count_of_buys < limit_buy and pct_max > 0.004 and hours > 2 and condition
|
last_lost = self.getLastLost(last_candle, pair)
|
||||||
and last_candle['rsi'] < 65 and last_candle['rsi_deriv1'] > 0):
|
|
||||||
|
if (False and hours > 6 and pct_first < -0.05
|
||||||
|
and last_candle['sma5_deriv1_1h'] > 0
|
||||||
|
and last_candle['rsi'] < 65 and last_candle['rsi_1h'] < 65
|
||||||
|
and last_candle['rsi_deriv1'] > 0 and last_candle['rsi_deriv2'] > 0
|
||||||
|
and last_candle['mid_smooth_12_deriv1'] > 0
|
||||||
|
and last_candle['mid_smooth_12_deriv2'] > 0
|
||||||
|
):
|
||||||
try:
|
try:
|
||||||
self.pairs[pair]['has_gain'] += 1
|
stake_amount = self.pairs[pair]['first_amount'] / 2
|
||||||
stake_amount = self.pairs[pair]['first_amount']
|
if self.wallets.get_available_stake_amount() > stake_amount:
|
||||||
trade_type = last_candle['enter_tag'] if last_candle['enter_long'] == 1 else 'pct48'
|
self.pairs[pair]['has_gain'] += 1
|
||||||
self.log_trade(
|
|
||||||
last_candle=last_candle,
|
trade_type = 'Gain +'
|
||||||
date=current_time,
|
self.pairs[trade.pair]['count_of_buys'] += 1
|
||||||
action="Gain +",
|
self.pairs[pair]['total_amount'] += stake_amount
|
||||||
dispo=dispo,
|
self.log_trade(
|
||||||
pair=trade.pair,
|
last_candle=last_candle,
|
||||||
rate=current_rate,
|
date=current_time,
|
||||||
trade_type=str(round(pct_max, 4)),
|
action="🟡 Gain +",
|
||||||
profit=round(current_profit, 4), # round(current_profit * trade.stake_amount, 2),
|
dispo=dispo,
|
||||||
buys=trade.nr_of_successful_entries + 1,
|
pair=trade.pair,
|
||||||
stake=round(stake_amount, 2)
|
rate=current_rate,
|
||||||
)
|
trade_type=str(round(pct_max, 4)),
|
||||||
self.pairs[trade.pair]['last_buy'] = current_rate
|
profit=round(current_profit * trade.stake_amount, 1),
|
||||||
# self.pairs[trade.pair]['max_touch'] = last_candle['close']
|
buys=trade.nr_of_successful_entries + 1,
|
||||||
self.pairs[trade.pair]['last_candle'] = last_candle
|
stake=round(stake_amount, 2)
|
||||||
return stake_amount
|
)
|
||||||
|
self.pairs[trade.pair]['last_buy'] = current_rate
|
||||||
|
self.pairs[trade.pair]['max_touch'] = last_candle['close']
|
||||||
|
self.pairs[trade.pair]['last_candle'] = last_candle
|
||||||
|
return stake_amount
|
||||||
|
return None
|
||||||
except Exception as exception:
|
except Exception as exception:
|
||||||
# print(exception)
|
# print(exception)
|
||||||
return None
|
return None
|
||||||
@@ -1665,8 +1684,7 @@ class Zeus_8_3_2_B_4_2(IStrategy):
|
|||||||
# if last_candle['close'] < max_60:
|
# if last_candle['close'] < max_60:
|
||||||
# pct_to_max = 0.25 * (max_60 - last_candle['close']) / max_60
|
# pct_to_max = 0.25 * (max_60 - last_candle['close']) / max_60
|
||||||
# pct_to_max = pct_to_max * (2 - pctClose60)
|
# pct_to_max = pct_to_max * (2 - pctClose60)
|
||||||
expected_profit = max(0.004,
|
expected_profit = min(3 * lim, max(lim, pct_to_max)) # 0.004 + 0.002 * self.pairs[pair]['count_of_buys'] #min(0.01, first_max)
|
||||||
pct_to_max) # 0.004 + 0.002 * self.pairs[pair]['count_of_buys'] #min(0.01, first_max)
|
|
||||||
|
|
||||||
# print(
|
# print(
|
||||||
# f"Expected profit price={current_price:.4f} min_max={min_max:.4f} min_14={min_14_days:.4f} max_14={max_14_days:.4f} percent={percent:.4f} expected_profit={expected_profit:.4f}")
|
# f"Expected profit price={current_price:.4f} min_max={min_max:.4f} min_14={min_14_days:.4f} max_14={max_14_days:.4f} percent={percent:.4f} expected_profit={expected_profit:.4f}")
|
||||||
@@ -2190,44 +2208,43 @@ class Zeus_8_3_2_B_4_2(IStrategy):
|
|||||||
# 🟠 Dérivée 1 < 0 et dérivée 2 > 0: tendance baissière qui ralentit → possible bottom.
|
# 🟠 Dérivée 1 < 0 et dérivée 2 > 0: tendance baissière qui ralentit → possible bottom.
|
||||||
|
|
||||||
# if not pair.startswith('BTC'):
|
# if not pair.startswith('BTC'):
|
||||||
if self.pairs[pair]['stop'] \
|
dispo = round(self.wallets.get_available_stake_amount())
|
||||||
and last_candle['mid_smooth_5_deriv1_1d'] > self.sma5_deriv1_1d_restart_protection.value \
|
|
||||||
and last_candle['mid_smooth_5_deriv2_1d'] > self.sma5_deriv2_1d_restart_protection.value:
|
if self.pairs[pair]['stop'] and last_candle['mid_smooth_5_deriv1_1d'] > -0.9 and last_candle['sma5_deriv1_1h'] > 0:
|
||||||
self.pairs[pair]['stop'] = False
|
self.pairs[pair]['stop'] = False
|
||||||
self.log_trade(
|
self.log_trade(
|
||||||
last_candle=last_candle,
|
last_candle=last_candle,
|
||||||
date=current_time,
|
date=current_time,
|
||||||
action="🟢RESTART",
|
action="🟢RESTART",
|
||||||
dispo=0,
|
dispo=dispo,
|
||||||
pair=pair,
|
pair=pair,
|
||||||
rate=last_candle['close'],
|
rate=last_candle['close'],
|
||||||
trade_type='',
|
trade_type='',
|
||||||
profit=0, # round(current_profit * trade.stake_amount, 2),
|
profit=0,
|
||||||
buys='',
|
buys=self.pairs[pair]['count_of_buys'],
|
||||||
stake=0
|
stake=0
|
||||||
)
|
)
|
||||||
else:
|
else:
|
||||||
if self.pairs[pair]['stop'] == False \
|
if self.pairs[pair]['stop'] == False and last_candle['sma5_deriv1_1h'] < -0.2:
|
||||||
and last_candle['mid_smooth_5_deriv1_1d'] < self.sma5_deriv1_1d_stop_protection.value \
|
|
||||||
and last_candle['mid_smooth_5_deriv2_1d'] < self.sma5_deriv2_1d_stop_protection.value:
|
|
||||||
self.pairs[pair]['stop'] = True
|
self.pairs[pair]['stop'] = True
|
||||||
self.log_trade(
|
self.log_trade(
|
||||||
last_candle=last_candle,
|
last_candle=last_candle,
|
||||||
date=current_time,
|
date=current_time,
|
||||||
action="🔴STOP",
|
action="🔴STOP",
|
||||||
dispo=0,
|
dispo=dispo,
|
||||||
pair=pair,
|
pair=pair,
|
||||||
rate=last_candle['close'],
|
rate=last_candle['close'],
|
||||||
trade_type='',
|
trade_type='',
|
||||||
profit=0, # round(current_profit * trade.stake_amount, 2),
|
profit=0,
|
||||||
buys='',
|
buys=self.pairs[pair]['count_of_buys'],
|
||||||
stake=0
|
stake=0
|
||||||
)
|
)
|
||||||
return False
|
return False
|
||||||
if self.pairs[pair]['stop']:
|
if self.pairs[pair]['stop']:
|
||||||
return False
|
return False
|
||||||
|
|
||||||
if last_candle['sma5_deriv1_1h'] < -0.1:
|
|
||||||
|
if last_candle['sma5_deriv1_1h'] < -0.02:
|
||||||
return False
|
return False
|
||||||
|
|
||||||
if last_candle['mid_smooth_1h_deriv2'] < -2 or last_candle['sma5_deriv2_1h'] < -2:
|
if last_candle['mid_smooth_1h_deriv2'] < -2 or last_candle['sma5_deriv2_1h'] < -2:
|
||||||
|
|||||||
Reference in New Issue
Block a user