Resolve HOLD vs execution timeout confusion
Summary
Investigated why bot f7657e75-dbfb-4854-9af6-67f538c1362b appeared to HOLD despite all strategy checks being green.
Root cause findings
- Strategy was often HOLDing because entry thresholds were not explicitly shown in monitor diagnostics.
- After strategy tuning, BUY/SELL signals did fire, but order execution failed at broker layer with cTrader timeout errors.
- A backend bug in order execution error handling allowed AppError paths to bypass the
failedstatus update, leaving manybot_ordersrows inpendingeven when execution had already failed.
Code changes
- Preserved structured strategy check values (objects/booleans/arrays) in custom strategy normalization:
services/backend/src/lib/custom-strategy-runtime.ts
- Broadened check value type in shared backend and frontend types:
services/backend/src/lib/backtest-engine/types.tsservices/backend/src/lib/bot-tick-decisions-repo.tsservices/frontend/src/lib/api-client/index.ts
- Improved monitor check-value rendering and filtering for structured values:
services/frontend/src/routes/bots/MonitorPanel.tsx
- Updated bot-specific manual strategy source to emit explicit entry checks and clearer HOLD reasons:
services/backend/tmp_live_strategy_v7.ts- Added
atLowerGrid/atUpperGridchecks - Added gap-in-pips diagnostics and tolerance support
- Added nearest-edge disambiguation when both edges are within tolerance
- Fixed order failure handling so broker AppError paths still mark orders as
failed:services/backend/src/routes/exchange/exchange-execution.ts
Live data changes (DB)
- Published manual strategy version 9 and then version 10 for bot
f7657e75-dbfb-4854-9af6-67f538c1362b. - Updated bot parameter
triggerTolerancePipsto0.5. - Backfilled recent stuck pending orders for this bot to
failedwhere no exchange order id existed.
Deployments
Backend deployed to both dev and production after each relevant code change.
- Dev version IDs observed:
b92846ff-a50e-4929-aefb-97e81ad3e5b57e9deb31-cf46-40c1-b6f2-4518faad824a
- Prod version IDs observed:
9fbf9f47-1d4d-48c0-82ec-cae41fed76f429471f10-755e-410c-9467-a80e9c3b938a
Validation snapshot
Recent decisions show BUY/SELL signals are being produced, but broker execution currently times out:
- Decision/action example: BUY + error
- Error example:
Pepperstone/cTrader order failed: Timed out placing cTrader demo order for EURUSD after 15000ms
This confirms strategy gating is no longer the blocker; broker execution reliability is now the active blocker.