[32m2026-02-09 16:45:50.084[0m | [1mINFO    [0m | [36msrc.mt5_connector[0m:[36mconnect[0m:[36m177[0m - [1mConnected to MT5: FinexBisnisSolusi-Demo (Account: 61045904)[0m
[32m2026-02-09 16:45:50.796[0m | [34m[1mDEBUG   [0m | [36msrc.mt5_connector[0m:[36mget_market_data[0m:[36m449[0m - [34m[1mFetched 50000 bars for XAUUSD M15[0m
[32m2026-02-09 16:45:51.000[0m | [34m[1mDEBUG   [0m | [36msrc.mt5_connector[0m:[36mget_market_data[0m:[36m449[0m - [34m[1mFetched 2000 bars for XAUUSD H1[0m
[32m2026-02-09 16:45:51.006[0m | [34m[1mDEBUG   [0m | [36msrc.feature_eng[0m:[36mcalculate_rsi[0m:[36m130[0m - [34m[1mRSI calculated (period=14)[0m
[32m2026-02-09 16:45:51.009[0m | [34m[1mDEBUG   [0m | [36msrc.feature_eng[0m:[36mcalculate_atr[0m:[36m185[0m - [34m[1mATR calculated (period=14)[0m
[32m2026-02-09 16:45:51.012[0m | [34m[1mDEBUG   [0m | [36msrc.feature_eng[0m:[36mcalculate_macd[0m:[36m243[0m - [34m[1mMACD calculated (12/26/9)[0m
[32m2026-02-09 16:45:51.015[0m | [34m[1mDEBUG   [0m | [36msrc.feature_eng[0m:[36mcalculate_bollinger_bands[0m:[36m301[0m - [34m[1mBollinger Bands calculated (period=20, std=2.0)[0m
[32m2026-02-09 16:45:51.017[0m | [34m[1mDEBUG   [0m | [36msrc.feature_eng[0m:[36mcalculate_ema_crossover[0m:[36m357[0m - [34m[1mEMA crossover calculated (9/21)[0m
[32m2026-02-09 16:45:51.019[0m | [34m[1mDEBUG   [0m | [36msrc.feature_eng[0m:[36mcalculate_volume_features[0m:[36m403[0m - [34m[1mVolume features calculated (period=20)[0m
[32m2026-02-09 16:45:51.028[0m | [34m[1mDEBUG   [0m | [36msrc.feature_eng[0m:[36mcalculate_ml_features[0m:[36m518[0m - [34m[1mML features calculated[0m
[32m2026-02-09 16:45:51.032[0m | [34m[1mDEBUG   [0m | [36msrc.smc_polars[0m:[36mcalculate_swing_points[0m:[36m401[0m - [34m[1mSwing points: 3062 highs, 3079 lows[0m
[32m2026-02-09 16:45:51.035[0m | [34m[1mDEBUG   [0m | [36msrc.smc_polars[0m:[36mcalculate_fvg[0m:[36m312[0m - [34m[1mFVG calculation complete. Bullish: 5696, Bearish: 4721[0m
[32m2026-02-09 16:45:51.057[0m | [34m[1mDEBUG   [0m | [36msrc.smc_polars[0m:[36mcalculate_order_blocks[0m:[36m511[0m - [34m[1mOrder Blocks: 2201 bullish, 2164 bearish[0m
[32m2026-02-09 16:45:51.171[0m | [34m[1mDEBUG   [0m | [36msrc.smc_polars[0m:[36mcalculate_bos_choch[0m:[36m599[0m - [34m[1mBOS: 702 bullish, 458 bearish[0m
[32m2026-02-09 16:45:51.171[0m | [34m[1mDEBUG   [0m | [36msrc.smc_polars[0m:[36mcalculate_bos_choch[0m:[36m600[0m - [34m[1mCHoCH: 616 bullish, 617 bearish[0m
[32m2026-02-09 16:45:51.375[0m | [1mINFO    [0m | [36mbacktests.ml_v2.ml_v2_feature_eng[0m:[36madd_all_v2_features[0m:[36m615[0m - [1mAdding all V2 features (23 new features)...[0m
[32m2026-02-09 16:45:51.378[0m | [34m[1mDEBUG   [0m | [36mbacktests.ml_v2.ml_v2_feature_eng[0m:[36madd_h1_features[0m:[36m233[0m - [34m[1mH1 features added (8 features)[0m
[32m2026-02-09 16:45:51.385[0m | [34m[1mDEBUG   [0m | [36mbacktests.ml_v2.ml_v2_feature_eng[0m:[36madd_continuous_smc_features[0m:[36m410[0m - [34m[1mContinuous SMC features added (7 features)[0m
[32m2026-02-09 16:45:51.390[0m | [34m[1mDEBUG   [0m | [36mbacktests.ml_v2.ml_v2_feature_eng[0m:[36madd_regime_features[0m:[36m497[0m - [34m[1mRegime features added (4 features)[0m
[32m2026-02-09 16:45:51.396[0m | [34m[1mDEBUG   [0m | [36mbacktests.ml_v2.ml_v2_feature_eng[0m:[36madd_price_action_features[0m:[36m593[0m - [34m[1mPrice action features added (4 features)[0m
[32m2026-02-09 16:45:51.397[0m | [1mINFO    [0m | [36mbacktests.ml_v2.ml_v2_feature_eng[0m:[36madd_all_v2_features[0m:[36m643[0m - [1mAll V2 features added (23 total)[0m
[I 2026-02-09 16:45:51,589] A new study created in memory with name: xgboost_opt
================================================================================
ML MODEL V3 TRAINING PIPELINE
Bismillah - Building Exceptional Model
================================================================================

 Fetching 50,000 bars of M15 data...
   Symbol: XAUUSD
   Timeframe: M15
 Fetched 50,000 bars
   Date range: 2023-12-27 09:45:00 to 2026-02-09 11:45:00

 Fetching 2,000 bars of H1 data...
 Fetched 2,000 H1 bars

 Engineering features...
   M15 technical indicators...
   SMC structure features...
   MLV2 features (H1 + derived)...
 Total features: 85 (MLV2 compatible)
     Columns with nulls: 38
      rsi, atr, atr_percent, bb_middle, bb_upper, bb_lower, bb_width, bb_percent_b, volume_sma, volume_ratio
   Filling nulls with forward fill...

 Labeling data with Triple Barrier Method (BINARY)...
 Starting Triple Barrier Labeling (BINARY: BUY vs SELL)...
   Profit target: 0.5 ATR
   Stop loss: 0.5 ATR
   Max holding: 20 bars

 Target Distribution (BINARY):
   BUY:   27557 (55.14%)
   SELL:  22423 (44.86%)
   Unlabeled:     20 (last 20 bars)

 Quality Metrics:
   Profit barriers hit:      0 ( 0.00%)
   Avg bars to profit:  0.0
   Avg return (ATR):    0.000

 Splitting train/test (stratified, BINARY)...
   Train: 39,985 samples
   Test:  9,995 samples
   Train distribution: BUY=55.1%, SELL=44.9%
   Test distribution: BUY=55.1%, SELL=44.9%

 Balancing TRAINING set only (BINARY)...

  Balancing Classes (BINARY)...
   Target distribution: BUY=50%, SELL=50%
   Before: BUY=22046, SELL=17939
   After:  BUY=17939, SELL=17939
   Total samples: 35878

 Selected 81 features
   Sample features: spread, rsi, atr, atr_percent, macd, macd_signal, macd_histogram, bb_middle, bb_upper, bb_lower...

 Training XGBoost model (BINARY: BUY vs SELL)...
   Training classes: [0 1] (expected: [0, 1])
   Class weights: SELL=1.00, BUY=1.00
   Class distribution: SELL=17939 (50.0%), BUY=17939 (50.0%)
   Running Optuna hyperparameter optimization...

  0%|          | 0/30 [00:00<?, ?it/s]
                                      

  0%|          | 0/30 [00:06<?, ?it/s]
Best trial: 0. Best value: 0.537269:   0%|          | 0/30 [00:06<?, ?it/s]
Best trial: 0. Best value: 0.537269:   3%|3         | 1/30 [00:06<02:59,  6.17s/it]
                                                                                   

Best trial: 0. Best value: 0.537269:   3%|3         | 1/30 [00:14<02:59,  6.17s/it]
Best trial: 0. Best value: 0.537269:   3%|3         | 1/30 [00:14<02:59,  6.17s/it]
Best trial: 0. Best value: 0.537269:   7%|6         | 2/30 [00:14<03:33,  7.62s/it]
                                                                                   

Best trial: 0. Best value: 0.537269:   7%|6         | 2/30 [00:24<03:33,  7.62s/it]
Best trial: 2. Best value: 0.550875:   7%|6         | 2/30 [00:24<03:33,  7.62s/it]
Best trial: 2. Best value: 0.550875:  10%|#         | 3/30 [00:24<03:45,  8.37s/it]
                                                                                   

Best trial: 2. Best value: 0.550875:  10%|#         | 3/30 [00:29<03:45,  8.37s/it]
Best trial: 2. Best value: 0.550875:  10%|#         | 3/30 [00:29<03:45,  8.37s/it]
Best trial: 2. Best value: 0.550875:  13%|#3        | 4/30 [00:29<03:11,  7.37s/it]
                                                                                   

Best trial: 2. Best value: 0.550875:  13%|#3        | 4/30 [00:38<03:11,  7.37s/it]
Best trial: 2. Best value: 0.550875:  13%|#3        | 4/30 [00:38<03:11,  7.37s/it]
Best trial: 2. Best value: 0.550875:  17%|#6        | 5/30 [00:38<03:18,  7.93s/it]
                                                                                   

Best trial: 2. Best value: 0.550875:  17%|#6        | 5/30 [00:44<03:18,  7.93s/it]
Best trial: 2. Best value: 0.550875:  17%|#6        | 5/30 [00:44<03:18,  7.93s/it]
Best trial: 2. Best value: 0.550875:  20%|##        | 6/30 [00:44<02:52,  7.20s/it]
                                                                                   

Best trial: 2. Best value: 0.550875:  20%|##        | 6/30 [00:53<02:52,  7.20s/it]
Best trial: 2. Best value: 0.550875:  20%|##        | 6/30 [00:53<02:52,  7.20s/it]
Best trial: 2. Best value: 0.550875:  23%|##3       | 7/30 [00:53<02:58,  7.75s/it]
                                                                                   

Best trial: 2. Best value: 0.550875:  23%|##3       | 7/30 [00:57<02:58,  7.75s/it]
Best trial: 7. Best value: 0.552976:  23%|##3       | 7/30 [00:57<02:58,  7.75s/it]
Best trial: 7. Best value: 0.552976:  27%|##6       | 8/30 [00:57<02:22,  6.46s/it]
                                                                                   

Best trial: 7. Best value: 0.552976:  27%|##6       | 8/30 [01:02<02:22,  6.46s/it]
Best trial: 7. Best value: 0.552976:  27%|##6       | 8/30 [01:02<02:22,  6.46s/it]
Best trial: 7. Best value: 0.552976:  30%|###       | 9/30 [01:02<02:08,  6.11s/it]
                                                                                   

Best trial: 7. Best value: 0.552976:  30%|###       | 9/30 [01:06<02:08,  6.11s/it]
Best trial: 7. Best value: 0.552976:  30%|###       | 9/30 [01:06<02:08,  6.11s/it]
Best trial: 7. Best value: 0.552976:  33%|###3      | 10/30 [01:06<01:49,  5.48s/it]
                                                                                    

Best trial: 7. Best value: 0.552976:  33%|###3      | 10/30 [01:08<01:49,  5.48s/it]
Best trial: 10. Best value: 0.554777:  33%|###3      | 10/30 [01:08<01:49,  5.48s/it]
Best trial: 10. Best value: 0.554777:  37%|###6      | 11/30 [01:08<01:24,  4.43s/it]
                                                                                     

Best trial: 10. Best value: 0.554777:  37%|###6      | 11/30 [01:10<01:24,  4.43s/it]
Best trial: 10. Best value: 0.554777:  37%|###6      | 11/30 [01:10<01:24,  4.43s/it]
Best trial: 10. Best value: 0.554777:  40%|####      | 12/30 [01:10<01:06,  3.72s/it]
                                                                                     

Best trial: 10. Best value: 0.554777:  40%|####      | 12/30 [01:12<01:06,  3.72s/it]
Best trial: 12. Best value: 0.56028:  40%|####      | 12/30 [01:12<01:06,  3.72s/it] 
Best trial: 12. Best value: 0.56028:  43%|####3     | 13/30 [01:12<00:53,  3.14s/it]
                                                                                    

Best trial: 12. Best value: 0.56028:  43%|####3     | 13/30 [01:14<00:53,  3.14s/it]
Best trial: 13. Best value: 0.561481:  43%|####3     | 13/30 [01:14<00:53,  3.14s/it]
Best trial: 13. Best value: 0.561481:  47%|####6     | 14/30 [01:14<00:43,  2.73s/it]
                                                                                     

Best trial: 13. Best value: 0.561481:  47%|####6     | 14/30 [01:16<00:43,  2.73s/it]
Best trial: 13. Best value: 0.561481:  47%|####6     | 14/30 [01:16<00:43,  2.73s/it]
Best trial: 13. Best value: 0.561481:  50%|#####     | 15/30 [01:16<00:36,  2.45s/it]
                                                                                     

Best trial: 13. Best value: 0.561481:  50%|#####     | 15/30 [01:18<00:36,  2.45s/it]
Best trial: 13. Best value: 0.561481:  50%|#####     | 15/30 [01:18<00:36,  2.45s/it]
Best trial: 13. Best value: 0.561481:  53%|#####3    | 16/30 [01:18<00:35,  2.57s/it]
                                                                                     

Best trial: 13. Best value: 0.561481:  53%|#####3    | 16/30 [01:20<00:35,  2.57s/it]
Best trial: 16. Best value: 0.568784:  53%|#####3    | 16/30 [01:20<00:35,  2.57s/it]
Best trial: 16. Best value: 0.568784:  57%|#####6    | 17/30 [01:20<00:29,  2.28s/it]
                                                                                     

Best trial: 16. Best value: 0.568784:  57%|#####6    | 17/30 [01:24<00:29,  2.28s/it]
Best trial: 16. Best value: 0.568784:  57%|#####6    | 17/30 [01:24<00:29,  2.28s/it]
Best trial: 16. Best value: 0.568784:  60%|######    | 18/30 [01:24<00:32,  2.69s/it]
                                                                                     

Best trial: 16. Best value: 0.568784:  60%|######    | 18/30 [01:26<00:32,  2.69s/it]
Best trial: 16. Best value: 0.568784:  60%|######    | 18/30 [01:26<00:32,  2.69s/it]
Best trial: 16. Best value: 0.568784:  63%|######3   | 19/30 [01:26<00:26,  2.43s/it]
                                                                                     
[I 2026-02-09 16:45:57,764] Trial 0 finished with value: 0.5372686343171585 and parameters: {'max_depth': 6, 'learning_rate': 0.01755557651470559, 'n_estimators': 400, 'min_child_weight': 4, 'gamma': 0.07092610329933297, 'subsample': 0.8072614274939443, 'colsample_bytree': 0.8473492681262139, 'reg_alpha': 0.4656894628839471, 'reg_lambda': 0.7562746800910303}. Best is trial 0 with value: 0.5372686343171585.
[I 2026-02-09 16:46:06,403] Trial 1 finished with value: 0.5254627313656829 and parameters: {'max_depth': 7, 'learning_rate': 0.168880753714888, 'n_estimators': 350, 'min_child_weight': 1, 'gamma': 0.05000056083472754, 'subsample': 0.8414965649141212, 'colsample_bytree': 0.9771297734542507, 'reg_alpha': 0.4745084731363527, 'reg_lambda': 0.14857041059054654}. Best is trial 0 with value: 0.5372686343171585.
[I 2026-02-09 16:46:15,652] Trial 2 finished with value: 0.5508754377188594 and parameters: {'max_depth': 8, 'learning_rate': 0.013676043223331198, 'n_estimators': 300, 'min_child_weight': 5, 'gamma': 0.021238255646964077, 'subsample': 0.8604386118620899, 'colsample_bytree': 0.8744531988988875, 'reg_alpha': 0.549016360970928, 'reg_lambda': 0.8558917982994838}. Best is trial 2 with value: 0.5508754377188594.
[I 2026-02-09 16:46:21,496] Trial 3 finished with value: 0.543671835917959 and parameters: {'max_depth': 5, 'learning_rate': 0.12265851379408758, 'n_estimators': 400, 'min_child_weight': 6, 'gamma': 0.31685121892503115, 'subsample': 0.861168642793601, 'colsample_bytree': 0.8896788161042266, 'reg_alpha': 0.0360636253794, 'reg_lambda': 0.719899561481671}. Best is trial 2 with value: 0.5508754377188594.
[I 2026-02-09 16:46:30,411] Trial 4 finished with value: 0.5431715857928965 and parameters: {'max_depth': 7, 'learning_rate': 0.061829499622131356, 'n_estimators': 350, 'min_child_weight': 2, 'gamma': 0.4403041912672776, 'subsample': 0.7889201148936328, 'colsample_bytree': 0.7620300004806546, 'reg_alpha': 0.3163443508158479, 'reg_lambda': 1.0829268731254469}. Best is trial 2 with value: 0.5508754377188594.
[I 2026-02-09 16:46:36,185] Trial 5 finished with value: 0.5431715857928965 and parameters: {'max_depth': 5, 'learning_rate': 0.011778928976842873, 'n_estimators': 350, 'min_child_weight': 7, 'gamma': 0.30380002046454735, 'subsample': 0.9969557235246403, 'colsample_bytree': 0.8373253027199772, 'reg_alpha': 0.3158295335034127, 'reg_lambda': 0.3957076130181003}. Best is trial 2 with value: 0.5508754377188594.
[I 2026-02-09 16:46:45,088] Trial 6 finished with value: 0.5421710855427714 and parameters: {'max_depth': 7, 'learning_rate': 0.01135070074234482, 'n_estimators': 350, 'min_child_weight': 4, 'gamma': 0.023740830428984283, 'subsample': 0.8015396253807192, 'colsample_bytree': 0.9511007061779484, 'reg_alpha': 0.3537458847176086, 'reg_lambda': 1.2629407325986308}. Best is trial 2 with value: 0.5508754377188594.
[I 2026-02-09 16:46:48,765] Trial 7 finished with value: 0.552976488244122 and parameters: {'max_depth': 5, 'learning_rate': 0.015118327453507604, 'n_estimators': 200, 'min_child_weight': 3, 'gamma': 0.3418528927639189, 'subsample': 0.8674028615450962, 'colsample_bytree': 0.8196161026507331, 'reg_alpha': 0.9710830793723528, 'reg_lambda': 0.7441504601064461}. Best is trial 7 with value: 0.552976488244122.
[I 2026-02-09 16:46:54,118] Trial 8 finished with value: 0.5435717858929465 and parameters: {'max_depth': 4, 'learning_rate': 0.020445044494546993, 'n_estimators': 450, 'min_child_weight': 2, 'gamma': 0.4799667742560567, 'subsample': 0.6250481465137108, 'colsample_bytree': 0.6173434142285082, 'reg_alpha': 0.4569285054585679, 'reg_lambda': 0.6438877902945772}. Best is trial 7 with value: 0.552976488244122.
[I 2026-02-09 16:46:58,180] Trial 9 finished with value: 0.535767883941971 and parameters: {'max_depth': 3, 'learning_rate': 0.09885956574247975, 'n_estimators': 350, 'min_child_weight': 4, 'gamma': 0.49315648553926994, 'subsample': 0.7194852375035138, 'colsample_bytree': 0.915245646179611, 'reg_alpha': 0.11893364631154602, 'reg_lambda': 0.9939723409230117}. Best is trial 7 with value: 0.552976488244122.
[I 2026-02-09 16:47:00,244] Trial 10 finished with value: 0.5547773886943472 and parameters: {'max_depth': 3, 'learning_rate': 0.031095899971443988, 'n_estimators': 150, 'min_child_weight': 3, 'gamma': 0.18577091170191, 'subsample': 0.979435903355256, 'colsample_bytree': 0.7438985052480047, 'reg_alpha': 0.9410013939796988, 'reg_lambda': 1.7882675952078875}. Best is trial 10 with value: 0.5547773886943472.
[I 2026-02-09 16:47:02,339] Trial 11 finished with value: 0.5536768384192096 and parameters: {'max_depth': 3, 'learning_rate': 0.0329139166742609, 'n_estimators': 150, 'min_child_weight': 3, 'gamma': 0.1723861746966001, 'subsample': 0.9841571938941059, 'colsample_bytree': 0.7440834167339366, 'reg_alpha': 0.9874954559148768, 'reg_lambda': 1.8939533162205724}. Best is trial 10 with value: 0.5547773886943472.
[I 2026-02-09 16:47:04,155] Trial 12 finished with value: 0.560280140070035 and parameters: {'max_depth': 3, 'learning_rate': 0.03311362565418044, 'n_estimators': 100, 'min_child_weight': 3, 'gamma': 0.16116924825633608, 'subsample': 0.9998914960198222, 'colsample_bytree': 0.7232805919454712, 'reg_alpha': 0.9816702791466874, 'reg_lambda': 1.9562951126784363}. Best is trial 12 with value: 0.560280140070035.
[I 2026-02-09 16:47:05,913] Trial 13 finished with value: 0.5614807403701851 and parameters: {'max_depth': 3, 'learning_rate': 0.03340286383975731, 'n_estimators': 100, 'min_child_weight': 2, 'gamma': 0.1665494798542183, 'subsample': 0.9351667442030648, 'colsample_bytree': 0.6737792517742777, 'reg_alpha': 0.7804430783635491, 'reg_lambda': 1.9822496346577494}. Best is trial 13 with value: 0.5614807403701851.
[I 2026-02-09 16:47:07,716] Trial 14 finished with value: 0.5358679339669835 and parameters: {'max_depth': 4, 'learning_rate': 0.053760021194810326, 'n_estimators': 100, 'min_child_weight': 1, 'gamma': 0.12990802941246746, 'subsample': 0.9280883580344288, 'colsample_bytree': 0.6456039506723489, 'reg_alpha': 0.7718332533356731, 'reg_lambda': 1.6080980203984012}. Best is trial 13 with value: 0.5614807403701851.
[I 2026-02-09 16:47:10,562] Trial 15 finished with value: 0.5389694847423712 and parameters: {'max_depth': 4, 'learning_rate': 0.03321724346100841, 'n_estimators': 200, 'min_child_weight': 2, 'gamma': 0.22250550562480909, 'subsample': 0.9249560508315149, 'colsample_bytree': 0.6803485541827908, 'reg_alpha': 0.770259053880076, 'reg_lambda': 1.5014360491197363}. Best is trial 13 with value: 0.5614807403701851.
[I 2026-02-09 16:47:12,185] Trial 16 finished with value: 0.568784392196098 and parameters: {'max_depth': 3, 'learning_rate': 0.02372312562116949, 'n_estimators': 100, 'min_child_weight': 1, 'gamma': 0.10654204697811255, 'subsample': 0.9364174432522089, 'colsample_bytree': 0.7031796673225155, 'reg_alpha': 0.7974351847252932, 'reg_lambda': 1.9804942417034694}. Best is trial 16 with value: 0.568784392196098.
[I 2026-02-09 16:47:15,809] Trial 17 finished with value: 0.5381690845422711 and parameters: {'max_depth': 4, 'learning_rate': 0.021615361484380372, 'n_estimators': 250, 'min_child_weight': 1, 'gamma': 0.10388153369057004, 'subsample': 0.9230995056950458, 'colsample_bytree': 0.6853503080693842, 'reg_alpha': 0.7137270538098834, 'reg_lambda': 1.4556810941411245}. Best is trial 16 with value: 0.568784392196098.
[I 2026-02-09 16:47:17,657] Trial 18 finished with value: 0.5332666333166584 and parameters: {'max_depth': 3, 'learning_rate': 0.06559888316593436, 'n_estimators': 100, 'min_child_weight': 2, 'gamma': 0.26318368336359577, 'subsample': 0.7325003826564399, 'colsample_bytree': 0.6085841264451994, 'reg_alpha': 0.6503707703597295, 'reg_lambda': 1.6975242835178586}. Best is trial 16 with value: 0.568784392196098.
[I 2026-02-09 16:47:21,931] Trial 19 finished with value: 0.5412706353176588 and parameters: {'max_depth': 6, 'learning_rate': 0.024313334425092394, 'n_estimators': 200, 'min_child_weight': 1, 'gamma': 0.10262898139458487, 'subsample': 0.9022918379456697, 'colsample_bytree': 0.7876476609582218, 'reg_alpha': 0.8615994318235322, 'reg_lambda': 1.3298568028962832}. Best is trial 16 with value: 0.568784392196098.
Best trial: 16. Best value: 0.568784:  63%|######3   | 19/30 [01:30<00:26,  2.43s/it]
Best trial: 16. Best value: 0.568784:  63%|######3   | 19/30 [01:30<00:26,  2.43s/it]
Best trial: 16. Best value: 0.568784:  67%|######6   | 20/30 [01:30<00:29,  2.99s/it]
                                                                                     

Best trial: 16. Best value: 0.568784:  67%|######6   | 20/30 [01:33<00:29,  2.99s/it]
Best trial: 16. Best value: 0.568784:  67%|######6   | 20/30 [01:33<00:29,  2.99s/it]
Best trial: 16. Best value: 0.568784:  70%|#######   | 21/30 [01:33<00:27,  3.03s/it]
                                                                                     

Best trial: 16. Best value: 0.568784:  70%|#######   | 21/30 [01:35<00:27,  3.03s/it]
Best trial: 16. Best value: 0.568784:  70%|#######   | 21/30 [01:35<00:27,  3.03s/it]
Best trial: 16. Best value: 0.568784:  73%|#######3  | 22/30 [01:35<00:21,  2.69s/it]
                                                                                     

Best trial: 16. Best value: 0.568784:  73%|#######3  | 22/30 [01:37<00:21,  2.69s/it]
Best trial: 16. Best value: 0.568784:  73%|#######3  | 22/30 [01:37<00:21,  2.69s/it]
Best trial: 16. Best value: 0.568784:  77%|#######6  | 23/30 [01:37<00:16,  2.41s/it]
                                                                                     

Best trial: 16. Best value: 0.568784:  77%|#######6  | 23/30 [01:39<00:16,  2.41s/it]
Best trial: 16. Best value: 0.568784:  77%|#######6  | 23/30 [01:39<00:16,  2.41s/it]
Best trial: 16. Best value: 0.568784:  80%|########  | 24/30 [01:39<00:14,  2.44s/it]
                                                                                     

Best trial: 16. Best value: 0.568784:  80%|########  | 24/30 [01:42<00:14,  2.44s/it]
Best trial: 16. Best value: 0.568784:  80%|########  | 24/30 [01:42<00:14,  2.44s/it]
Best trial: 16. Best value: 0.568784:  83%|########3 | 25/30 [01:42<00:12,  2.54s/it]
                                                                                     

Best trial: 16. Best value: 0.568784:  83%|########3 | 25/30 [01:47<00:12,  2.54s/it]
Best trial: 16. Best value: 0.568784:  83%|########3 | 25/30 [01:47<00:12,  2.54s/it]
Best trial: 16. Best value: 0.568784:  87%|########6 | 26/30 [01:47<00:12,  3.23s/it]
                                                                                     

Best trial: 16. Best value: 0.568784:  87%|########6 | 26/30 [01:49<00:12,  3.23s/it]
Best trial: 16. Best value: 0.568784:  87%|########6 | 26/30 [01:49<00:12,  3.23s/it]
Best trial: 16. Best value: 0.568784:  90%|######### | 27/30 [01:49<00:08,  2.81s/it]
                                                                                     

Best trial: 16. Best value: 0.568784:  90%|######### | 27/30 [01:51<00:08,  2.81s/it]
Best trial: 16. Best value: 0.568784:  90%|######### | 27/30 [01:51<00:08,  2.81s/it]
Best trial: 16. Best value: 0.568784:  93%|#########3| 28/30 [01:51<00:05,  2.71s/it]
                                                                                     

Best trial: 16. Best value: 0.568784:  93%|#########3| 28/30 [01:54<00:05,  2.71s/it]
Best trial: 16. Best value: 0.568784:  93%|#########3| 28/30 [01:54<00:05,  2.71s/it]
Best trial: 16. Best value: 0.568784:  97%|#########6| 29/30 [01:54<00:02,  2.83s/it]
                                                                                     

Best trial: 16. Best value: 0.568784:  97%|#########6| 29/30 [01:58<00:02,  2.83s/it]
Best trial: 16. Best value: 0.568784:  97%|#########6| 29/30 [01:58<00:02,  2.83s/it]
Best trial: 16. Best value: 0.568784: 100%|##########| 30/30 [01:58<00:00,  3.14s/it]
Best trial: 16. Best value: 0.568784: 100%|##########| 30/30 [01:58<00:00,  3.95s/it]

[I 2026-02-09 16:47:25,074] Trial 20 finished with value: 0.5370685342671335 and parameters: {'max_depth': 4, 'learning_rate': 0.04352508218695565, 'n_estimators': 150, 'min_child_weight': 2, 'gamma': 0.23267054813701996, 'subsample': 0.9546673084828781, 'colsample_bytree': 0.6934168046819972, 'reg_alpha': 0.6241217242244527, 'reg_lambda': 1.9971863792210254}. Best is trial 16 with value: 0.568784392196098.
[I 2026-02-09 16:47:26,977] Trial 21 finished with value: 0.5623811905952977 and parameters: {'max_depth': 3, 'learning_rate': 0.03902012100873866, 'n_estimators': 100, 'min_child_weight': 3, 'gamma': 0.1586501356901509, 'subsample': 0.9547854344032023, 'colsample_bytree': 0.7129491750593099, 'reg_alpha': 0.8398138251281323, 'reg_lambda': 1.9854259519258644}. Best is trial 16 with value: 0.568784392196098.
[I 2026-02-09 16:47:28,707] Trial 22 finished with value: 0.551575787893947 and parameters: {'max_depth': 3, 'learning_rate': 0.04310126180495365, 'n_estimators': 100, 'min_child_weight': 3, 'gamma': 0.13796693384205214, 'subsample': 0.89877281749946, 'colsample_bytree': 0.6634269122515914, 'reg_alpha': 0.834668464837715, 'reg_lambda': 1.7761926933288252}. Best is trial 16 with value: 0.568784392196098.
[I 2026-02-09 16:47:31,232] Trial 23 finished with value: 0.5465732866433216 and parameters: {'max_depth': 4, 'learning_rate': 0.02486526327484417, 'n_estimators': 150, 'min_child_weight': 1, 'gamma': 0.20621157124216746, 'subsample': 0.9602163617633142, 'colsample_bytree': 0.7168301671883803, 'reg_alpha': 0.8513557758841518, 'reg_lambda': 1.5952366185435096}. Best is trial 16 with value: 0.568784392196098.
[I 2026-02-09 16:47:33,989] Trial 24 finished with value: 0.5456728364182091 and parameters: {'max_depth': 3, 'learning_rate': 0.07419465575770377, 'n_estimators': 250, 'min_child_weight': 2, 'gamma': 0.27397233145703964, 'subsample': 0.948100613582829, 'colsample_bytree': 0.6402037449550099, 'reg_alpha': 0.6627032729746859, 'reg_lambda': 1.8535663708495806}. Best is trial 16 with value: 0.568784392196098.
[I 2026-02-09 16:47:38,846] Trial 25 finished with value: 0.5341670835417709 and parameters: {'max_depth': 3, 'learning_rate': 0.04521565498683209, 'n_estimators': 500, 'min_child_weight': 5, 'gamma': 0.09280277787631178, 'subsample': 0.8966182942730149, 'colsample_bytree': 0.7804790288264897, 'reg_alpha': 0.8900289937945495, 'reg_lambda': 1.986904982622233}. Best is trial 16 with value: 0.568784392196098.
[I 2026-02-09 16:47:40,663] Trial 26 finished with value: 0.551575787893947 and parameters: {'max_depth': 4, 'learning_rate': 0.027369103415142915, 'n_estimators': 100, 'min_child_weight': 2, 'gamma': 0.3747227992197878, 'subsample': 0.6202599102302417, 'colsample_bytree': 0.707376310461279, 'reg_alpha': 0.761247932711477, 'reg_lambda': 1.7066731425207464}. Best is trial 16 with value: 0.568784392196098.
[I 2026-02-09 16:47:43,144] Trial 27 finished with value: 0.543871935967984 and parameters: {'max_depth': 5, 'learning_rate': 0.03974698990750001, 'n_estimators': 150, 'min_child_weight': 5, 'gamma': 0.1542868245011073, 'subsample': 0.832561100797325, 'colsample_bytree': 0.6514207678712729, 'reg_alpha': 0.5760724419781813, 'reg_lambda': 1.2552930352343137}. Best is trial 16 with value: 0.568784392196098.
[I 2026-02-09 16:47:46,241] Trial 28 finished with value: 0.5437718859429714 and parameters: {'max_depth': 3, 'learning_rate': 0.018115967291782456, 'n_estimators': 250, 'min_child_weight': 1, 'gamma': 0.06553882520878107, 'subsample': 0.7621754035493635, 'colsample_bytree': 0.7491928985672744, 'reg_alpha': 0.6989518801129243, 'reg_lambda': 1.415601916289535}. Best is trial 16 with value: 0.568784392196098.
[I 2026-02-09 16:47:50,127] Trial 29 finished with value: 0.5466733366683342 and parameters: {'max_depth': 6, 'learning_rate': 0.08579526411662486, 'n_estimators': 200, 'min_child_weight': 4, 'gamma': 0.19524647174222595, 'subsample': 0.8825448014567417, 'colsample_bytree': 0.7190621127935031, 'reg_alpha': 0.8028569696676869, 'reg_lambda': 1.6354388849194612}. Best is trial 16 with value: 0.568784392196098.

   Best trial: 16
   Best accuracy: 0.5688

   Training final model with params: {'max_depth': 3, 'learning_rate': 0.02372312562116949, 'n_estimators': 100, 'min_child_weight': 1, 'gamma': 0.10654204697811255, 'subsample': 0.9364174432522089, 'colsample_bytree': 0.7031796673225155, 'reg_alpha': 0.7974351847252932, 'reg_lambda': 1.9804942417034694}

 Model Performance (BINARY):
   Train Accuracy: 0.5739
   Test Accuracy:  0.5631

   Test Set Classification Report (BINARY):
              precision    recall  f1-score   support

        SELL      0.511     0.591     0.548      4484
         BUY      0.619     0.540     0.577      5511

    accuracy                          0.563      9995
   macro avg      0.565     0.566     0.563      9995
weighted avg      0.571     0.563     0.564      9995


   Confusion Matrix:
                Predicted
            SELL   BUY
   SELL     2650  1834
   BUY      2533  2978

 Model saved to: backtests\ml_v3\xgboost_model_v3.pkl (TradingModelV2 format)
 Metadata saved to: backtests\ml_v3\xgboost_model_v3_metadata.json

================================================================================
 TRAINING COMPLETE
================================================================================
