Avoid fee-negative ATR exits

This commit is contained in:
Codex
2026-06-30 14:40:26 +03:00
parent 56701d02f1
commit 6c92c6e955
2 changed files with 46 additions and 0 deletions
+9
View File
@@ -909,6 +909,15 @@ def _torch_forecast_exit_signal(
if price >= position.take_profit:
return Signal(position.symbol, "SELL", 0.96, "torch_forecast: take-profit hit", diagnostics)
if atr_trailing_stop is not None and price <= atr_trailing_stop:
if estimated_exit_net_percent < 0:
diagnostics["atr_exit_blocked_by_cost"] = True
return Signal(
position.symbol,
"HOLD",
0.45,
"torch_forecast: ATR trailing touched, but exit is not worth fees",
diagnostics,
)
return Signal(position.symbol, "SELL", 0.94, "torch_forecast: ATR trailing stop hit", diagnostics)
if not _is_torch_forecast(forecast):
if rebound_fallback_position: