]> Piment Noir Git Repositories - freqai-strategies.git/commitdiff
perf(qav3)!: add amplitude zigzag threshold excess to reservals labeling HPO objectives
authorJérôme Benoit <jerome.benoit@piment-noir.org>
Sat, 22 Nov 2025 11:38:29 +0000 (12:38 +0100)
committerJérôme Benoit <jerome.benoit@piment-noir.org>
Sat, 22 Nov 2025 11:38:29 +0000 (12:38 +0100)
Signed-off-by: Jérôme Benoit <jerome.benoit@piment-noir.org>
.opencode/command/openspec-proposal.md
README.md
quickadapter/user_data/config-template.json
quickadapter/user_data/freqaimodels/QuickAdapterRegressorV3.py

index 096770ee9055e81ded82e69638aa8f80dbd89990..9282a4fd20e5d606471f2e27c9aef5d5ba7425ae 100644 (file)
@@ -16,6 +16,7 @@ $ARGUMENTS
 - Keep changes tightly scoped to the requested outcome.
 - Refer to `openspec/AGENTS.md` (located inside the `openspec/` directory—run `ls openspec` or `openspec update` if you don't see it) if you need additional OpenSpec conventions or clarifications.
 - Identify any vague or ambiguous details and ask the necessary follow-up questions before editing files.
+- Do not write any code during the proposal stage. Only create design documents (proposal.md, tasks.md, design.md, and spec deltas). Implementation happens in the apply stage after approval.
 
 **Steps**
 
index e3fbeb45bfd6037c453490a6a3a464fc2d52007d..3d2c959009e14960283df911c1b5aa17514c3cf7 100644 (file)
--- a/README.md
+++ b/README.md
@@ -35,75 +35,75 @@ docker compose up -d --build
 
 ### Configuration tunables
 
-| Path                                                 | Default           | Type / Range                                                                                                                     | Description                                                                                                                                                                                                      |
-| ---------------------------------------------------- | ----------------- | -------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
-| _Protections_                                        |                   |                                                                                                                                  |                                                                                                                                                                                                                  |
-| estimated_trade_duration_candles                     | 48                | int >= 1                                                                                                                         | Heuristic for StoplossGuard tuning.                                                                                                                                                                              |
-| _Leverage_                                           |                   |                                                                                                                                  |                                                                                                                                                                                                                  |
-| leverage                                             | proposed_leverage | float [1.0, max_leverage]                                                                                                        | Leverage. Fallback to proposed_leverage for the pair.                                                                                                                                                            |
-| _Exit pricing_                                       |                   |                                                                                                                                  |                                                                                                                                                                                                                  |
-| exit_pricing.trade_price_target                      | `moving_average`  | enum {`moving_average`,`interpolation`,`weighted_interpolation`}                                                                 | Trade NATR computation method.                                                                                                                                                                                   |
-| exit_pricing.thresholds_calibration.decline_quantile | 0.90              | float (0,1)                                                                                                                      | PnL decline quantile threshold.                                                                                                                                                                                  |
-| _Reversal confirmation_                              |                   |                                                                                                                                  |                                                                                                                                                                                                                  |
-| reversal_confirmation.lookback_period                | 0                 | int >= 0                                                                                                                         | Prior confirming candles; 0 = none.                                                                                                                                                                              |
-| reversal_confirmation.decay_ratio                    | 0.5               | float (0,1]                                                                                                                      | Geometric per-candle relaxation factor.                                                                                                                                                                          |
-| reversal_confirmation.min_natr_ratio_percent         | 0.0095            | float [0,1]                                                                                                                      | Lower bound fraction for volatility adjusted reversal threshold.                                                                                                                                                 |
-| reversal_confirmation.max_natr_ratio_percent         | 0.2               | float [0,1]                                                                                                                      | Upper bound fraction (>= lower bound) for volatility adjusted reversal threshold.                                                                                                                                |
-| _Regressor model_                                    |                   |                                                                                                                                  |                                                                                                                                                                                                                  |
-| freqai.regressor                                     | `xgboost`         | enum {`xgboost`,`lightgbm`}                                                                                                      | Machine learning regressor algorithm.                                                                                                                                                                            |
-| _Extrema smoothing_                                  |                   |                                                                                                                                  |                                                                                                                                                                                                                  |
-| freqai.extrema_smoothing.method                      | `gaussian`        | enum {`gaussian`,`kaiser`,`triang`,`smm`,`sma`}                                                                                  | Extrema smoothing kernel (smm=simple moving median, sma=simple moving average).                                                                                                                                  |
-| freqai.extrema_smoothing.window                      | 5                 | int >= 3                                                                                                                         | Window size for extrema smoothing.                                                                                                                                                                               |
-| freqai.extrema_smoothing.beta                        | 8.0               | float > 0                                                                                                                        | Kaiser kernel shape parameter.                                                                                                                                                                                   |
-| _Extrema weighting_                                  |                   |                                                                                                                                  |                                                                                                                                                                                                                  |
-| freqai.extrema_weighting.strategy                    | `none`            | enum {`none`,`amplitude`,`amplitude_excess`}                                                                                     | Extrema weighting source: unweighted (`none`), swing amplitude (`amplitude`), or volatility-adjusted swing amplitude (`amplitude_excess`).                                                                       |
-| freqai.extrema_weighting.normalization               | `minmax`          | enum {`minmax`,`zscore`,`l1`,`l2`,`robust`,`softmax`,`tanh`,`rank`,`none`}                                                       | Normalization method for weights.                                                                                                                                                                                |
-| freqai.extrema_weighting.gamma                       | 1.0               | float (0,10]                                                                                                                     | Contrast exponent applied after normalization (>1 emphasizes extremes, 0<gamma<1 softens).                                                                                                                       |
-| freqai.extrema_weighting.softmax_temperature         | 1.0               | float > 0                                                                                                                        | Temperature parameter for softmax normalization (lower values sharpen distribution, higher values flatten it).                                                                                                   |
-| freqai.extrema_weighting.tanh_scale                  | 1.0               | float > 0                                                                                                                        | Scale parameter for tanh normalization.                                                                                                                                                                          |
-| freqai.extrema_weighting.tanh_gain                   | 1.0               | float > 0                                                                                                                        | Gain parameter for tanh normalization.                                                                                                                                                                           |
-| freqai.extrema_weighting.robust_quantiles            | [0.25, 0.75]      | list[float] where 0 <= q_low < q_high <= 1                                                                                       | Quantile range for robust normalization.                                                                                                                                                                         |
-| freqai.extrema_weighting.rank_method                 | `average`         | enum {`average`,`min`,`max`,`dense`,`ordinal`}                                                                                   | Ranking method for rank normalization.                                                                                                                                                                           |
-| _Feature parameters_                                 |                   |                                                                                                                                  |                                                                                                                                                                                                                  |
-| freqai.feature_parameters.label_period_candles       | min/max midpoint  | int >= 1                                                                                                                         | Zigzag labeling NATR horizon.                                                                                                                                                                                    |
-| freqai.feature_parameters.min_label_period_candles   | 12                | int >= 1                                                                                                                         | Minimum labeling NATR horizon used for reversals labeling HPO.                                                                                                                                                   |
-| freqai.feature_parameters.max_label_period_candles   | 24                | int >= 1                                                                                                                         | Maximum labeling NATR horizon used for reversals labeling HPO.                                                                                                                                                   |
-| freqai.feature_parameters.label_natr_ratio           | min/max midpoint  | float > 0                                                                                                                        | Zigzag labeling NATR ratio.                                                                                                                                                                                      |
-| freqai.feature_parameters.min_label_natr_ratio       | 9.0               | float > 0                                                                                                                        | Minimum labeling NATR ratio used for reversals labeling HPO.                                                                                                                                                     |
-| freqai.feature_parameters.max_label_natr_ratio       | 12.0              | float > 0                                                                                                                        | Maximum labeling NATR ratio used for reversals labeling HPO.                                                                                                                                                     |
-| freqai.feature_parameters.label_frequency_candles    | `auto`            | int >= 2 \| `auto`                                                                                                               | Reversals labeling frequency. `auto` = max(2, 2 \* number of whitelisted pairs).                                                                                                                                 |
-| freqai.feature_parameters.label_metric               | `euclidean`       | string (supported: `euclidean`,`minkowski`,`cityblock`,`chebyshev`,`mahalanobis`,`seuclidean`,`jensenshannon`,`sqeuclidean`,...) | Metric used in distance calculations to ideal point.                                                                                                                                                             |
-| freqai.feature_parameters.label_weights              | [0.5,0.5]         | list[float]                                                                                                                      | Per-objective weights used in distance calculations to ideal point. First objective is the median swing amplitude of Zigzag reversals (reversals quality). Second objective is the number of detected reversals. |
-| freqai.feature_parameters.label_p_order              | `None`            | float                                                                                                                            | p-order used by Minkowski / power-mean calculations (optional).                                                                                                                                                  |
-| freqai.feature_parameters.label_medoid_metric        | `euclidean`       | string                                                                                                                           | Metric used with `medoid`.                                                                                                                                                                                       |
-| freqai.feature_parameters.label_kmeans_metric        | `euclidean`       | string                                                                                                                           | Metric used for k-means clustering.                                                                                                                                                                              |
-| freqai.feature_parameters.label_kmeans_selection     | `min`             | enum {`min`,`medoid`}                                                                                                            | Strategy to select trial in the best kmeans cluster.                                                                                                                                                             |
-| freqai.feature_parameters.label_kmedoids_metric      | `euclidean`       | string                                                                                                                           | Metric used for k-medoids clustering.                                                                                                                                                                            |
-| freqai.feature_parameters.label_kmedoids_selection   | `min`             | enum {`min`,`medoid`}                                                                                                            | Strategy to select trial in the best k-medoids cluster.                                                                                                                                                          |
-| freqai.feature_parameters.label_knn_metric           | `minkowski`       | string                                                                                                                           | Distance metric for KNN.                                                                                                                                                                                         |
-| freqai.feature_parameters.label_knn_p_order          | `None`            | float                                                                                                                            | p-order for KNN Minkowski metric distance. (optional)                                                                                                                                                            |
-| freqai.feature_parameters.label_knn_n_neighbors      | 5                 | int >= 1                                                                                                                         | Number of neighbors for KNN.                                                                                                                                                                                     |
-| _Predictions extrema_                                |                   |                                                                                                                                  |                                                                                                                                                                                                                  |
-| freqai.predictions_extrema.selection_method          | `rank`            | enum {`rank`,`values`,`partition`}                                                                                               | Extrema selection method. `values` uses reversal values, `rank` uses ranked extrema values, `partition` uses sign-based partitioning.                                                                            |
-| freqai.predictions_extrema.thresholds_smoothing      | `mean`            | enum {`mean`,`isodata`,`li`,`minimum`,`otsu`,`triangle`,`yen`,`median`,`soft_extremum`}                                          | Thresholding method for prediction thresholds smoothing.                                                                                                                                                         |
-| freqai.predictions_extrema.thresholds_alpha          | 12.0              | float > 0                                                                                                                        | Alpha for `soft_extremum`.                                                                                                                                                                                       |
-| freqai.predictions_extrema.threshold_outlier         | 0.999             | float (0,1)                                                                                                                      | Quantile threshold for predictions outlier filtering.                                                                                                                                                            |
-| _Optuna / HPO_                                       |                   |                                                                                                                                  |                                                                                                                                                                                                                  |
-| freqai.optuna_hyperopt.enabled                       | true              | bool                                                                                                                             | Enables HPO.                                                                                                                                                                                                     |
-| freqai.optuna_hyperopt.sampler                       | `tpe`             | enum {`tpe`,`auto`}                                                                                                              | HPO sampler algorithm. `tpe` uses TPESampler with multivariate and group, `auto` uses AutoSampler.                                                                                                               |
-| freqai.optuna_hyperopt.storage                       | `file`            | enum {`file`,`sqlite`}                                                                                                           | HPO storage backend.                                                                                                                                                                                             |
-| freqai.optuna_hyperopt.continuous                    | true              | bool                                                                                                                             | Continuous HPO.                                                                                                                                                                                                  |
-| freqai.optuna_hyperopt.warm_start                    | true              | bool                                                                                                                             | Warm start HPO with previous best value(s).                                                                                                                                                                      |
-| freqai.optuna_hyperopt.n_startup_trials              | 15                | int >= 0                                                                                                                         | HPO startup trials.                                                                                                                                                                                              |
-| freqai.optuna_hyperopt.n_trials                      | 50                | int >= 1                                                                                                                         | Maximum HPO trials.                                                                                                                                                                                              |
-| freqai.optuna_hyperopt.n_jobs                        | CPU threads / 4   | int >= 1                                                                                                                         | Parallel HPO workers.                                                                                                                                                                                            |
-| freqai.optuna_hyperopt.timeout                       | 7200              | int >= 0                                                                                                                         | HPO wall-clock timeout in seconds.                                                                                                                                                                               |
-| freqai.optuna_hyperopt.label_candles_step            | 1                 | int >= 1                                                                                                                         | Step for Zigzag NATR horizon search space.                                                                                                                                                                       |
-| freqai.optuna_hyperopt.train_candles_step            | 10                | int >= 1                                                                                                                         | Step for training sets size search space.                                                                                                                                                                        |
-| freqai.optuna_hyperopt.space_reduction               | false             | bool                                                                                                                             | Enable/disable HPO search space reduction based on previous best parameters.                                                                                                                                     |
-| freqai.optuna_hyperopt.expansion_ratio               | 0.4               | float [0,1]                                                                                                                      | HPO search space expansion ratio.                                                                                                                                                                                |
-| freqai.optuna_hyperopt.min_resource                  | 3                 | int >= 1                                                                                                                         | Minimum resource per Hyperband pruner rung.                                                                                                                                                                      |
-| freqai.optuna_hyperopt.seed                          | 1                 | int >= 0                                                                                                                         | HPO RNG seed.                                                                                                                                                                                                    |
+| Path                                                 | Default           | Type / Range                                                                                                                     | Description                                                                                                                                                                                                                                                                                            |
+| ---------------------------------------------------- | ----------------- | -------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
+| _Protections_                                        |                   |                                                                                                                                  |                                                                                                                                                                                                                                                                                                        |
+| estimated_trade_duration_candles                     | 48                | int >= 1                                                                                                                         | Heuristic for StoplossGuard tuning.                                                                                                                                                                                                                                                                    |
+| _Leverage_                                           |                   |                                                                                                                                  |                                                                                                                                                                                                                                                                                                        |
+| leverage                                             | proposed_leverage | float [1.0, max_leverage]                                                                                                        | Leverage. Fallback to proposed_leverage for the pair.                                                                                                                                                                                                                                                  |
+| _Exit pricing_                                       |                   |                                                                                                                                  |                                                                                                                                                                                                                                                                                                        |
+| exit_pricing.trade_price_target                      | `moving_average`  | enum {`moving_average`,`interpolation`,`weighted_interpolation`}                                                                 | Trade NATR computation method.                                                                                                                                                                                                                                                                         |
+| exit_pricing.thresholds_calibration.decline_quantile | 0.90              | float (0,1)                                                                                                                      | PnL decline quantile threshold.                                                                                                                                                                                                                                                                        |
+| _Reversal confirmation_                              |                   |                                                                                                                                  |                                                                                                                                                                                                                                                                                                        |
+| reversal_confirmation.lookback_period                | 0                 | int >= 0                                                                                                                         | Prior confirming candles; 0 = none.                                                                                                                                                                                                                                                                    |
+| reversal_confirmation.decay_ratio                    | 0.5               | float (0,1]                                                                                                                      | Geometric per-candle relaxation factor.                                                                                                                                                                                                                                                                |
+| reversal_confirmation.min_natr_ratio_percent         | 0.0095            | float [0,1]                                                                                                                      | Lower bound fraction for volatility adjusted reversal threshold.                                                                                                                                                                                                                                       |
+| reversal_confirmation.max_natr_ratio_percent         | 0.2               | float [0,1]                                                                                                                      | Upper bound fraction (>= lower bound) for volatility adjusted reversal threshold.                                                                                                                                                                                                                      |
+| _Regressor model_                                    |                   |                                                                                                                                  |                                                                                                                                                                                                                                                                                                        |
+| freqai.regressor                                     | `xgboost`         | enum {`xgboost`,`lightgbm`}                                                                                                      | Machine learning regressor algorithm.                                                                                                                                                                                                                                                                  |
+| _Extrema smoothing_                                  |                   |                                                                                                                                  |                                                                                                                                                                                                                                                                                                        |
+| freqai.extrema_smoothing.method                      | `gaussian`        | enum {`gaussian`,`kaiser`,`triang`,`smm`,`sma`}                                                                                  | Extrema smoothing kernel (smm=simple moving median, sma=simple moving average).                                                                                                                                                                                                                        |
+| freqai.extrema_smoothing.window                      | 5                 | int >= 3                                                                                                                         | Window size for extrema smoothing.                                                                                                                                                                                                                                                                     |
+| freqai.extrema_smoothing.beta                        | 8.0               | float > 0                                                                                                                        | Kaiser kernel shape parameter.                                                                                                                                                                                                                                                                         |
+| _Extrema weighting_                                  |                   |                                                                                                                                  |                                                                                                                                                                                                                                                                                                        |
+| freqai.extrema_weighting.strategy                    | `none`            | enum {`none`,`amplitude`,`amplitude_excess`}                                                                                     | Extrema weighting source: unweighted (`none`), swing amplitude (`amplitude`), or volatility-adjusted swing amplitude (`amplitude_excess`).                                                                                                                                                             |
+| freqai.extrema_weighting.normalization               | `minmax`          | enum {`minmax`,`zscore`,`l1`,`l2`,`robust`,`softmax`,`tanh`,`rank`,`none`}                                                       | Normalization method for weights.                                                                                                                                                                                                                                                                      |
+| freqai.extrema_weighting.gamma                       | 1.0               | float (0,10]                                                                                                                     | Contrast exponent applied after normalization (>1 emphasizes extremes, 0<gamma<1 softens).                                                                                                                                                                                                             |
+| freqai.extrema_weighting.softmax_temperature         | 1.0               | float > 0                                                                                                                        | Temperature parameter for softmax normalization (lower values sharpen distribution, higher values flatten it).                                                                                                                                                                                         |
+| freqai.extrema_weighting.tanh_scale                  | 1.0               | float > 0                                                                                                                        | Scale parameter for tanh normalization.                                                                                                                                                                                                                                                                |
+| freqai.extrema_weighting.tanh_gain                   | 1.0               | float > 0                                                                                                                        | Gain parameter for tanh normalization.                                                                                                                                                                                                                                                                 |
+| freqai.extrema_weighting.robust_quantiles            | [0.25, 0.75]      | list[float] where 0 <= q_low < q_high <= 1                                                                                       | Quantile range for robust normalization.                                                                                                                                                                                                                                                               |
+| freqai.extrema_weighting.rank_method                 | `average`         | enum {`average`,`min`,`max`,`dense`,`ordinal`}                                                                                   | Ranking method for rank normalization.                                                                                                                                                                                                                                                                 |
+| _Feature parameters_                                 |                   |                                                                                                                                  |                                                                                                                                                                                                                                                                                                        |
+| freqai.feature_parameters.label_period_candles       | min/max midpoint  | int >= 1                                                                                                                         | Zigzag labeling NATR horizon.                                                                                                                                                                                                                                                                          |
+| freqai.feature_parameters.min_label_period_candles   | 12                | int >= 1                                                                                                                         | Minimum labeling NATR horizon used for reversals labeling HPO.                                                                                                                                                                                                                                         |
+| freqai.feature_parameters.max_label_period_candles   | 24                | int >= 1                                                                                                                         | Maximum labeling NATR horizon used for reversals labeling HPO.                                                                                                                                                                                                                                         |
+| freqai.feature_parameters.label_natr_ratio           | min/max midpoint  | float > 0                                                                                                                        | Zigzag labeling NATR ratio.                                                                                                                                                                                                                                                                            |
+| freqai.feature_parameters.min_label_natr_ratio       | 9.0               | float > 0                                                                                                                        | Minimum labeling NATR ratio used for reversals labeling HPO.                                                                                                                                                                                                                                           |
+| freqai.feature_parameters.max_label_natr_ratio       | 12.0              | float > 0                                                                                                                        | Maximum labeling NATR ratio used for reversals labeling HPO.                                                                                                                                                                                                                                           |
+| freqai.feature_parameters.label_frequency_candles    | `auto`            | int >= 2 \| `auto`                                                                                                               | Reversals labeling frequency. `auto` = max(2, 2 \* number of whitelisted pairs).                                                                                                                                                                                                                       |
+| freqai.feature_parameters.label_metric               | `euclidean`       | string (supported: `euclidean`,`minkowski`,`cityblock`,`chebyshev`,`mahalanobis`,`seuclidean`,`jensenshannon`,`sqeuclidean`,...) | Metric used in distance calculations to ideal point.                                                                                                                                                                                                                                                   |
+| freqai.feature_parameters.label_weights              | [0.5,0.5,0.5]     | list[float]                                                                                                                      | Per-objective weights used in distance calculations to ideal point. First objective is the number of detected reversals. Second objective is the median swing amplitude of Zigzag reversals (reversals quality). Third objective is the median volatility-adjusted swing amplitude (amplitude_excess). |
+| freqai.feature_parameters.label_p_order              | `None`            | float                                                                                                                            | p-order used by Minkowski / power-mean calculations (optional).                                                                                                                                                                                                                                        |
+| freqai.feature_parameters.label_medoid_metric        | `euclidean`       | string                                                                                                                           | Metric used with `medoid`.                                                                                                                                                                                                                                                                             |
+| freqai.feature_parameters.label_kmeans_metric        | `euclidean`       | string                                                                                                                           | Metric used for k-means clustering.                                                                                                                                                                                                                                                                    |
+| freqai.feature_parameters.label_kmeans_selection     | `min`             | enum {`min`,`medoid`}                                                                                                            | Strategy to select trial in the best kmeans cluster.                                                                                                                                                                                                                                                   |
+| freqai.feature_parameters.label_kmedoids_metric      | `euclidean`       | string                                                                                                                           | Metric used for k-medoids clustering.                                                                                                                                                                                                                                                                  |
+| freqai.feature_parameters.label_kmedoids_selection   | `min`             | enum {`min`,`medoid`}                                                                                                            | Strategy to select trial in the best k-medoids cluster.                                                                                                                                                                                                                                                |
+| freqai.feature_parameters.label_knn_metric           | `minkowski`       | string                                                                                                                           | Distance metric for KNN.                                                                                                                                                                                                                                                                               |
+| freqai.feature_parameters.label_knn_p_order          | `None`            | float                                                                                                                            | p-order for KNN Minkowski metric distance. (optional)                                                                                                                                                                                                                                                  |
+| freqai.feature_parameters.label_knn_n_neighbors      | 5                 | int >= 1                                                                                                                         | Number of neighbors for KNN.                                                                                                                                                                                                                                                                           |
+| _Predictions extrema_                                |                   |                                                                                                                                  |                                                                                                                                                                                                                                                                                                        |
+| freqai.predictions_extrema.selection_method          | `rank`            | enum {`rank`,`values`,`partition`}                                                                                               | Extrema selection method. `values` uses reversal values, `rank` uses ranked extrema values, `partition` uses sign-based partitioning.                                                                                                                                                                  |
+| freqai.predictions_extrema.thresholds_smoothing      | `mean`            | enum {`mean`,`isodata`,`li`,`minimum`,`otsu`,`triangle`,`yen`,`median`,`soft_extremum`}                                          | Thresholding method for prediction thresholds smoothing.                                                                                                                                                                                                                                               |
+| freqai.predictions_extrema.thresholds_alpha          | 12.0              | float > 0                                                                                                                        | Alpha for `soft_extremum`.                                                                                                                                                                                                                                                                             |
+| freqai.predictions_extrema.threshold_outlier         | 0.999             | float (0,1)                                                                                                                      | Quantile threshold for predictions outlier filtering.                                                                                                                                                                                                                                                  |
+| _Optuna / HPO_                                       |                   |                                                                                                                                  |                                                                                                                                                                                                                                                                                                        |
+| freqai.optuna_hyperopt.enabled                       | true              | bool                                                                                                                             | Enables HPO.                                                                                                                                                                                                                                                                                           |
+| freqai.optuna_hyperopt.sampler                       | `tpe`             | enum {`tpe`,`auto`}                                                                                                              | HPO sampler algorithm. `tpe` uses TPESampler with multivariate and group, `auto` uses AutoSampler.                                                                                                                                                                                                     |
+| freqai.optuna_hyperopt.storage                       | `file`            | enum {`file`,`sqlite`}                                                                                                           | HPO storage backend.                                                                                                                                                                                                                                                                                   |
+| freqai.optuna_hyperopt.continuous                    | true              | bool                                                                                                                             | Continuous HPO.                                                                                                                                                                                                                                                                                        |
+| freqai.optuna_hyperopt.warm_start                    | true              | bool                                                                                                                             | Warm start HPO with previous best value(s).                                                                                                                                                                                                                                                            |
+| freqai.optuna_hyperopt.n_startup_trials              | 15                | int >= 0                                                                                                                         | HPO startup trials.                                                                                                                                                                                                                                                                                    |
+| freqai.optuna_hyperopt.n_trials                      | 50                | int >= 1                                                                                                                         | Maximum HPO trials.                                                                                                                                                                                                                                                                                    |
+| freqai.optuna_hyperopt.n_jobs                        | CPU threads / 4   | int >= 1                                                                                                                         | Parallel HPO workers.                                                                                                                                                                                                                                                                                  |
+| freqai.optuna_hyperopt.timeout                       | 7200              | int >= 0                                                                                                                         | HPO wall-clock timeout in seconds.                                                                                                                                                                                                                                                                     |
+| freqai.optuna_hyperopt.label_candles_step            | 1                 | int >= 1                                                                                                                         | Step for Zigzag NATR horizon search space.                                                                                                                                                                                                                                                             |
+| freqai.optuna_hyperopt.train_candles_step            | 10                | int >= 1                                                                                                                         | Step for training sets size search space.                                                                                                                                                                                                                                                              |
+| freqai.optuna_hyperopt.space_reduction               | false             | bool                                                                                                                             | Enable/disable HPO search space reduction based on previous best parameters.                                                                                                                                                                                                                           |
+| freqai.optuna_hyperopt.expansion_ratio               | 0.4               | float [0,1]                                                                                                                      | HPO search space expansion ratio.                                                                                                                                                                                                                                                                      |
+| freqai.optuna_hyperopt.min_resource                  | 3                 | int >= 1                                                                                                                         | Minimum resource per Hyperband pruner rung.                                                                                                                                                                                                                                                            |
+| freqai.optuna_hyperopt.seed                          | 1                 | int >= 0                                                                                                                         | HPO RNG seed.                                                                                                                                                                                                                                                                                          |
 
 ## ReforceXY
 
index cb1cf1bdeb640688fd114a62f047c182ff007e92..4654272c0b19009ae4b98ea8f94ded15a7f2b674 100644 (file)
       "include_timeframes": ["5m", "15m", "1h", "4h"],
       "label_period_candles": 18,
       "label_metric": "euclidean",
-      "label_weights": [0.5, 0.5],
+      "label_weights": [0.5, 0.5, 0.5],
       "include_shifted_candles": 6,
       "DI_threshold": 10,
       "weight_factor": 0.9,
index 7f75046c3cbbc697b1b70773972a8d435d5b7a7d..c27ab150ad410c7b493041169520259de3c46a6d 100644 (file)
@@ -260,7 +260,7 @@ class QuickAdapterRegressorV3(BaseRegressionModel):
         for pair in self.pairs:
             self._optuna_hp_value[pair] = -1
             self._optuna_train_value[pair] = -1
-            self._optuna_label_values[pair] = [-1, -1]
+            self._optuna_label_values[pair] = [-1, -1, -1]
             self._optuna_hp_params[pair] = (
                 self.optuna_load_best_params(
                     pair, QuickAdapterRegressorV3._OPTUNA_NAMESPACES[0]
@@ -633,6 +633,7 @@ class QuickAdapterRegressorV3(BaseRegressionModel):
                     directions=[
                         optuna.study.StudyDirection.MAXIMIZE,
                         optuna.study.StudyDirection.MAXIMIZE,
+                        optuna.study.StudyDirection.MAXIMIZE,
                     ],
                 ),
             )
@@ -2081,7 +2082,7 @@ def label_objective(
     max_label_period_candles: int = 24,
     min_label_natr_ratio: float = 9.0,
     max_label_natr_ratio: float = 12.0,
-) -> tuple[float, int]:
+) -> tuple[int, float, float]:
     min_label_period_candles, max_label_period_candles, candles_step = (
         get_min_max_label_period_candles(
             fit_live_predictions_candles,
@@ -2107,15 +2108,22 @@ def label_objective(
     df = df.iloc[-(max(2, int(label_period_cycles)) * label_period_candles) :]
 
     if df.empty:
-        return -np.inf, 0
+        return 0, 0.0, 0.0
 
-    _, pivots_values, _, pivots_amplitudes, _ = zigzag(
+    _, pivots_values, _, pivots_amplitudes, pivots_amplitude_excesses = zigzag(
         df,
         natr_period=label_period_candles,
         natr_ratio=label_natr_ratio,
     )
 
-    median_amplitude = np.nanmedian(pivots_amplitudes)
+    median_amplitude = np.nanmedian(np.asarray(pivots_amplitudes, dtype=float))
     if not np.isfinite(median_amplitude):
         median_amplitude = 0.0
-    return median_amplitude, len(pivots_values)
+
+    median_amplitude_excess = np.nanmedian(
+        np.asarray(pivots_amplitude_excesses, dtype=float)
+    )
+    if not np.isfinite(median_amplitude_excess):
+        median_amplitude_excess = 0.0
+
+    return len(pivots_values), median_amplitude, median_amplitude_excess