Skip to content

Commit

Permalink
X4: rebuy mode: fine tune the buy conditions.
Browse files Browse the repository at this point in the history
  • Loading branch information
iterativv committed Feb 13, 2024
1 parent bbc286d commit ab6005d
Showing 1 changed file with 27 additions and 3 deletions.
30 changes: 27 additions & 3 deletions NostalgiaForInfinityX4.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ class NostalgiaForInfinityX4(IStrategy):
INTERFACE_VERSION = 3

def version(self) -> str:
return "v14.1.146"
return "v14.1.147"

stoploss = -0.99

Expand Down Expand Up @@ -8100,6 +8100,8 @@ def long_grind_adjust_trade_position(
current_exit_rate,
current_entry_profit,
current_exit_profit,
last_candle,
previous_candle,
filled_orders,
filled_entries,
filled_exits,
Expand Down Expand Up @@ -8450,6 +8452,8 @@ def long_adjust_trade_position_no_derisk(
current_exit_rate: float,
current_entry_profit: float,
current_exit_profit: float,
last_candle: Series,
previous_candle: Series,
filled_orders: "Orders",
filled_entries: "Orders",
filled_exits: "Orders",
Expand Down Expand Up @@ -8489,8 +8493,28 @@ def long_adjust_trade_position_no_derisk(
current_grind_stake_profit = current_grind_stake - total_cost

if (not partial_sell) and (sub_grind_count < max_sub_grinds):
if (0 <= sub_grind_count < max_sub_grinds) and (
slice_profit_entry < regular_mode_sub_thresholds[sub_grind_count]
if (
(0 <= sub_grind_count < max_sub_grinds)
and (slice_profit_entry < regular_mode_sub_thresholds[sub_grind_count])
and (
(last_candle["protections_long_rebuy"] == True)
and (last_candle["global_protections_long_pump"] == True)
and (last_candle["global_protections_long_dump"] == True)
)
and (
(last_candle["close"] > (last_candle["close_max_12"] * 0.88))
and (last_candle["close"] > (last_candle["close_max_24"] * 0.82))
and (last_candle["close"] > (last_candle["close_max_48"] * 0.76))
and (last_candle["btc_pct_close_max_72_5m"] < 0.03)
and (last_candle["btc_pct_close_max_24_5m"] < 0.03)
)
and (
(last_candle["rsi_3"] > 10.0)
and (last_candle["rsi_3_15m"] > 10.0)
and (last_candle["rsi_3_1h"] > 10.0)
and (last_candle["rsi_3_4h"] > 10.0)
and (last_candle["rsi_14"] < 50.0)
)
):
buy_amount = (
slice_amount * regular_mode_stakes[sub_grind_count] / (trade.leverage if self.is_futures_mode else 1.0)
Expand Down

0 comments on commit ab6005d

Please sign in to comment.