Stratégie corrigée Calcul 20240101-20250514 943$ 250.53$ mise moyenne profit
This commit is contained in:
@@ -449,11 +449,6 @@ class Zeus_8_3_2_B_4_2(IStrategy):
|
|||||||
|
|
||||||
def custom_exit(self, pair: str, trade: Trade, current_time, current_rate, current_profit, **kwargs):
|
def custom_exit(self, pair: str, trade: Trade, current_time, current_rate, current_profit, **kwargs):
|
||||||
|
|
||||||
count_of_buys = trade.nr_of_successful_entries
|
|
||||||
|
|
||||||
if current_profit >= 0.011: #self.exit_profit:
|
|
||||||
return 'take_profit_' + str(count_of_buys)
|
|
||||||
|
|
||||||
dataframe, _ = self.dp.get_analyzed_dataframe(pair, self.timeframe)
|
dataframe, _ = self.dp.get_analyzed_dataframe(pair, self.timeframe)
|
||||||
last_candle = dataframe.iloc[-1].squeeze()
|
last_candle = dataframe.iloc[-1].squeeze()
|
||||||
last_candle_1h = dataframe.iloc[-13].squeeze()
|
last_candle_1h = dataframe.iloc[-13].squeeze()
|
||||||
@@ -478,7 +473,7 @@ class Zeus_8_3_2_B_4_2(IStrategy):
|
|||||||
# if (last_candle['tendency'] in ('H++', 'H+')) and (last_candle['rsi'] < 80):
|
# if (last_candle['tendency'] in ('H++', 'H+')) and (last_candle['rsi'] < 80):
|
||||||
# return None
|
# return None
|
||||||
#
|
#
|
||||||
if (last_candle['mid_smooth_1h_deriv1'] < 0 and before_last_candle['mid_smooth_1h_deriv1'] >= 0) and (current_profit > expected_profit):
|
if (last_candle['sma20_deriv1'] < 0 and before_last_candle['sma20_deriv1'] >= 0) and (current_profit > expected_profit):
|
||||||
return 'Drv_' + str(count_of_buys)
|
return 'Drv_' + str(count_of_buys)
|
||||||
|
|
||||||
# if (baisse > mx) & (current_profit > expected_profit):
|
# if (baisse > mx) & (current_profit > expected_profit):
|
||||||
@@ -585,7 +580,7 @@ class Zeus_8_3_2_B_4_2(IStrategy):
|
|||||||
# f"|{round(last_candle['mid_smooth_24_deriv1'],3) or '-':>6}|{round(last_candle['mid_smooth_1h_deriv1'],3) or '-':>6}|{round(last_candle['mid_smooth_deriv1_1d'],3) or '-' :>6}|"
|
# f"|{round(last_candle['mid_smooth_24_deriv1'],3) or '-':>6}|{round(last_candle['mid_smooth_1h_deriv1'],3) or '-':>6}|{round(last_candle['mid_smooth_deriv1_1d'],3) or '-' :>6}|"
|
||||||
# f"{round(last_candle['mid_smooth_24_deriv2'],3) or '-' :>6}|{round(last_candle['mid_smooth_1h_deriv2'],3) or '-':>6}|{round(last_candle['mid_smooth_deriv2_1d'],3) or '-':>6}|"
|
# f"{round(last_candle['mid_smooth_24_deriv2'],3) or '-' :>6}|{round(last_candle['mid_smooth_1h_deriv2'],3) or '-':>6}|{round(last_candle['mid_smooth_deriv2_1d'],3) or '-':>6}|"
|
||||||
# f"{round(val144, 1) or '-' :>6}|{round(val1h, 1) or '-':>6}|"
|
# f"{round(val144, 1) or '-' :>6}|{round(val1h, 1) or '-':>6}|"
|
||||||
f"{round(last_candle['sma24_deriv1_1h'], 4) or '-' :>6}|{round(last_candle['sma5_deriv1_1d'], 4) or '-' :>6}"
|
f"{round(last_candle['sma20_deriv1'], 4) or '-' :>6}|{round(last_candle['sma5_deriv1_1d'], 4) or '-' :>6}"
|
||||||
)
|
)
|
||||||
|
|
||||||
def printLineLog(self):
|
def printLineLog(self):
|
||||||
@@ -1024,70 +1019,70 @@ class Zeus_8_3_2_B_4_2(IStrategy):
|
|||||||
# print(f"skip pair {pair}")
|
# print(f"skip pair {pair}")
|
||||||
return None
|
return None
|
||||||
|
|
||||||
# déclenche un achat si bougie rouge importante
|
# # déclenche un achat si bougie rouge importante
|
||||||
stake_amount = self.config.get('stake_amount', 100)
|
# stake_amount = self.config.get('stake_amount', 100)
|
||||||
stake_amount = min(stake_amount, self.wallets.get_available_stake_amount())
|
# stake_amount = min(stake_amount, self.wallets.get_available_stake_amount())
|
||||||
current_time = current_time.astimezone(timezone.utc)
|
# current_time = current_time.astimezone(timezone.utc)
|
||||||
seconds_since_filled = (current_time - trade.date_last_filled_utc).total_seconds()
|
# seconds_since_filled = (current_time - trade.date_last_filled_utc).total_seconds()
|
||||||
pct = (last_candle['close'] - last_candle['open']) / (last_candle['open']) * 100
|
# pct = (last_candle['close'] - last_candle['open']) / (last_candle['open']) * 100
|
||||||
if (
|
# if (
|
||||||
stake_amount
|
# stake_amount
|
||||||
and pct <= - 1.10 #self.red_candle_pct
|
# and pct <= - 1.10 #self.red_candle_pct
|
||||||
and min_stake < stake_amount < max_stake
|
# and min_stake < stake_amount < max_stake
|
||||||
and seconds_since_filled > (60 * 5)
|
# and seconds_since_filled > (60 * 5)
|
||||||
|
# # and (last_candle["sma24_deriv1_1h"] > - 0.02)
|
||||||
|
# # and seconds_since_filled > (1 * 3600)
|
||||||
|
# # and count_of_entries < 10
|
||||||
|
# ):
|
||||||
|
# trade_type = last_candle['enter_tag'] if last_candle['enter_long'] == 1 else 'pct48'
|
||||||
|
# self.log_trade(
|
||||||
|
# last_candle=last_candle,
|
||||||
|
# date=current_time,
|
||||||
|
# action="Adjust 1",
|
||||||
|
# dispo=dispo,
|
||||||
|
# pair=trade.pair,
|
||||||
|
# rate=current_rate,
|
||||||
|
# trade_type=trade_type,
|
||||||
|
# profit=round(current_profit, 4), # round(current_profit * trade.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]['max_touch'] = last_candle['close']
|
||||||
|
# self.pairs[trade.pair]['last_candle'] = last_candle
|
||||||
|
# return stake_amount
|
||||||
|
#
|
||||||
|
# # déclenche un achat en conditions d'achat standard
|
||||||
|
# if (
|
||||||
|
# stake_amount
|
||||||
|
# and last_candle['close'] < last_candle['sma20']
|
||||||
|
# and last_candle['close'] < last_candle['open']
|
||||||
|
# and min_stake < stake_amount < max_stake
|
||||||
# and (last_candle["sma24_deriv1_1h"] > - 0.02)
|
# and (last_candle["sma24_deriv1_1h"] > - 0.02)
|
||||||
# and seconds_since_filled > (1 * 3600)
|
# and seconds_since_filled > 23 * 3600 #self.staking_delay * 3600
|
||||||
# and count_of_entries < 10
|
# ):
|
||||||
):
|
# stake_amount = stake_amount * seconds_since_filled / (23 * 3600)
|
||||||
trade_type = last_candle['enter_tag'] if last_candle['enter_long'] == 1 else 'pct48'
|
# trade_type = last_candle['enter_tag'] if last_candle['enter_long'] == 1 else 'pct48'
|
||||||
self.log_trade(
|
# self.log_trade(
|
||||||
last_candle=last_candle,
|
# last_candle=last_candle,
|
||||||
date=current_time,
|
# date=current_time,
|
||||||
action="Adjust 1",
|
# action="Adjust 2",
|
||||||
dispo=dispo,
|
# dispo=dispo,
|
||||||
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, 2),
|
||||||
buys=trade.nr_of_successful_entries + 1,
|
# buys=trade.nr_of_successful_entries + 1,
|
||||||
stake=round(stake_amount, 2)
|
# 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
|
||||||
return stake_amount
|
# return stake_amount
|
||||||
|
#
|
||||||
# déclenche un achat en conditions d'achat standard
|
# return None
|
||||||
if (
|
|
||||||
stake_amount
|
|
||||||
and last_candle['close'] < last_candle['sma20']
|
|
||||||
and last_candle['close'] < last_candle['open']
|
|
||||||
and min_stake < stake_amount < max_stake
|
|
||||||
and (last_candle["sma24_deriv1_1h"] > - 0.02)
|
|
||||||
and seconds_since_filled > 23 * 3600 #self.staking_delay * 3600
|
|
||||||
):
|
|
||||||
stake_amount = stake_amount * seconds_since_filled / (23 * 3600)
|
|
||||||
trade_type = last_candle['enter_tag'] if last_candle['enter_long'] == 1 else 'pct48'
|
|
||||||
self.log_trade(
|
|
||||||
last_candle=last_candle,
|
|
||||||
date=current_time,
|
|
||||||
action="Adjust 2",
|
|
||||||
dispo=dispo,
|
|
||||||
pair=trade.pair,
|
|
||||||
rate=current_rate,
|
|
||||||
trade_type=trade_type,
|
|
||||||
profit=round(current_profit, 4), # round(current_profit * trade.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]['max_touch'] = last_candle['close']
|
|
||||||
self.pairs[trade.pair]['last_candle'] = last_candle
|
|
||||||
return stake_amount
|
|
||||||
|
|
||||||
return None
|
|
||||||
|
|
||||||
count_of_buys = trade.nr_of_successful_entries
|
count_of_buys = trade.nr_of_successful_entries
|
||||||
current_time_utc = current_time.astimezone(timezone.utc)
|
current_time_utc = current_time.astimezone(timezone.utc)
|
||||||
@@ -1105,12 +1100,13 @@ class Zeus_8_3_2_B_4_2(IStrategy):
|
|||||||
pct_max = round((last_candle['close'] - self.pairs[trade.pair]['last_buy']) / self.pairs[trade.pair]['last_buy'], 4)
|
pct_max = round((last_candle['close'] - self.pairs[trade.pair]['last_buy']) / self.pairs[trade.pair]['last_buy'], 4)
|
||||||
else:
|
else:
|
||||||
pct_max = - pct
|
pct_max = - pct
|
||||||
|
lim = - pct - (count_of_buys * 0.001)
|
||||||
|
|
||||||
index = self.get_palier_index(pct_first)
|
# index = self.get_palier_index(pct_first)
|
||||||
if index is None:
|
# if index is None:
|
||||||
return None
|
# return None
|
||||||
|
# index = index -1
|
||||||
lim, stake_amount = self.paliers[index] #- pct - (count_of_buys * 0.001)
|
# lim, stake_amount = self.paliers[index] #- pct - (count_of_buys * 0.001)
|
||||||
|
|
||||||
# self.get_active_stake()
|
# self.get_active_stake()
|
||||||
# val144 = self.getProbaHausse144(last_candle)
|
# val144 = self.getProbaHausse144(last_candle)
|
||||||
@@ -1133,17 +1129,15 @@ class Zeus_8_3_2_B_4_2(IStrategy):
|
|||||||
limit_buy = 20
|
limit_buy = 20
|
||||||
if (count_of_buys < limit_buy) \
|
if (count_of_buys < limit_buy) \
|
||||||
and (last_candle['enter_long'] == 1) \
|
and (last_candle['enter_long'] == 1) \
|
||||||
and (last_candle["sma24_deriv1_1h"] > - 0.02) \
|
and (pct_max < lim): # and val > self.buy_val_adjust.value and last_candle['mid_smooth_deriv1_1d'] > - 1):
|
||||||
and (last_candle["sma5_deriv1_1d"] > - 0.02 or count_of_buys <= 5)\
|
|
||||||
and (self.pairs[trade.pair]['last_palier_index'] < index): # and val > self.buy_val_adjust.value and last_candle['mid_smooth_deriv1_1d'] > - 1):
|
|
||||||
try:
|
try:
|
||||||
print(f"{trade.pair} current_profit={current_profit} count_of_buys={count_of_buys} pct_first={pct_first:.3f} pct_max={pct_max:.3f} lim={lim:.3f} index={index}")
|
# print(f"{trade.pair} current_profit={current_profit} count_of_buys={count_of_buys} pct_first={pct_first:.3f} pct_max={pct_max:.3f} lim={lim:.3f} index={index}")
|
||||||
self.pairs[trade.pair]['last_palier_index'] = index
|
# self.pairs[trade.pair]['last_palier_index'] = index
|
||||||
|
|
||||||
max_amount = self.config.get('stake_amount', 100) * 2.5
|
max_amount = self.config.get('stake_amount', 100) * 2.5
|
||||||
stake_amount = min(stake_amount, self.wallets.get_available_stake_amount())
|
# stake_amount = min(stake_amount, self.wallets.get_available_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 / pct) # min(200, self.adjust_stake_amount(pair, last_candle) * self.fibo[count_of_buys])
|
self.adjust_stake_amount(pair, last_candle) - 10 * pct_first / pct) # 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'
|
trade_type = last_candle['enter_tag'] if last_candle['enter_long'] == 1 else 'pct48'
|
||||||
self.log_trade(
|
self.log_trade(
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user