From 6d58eaa24ea110aada599b007071f41425ffffe6 Mon Sep 17 00:00:00 2001 From: jgrusewski Date: Fri, 17 Apr 2026 22:20:10 +0200 Subject: [PATCH] =?UTF-8?q?fix:=20min=5Fhold=5Fbars=2010=E2=86=9250=20+=20?= =?UTF-8?q?adaptive=20hold=20scales=20with=20base?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit min_hold=10 allowed ~1200 trades/day — costs destroyed the edge. min_hold=50 (~6.5 min) limits to ~230 trades/day max. Adaptive extension now scales 0-2× base (was hardcoded 0-8 bars). With base=50: range is 50-150 bars depending on ISV stability. Losing positions (negative reward_ema) get base only (50 bars). Co-Authored-By: Claude Opus 4.6 (1M context) --- config/training/dqn-production.toml | 2 +- crates/ml/src/cuda_pipeline/trade_physics.cuh | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/config/training/dqn-production.toml b/config/training/dqn-production.toml index 3794a83cc..cb0633a9a 100644 --- a/config/training/dqn-production.toml +++ b/config/training/dqn-production.toml @@ -67,7 +67,7 @@ min_epochs_before_stopping = 80 gpu_n_episodes = 4096 initial_capital = 35000.0 tx_cost_multiplier = 0.18 # bps: IBKR ES RT = $4.50/contract ($0.85 comm + $1.38 exch + $0.02 reg × 2 sides). At ES=$5100: 0.18 bps × 5100 × 0.0001 = 0.09 pts = $4.50 -min_hold_bars = 10 # ~26s hold at 23 volume bars/min +min_hold_bars = 50 # ~6.5 min at ~11.5K imbalance bars/day. ISV extends to 50-150 bars adaptively. [experience.fill_simulation] ioc_fill_prob = 0.85 diff --git a/crates/ml/src/cuda_pipeline/trade_physics.cuh b/crates/ml/src/cuda_pipeline/trade_physics.cuh index b8fbda7a3..eb307da95 100644 --- a/crates/ml/src/cuda_pipeline/trade_physics.cuh +++ b/crates/ml/src/cuda_pipeline/trade_physics.cuh @@ -157,8 +157,9 @@ __device__ __forceinline__ float enforce_hold( if (isv_signals != NULL) { float stability = 1.0f / (1.0f + isv_signals[1]); /* inv grad_norm: high norm → low stability */ float confidence = 1.0f - fminf(isv_signals[3], 1.0f); /* inv ensemble_var: high var → low confidence */ - /* Extension: 0-8 bars based on stability × confidence */ - int extension = (int)(stability * confidence * 8.0f); + /* Extension: 0-2× base hold based on stability × confidence. + * Scales with min_hold_bars: base=50 → extension up to 100 bars. */ + int extension = (int)(stability * confidence * (float)min_hold_bars * 2.0f); /* If losing (negative reward_ema), reduce hold to base only */ if (isv_signals[5] < -0.001f) extension = 0; adaptive_hold = min_hold_bars + extension;