Skip to content

Commit

Permalink
X5: add config options if enable the stops.
Browse files Browse the repository at this point in the history
  • Loading branch information
iterativv committed Jan 30, 2025
1 parent 79f8ac7 commit 76e6167
Showing 1 changed file with 24 additions and 11 deletions.
35 changes: 24 additions & 11 deletions NostalgiaForInfinityX5.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ class NostalgiaForInfinityX5(IStrategy):
INTERFACE_VERSION = 3

def version(self) -> str:
return "v15.1.355"
return "v15.1.356"

stoploss = -0.99

Expand Down Expand Up @@ -202,6 +202,7 @@ def version(self) -> str:
# Grinding feature
grinding_enable = True
derisk_enable = True
stops_enable = True

# Grinding
derisk_use_grind_stops = False
Expand Down Expand Up @@ -599,6 +600,8 @@ def __init__(self, config: dict) -> None:

if "derisk_enable" in self.config:
self.derisk_enable = self.config["derisk_enable"]
if "stops_enable" in self.config:
self.stops_enable = self.config["stops_enable"]

if "regular_mode_derisk_1_spot" in self.config:
self.regular_mode_derisk_1_spot = self.config["regular_mode_derisk_1_spot"]
Expand Down Expand Up @@ -16189,11 +16192,14 @@ def long_exit_rapid(
# Stoplosses
if (
(
profit_stake
< -(
filled_entries[0].cost
* (self.stop_threshold_rapid_futures if self.is_futures_mode else self.stop_threshold_rapid_spot)
/ trade.leverage
self.stops_enable
and (
profit_stake
< -(
filled_entries[0].cost
* (self.stop_threshold_rapid_futures if self.is_futures_mode else self.stop_threshold_rapid_spot)
/ trade.leverage
)
)
)
# temporary
Expand Down Expand Up @@ -30558,6 +30564,8 @@ def long_exit_stoploss(
buy_tag,
) -> tuple:
is_backtest = self.is_backtest_mode()
if not self.stops_enable:
return False, None
# Stoploss doom
if (
(
Expand Down Expand Up @@ -35292,11 +35300,14 @@ def short_exit_rapid(
# Stoplosses
if (
(
profit_stake
< -(
filled_entries[0].cost
* (self.stop_threshold_rapid_futures if self.is_futures_mode else self.stop_threshold_rapid_spot)
/ trade.leverage
self.stops_enable
and (
profit_stake
< -(
filled_entries[0].cost
* (self.stop_threshold_rapid_futures if self.is_futures_mode else self.stop_threshold_rapid_spot)
/ trade.leverage
)
)
)
# temporary
Expand Down Expand Up @@ -49661,6 +49672,8 @@ def short_exit_stoploss(
buy_tag,
) -> tuple:
is_backtest = self.is_backtest_mode()
if not self.stops_enable:
return False, None
# Stoploss doom
if (
(
Expand Down

0 comments on commit 76e6167

Please sign in to comment.