emmanuelakbi commited on
Commit
1553537
·
1 Parent(s): 0ae549a

fix(signals): enforce minimum 1:1 R:R on rescaled bands

Browse files
Files changed (1) hide show
  1. crew/crew.py +16 -0
crew/crew.py CHANGED
@@ -355,6 +355,22 @@ class FinAgentCrew:
355
  if _target_unreasonable(new_target):
356
  new_target = None
357
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
358
  rescaled = TradingSignal(
359
  ticker=signal.ticker,
360
  action=signal.action,
 
355
  if _target_unreasonable(new_target):
356
  new_target = None
357
 
358
+ # R:R guard: a BUY/SELL card with target closer to entry than
359
+ # stop is an inverted risk-reward setup (you'd risk more than
360
+ # you could make). Qwen occasionally emits this when it picks
361
+ # a conservative target that's still within the absolute clamp
362
+ # but not sensible relative to the stop it chose. Force the
363
+ # target back to the profile default band in that case.
364
+ if (
365
+ new_stop is not None
366
+ and new_target is not None
367
+ and signal.action in (Action.BUY, Action.SELL)
368
+ ):
369
+ stop_dist = abs(new_stop - live_entry)
370
+ target_dist = abs(new_target - live_entry)
371
+ if target_dist <= stop_dist:
372
+ new_target = None
373
+
374
  rescaled = TradingSignal(
375
  ticker=signal.ticker,
376
  action=signal.action,