]> Piment Noir Git Repositories - freqai-strategies.git/commitdiff
perf(qav3): tune reversal confirmation logic
authorJérôme Benoit <jerome.benoit@piment-noir.org>
Sun, 5 Oct 2025 15:26:08 +0000 (17:26 +0200)
committerJérôme Benoit <jerome.benoit@piment-noir.org>
Sun, 5 Oct 2025 15:26:08 +0000 (17:26 +0200)
Signed-off-by: Jérôme Benoit <jerome.benoit@piment-noir.org>
ReforceXY/reward_space_analysis/reward_space_analysis.py
quickadapter/user_data/freqaimodels/QuickAdapterRegressorV3.py
quickadapter/user_data/strategies/QuickAdapterV3.py

index d3d21e7f218d261371e8a2243c22fcd6e172d2b2..9e5849dad74ad58b9c50c3f873e47123e5d3ca8e 100644 (file)
@@ -102,7 +102,7 @@ DEFAULT_MODEL_REWARD_PARAMETERS: Dict[str, float | str] = {
     # Efficiency keys (env defaults)
     "efficiency_weight": 0.75,
     "efficiency_center": 0.75,
-    # Profit factor params (env-compatible)
+    # Profit factor params (env defaults)
     "win_reward_factor": 2.0,
     "pnl_factor_beta": 0.5,
 }
index a465b87ed7e1b60814285ca266cdb7a1f91a78b6..1ca6ee0563bc25b8f180ae87695a10cb5e8cc458 100644 (file)
@@ -450,6 +450,12 @@ class QuickAdapterRegressorV3(BaseRegressionModel):
                         ),
                         fit_live_predictions_candles,
                         self._optuna_config.get("label_candles_step"),
+                        min_label_natr_ratio=self.ft_params.get(
+                            "min_label_natr_ratio", 9.0
+                        ),
+                        max_label_natr_ratio=self.ft_params.get(
+                            "max_label_natr_ratio", 12.0
+                        ),
                     ),
                     directions=[
                         optuna.study.StudyDirection.MAXIMIZE,
@@ -1759,6 +1765,8 @@ def label_objective(
     df: pd.DataFrame,
     fit_live_predictions_candles: int,
     candles_step: int,
+    min_label_natr_ratio: float = 9.0,
+    max_label_natr_ratio: float = 12.0,
 ) -> tuple[float, int]:
     min_label_period_candles, max_label_period_candles, candles_step = (
         get_min_max_label_period_candles(fit_live_predictions_candles, candles_step)
@@ -1770,7 +1778,9 @@ def label_objective(
         max_label_period_candles,
         step=candles_step,
     )
-    label_natr_ratio = trial.suggest_float("label_natr_ratio", 9.0, 12.0, step=0.05)
+    label_natr_ratio = trial.suggest_float(
+        "label_natr_ratio", min_label_natr_ratio, max_label_natr_ratio, step=0.05
+    )
 
     label_period_cycles = fit_live_predictions_candles / label_period_candles
     df = df.iloc[-(max(2, int(label_period_cycles)) * label_period_candles) :]
index 9bec78f97c1df68e6429209689d37d21f360765d..73bd834688f0b462d26e8602ea7ba34c70a08cb3 100644 (file)
@@ -1149,8 +1149,8 @@ class QuickAdapterV3(IStrategy):
         side: str,
         order: Literal["entry", "exit"],
         rate: float,
-        min_natr_ratio_percent: float = 0.0095,
-        max_natr_ratio_percent: float = 0.025,
+        min_natr_ratio_percent: float = 0.009,
+        max_natr_ratio_percent: float = 0.03,
         lookback_period: int = 1,
         decay_ratio: float = 0.5,
     ) -> bool: