]> Piment Noir Git Repositories - freqai-strategies.git/commitdiff
perf(qav3): fine tune trade entry confirmation
authorJérôme Benoit <jerome.benoit@piment-noir.org>
Sun, 13 Apr 2025 17:43:41 +0000 (19:43 +0200)
committerJérôme Benoit <jerome.benoit@piment-noir.org>
Sun, 13 Apr 2025 17:43:41 +0000 (19:43 +0200)
Signed-off-by: Jérôme Benoit <jerome.benoit@piment-noir.org>
quickadapter/user_data/strategies/QuickAdapterV3.py

index 793ddeacdbe2166de18861cfd84d23b91698a658..9000416f1391c9efde809057661faef916966666 100644 (file)
@@ -58,7 +58,7 @@ class QuickAdapterV3(IStrategy):
     INTERFACE_VERSION = 3
 
     def version(self) -> str:
-        return "3.3.5"
+        return "3.3.6"
 
     timeframe = "5m"
 
@@ -71,10 +71,6 @@ class QuickAdapterV3(IStrategy):
     trailing_stop_positive_offset = 0.011
     trailing_only_offset_is_reached = True
 
-    @cached_property
-    def entry_natr_ratio(self) -> float:
-        return self.config.get("entry_pricing", {}).get("entry_natr_ratio", 0.00025)
-
     # reward_risk_ratio = reward / risk
     # reward_risk_ratio = 1.0 means 1:1 RR
     # reward_risk_ratio = 2.0 means 1:2 RR
@@ -382,6 +378,9 @@ class QuickAdapterV3(IStrategy):
     def get_trailing_stoploss_natr_ratio(self, pair: str) -> float:
         return self.get_label_natr_ratio(pair) * 0.25
 
+    def get_entry_natr_ratio(self, pair: str) -> float:
+        return self.get_label_natr_ratio(pair) * 0.025
+
     def set_freqai_targets(self, dataframe: DataFrame, metadata: dict, **kwargs):
         pair = str(metadata.get("pair"))
         peak_indices, _, peak_directions = dynamic_zigzag(
@@ -653,7 +652,9 @@ class QuickAdapterV3(IStrategy):
         last_candle_natr = last_candle["natr_label_period_candles"]
         if isna(last_candle_natr):
             return False
-        entry_price_fluctuation_threshold = last_candle_natr * self.entry_natr_ratio
+        entry_price_fluctuation_threshold = (
+            last_candle_natr * self.get_entry_natr_ratio(pair)
+        )
         if (
             side == "long"
             and rate > last_candle_close * (1 + entry_price_fluctuation_threshold)