-
-
Notifications
You must be signed in to change notification settings - Fork 1
Open
Labels
fix-in-progressFix is being processedFix is being processedpost-mortemIssue originated from post-mortem analysisIssue originated from post-mortem analysis
Description
Auto-generated from Post-Mortem Analysis
Source Discussion: #336
Priority: medium
Risk: medium
Summary
All 4 buy trades showed RSI (+35) and MACD (-3 to -4) divergence that was completely ignored. When momentum (MACD) contradicts mean-reversion (RSI), apply a 30% score penalty.
Analysis
| Trade | RSI Score | MACD Score | Divergence |
|---|---|---|---|
| #235 | +35 | -3 | RSI bullish, MACD bearish |
| #236 | +35 | -4 | RSI bullish, MACD bearish |
| #237 | +35 | -3 | RSI bullish, MACD bearish |
| #238 | +35 | -3 | RSI bullish, MACD bearish |
Implementation
In src/strategy/signal_scorer.py, after calculating rsi_score and macd_score (around line 765):
# Detect RSI/MACD divergence
rsi_macd_divergence = (
(rsi_score >= 20 and macd_score <= -2) or # RSI bullish, MACD bearish
(rsi_score <= -20 and macd_score >= 2) # RSI bearish, MACD bullish
)
if rsi_macd_divergence:
metadata["_indicator_divergence"] = 1
divergence_penalty = 0.3 # 30% score reduction
original_score = total_score
total_score = int(total_score * (1 - divergence_penalty))
logger.info(
"indicator_divergence_penalty",
rsi_score=rsi_score,
macd_score=macd_score,
original_score=original_score,
adjusted_score=total_score,
penalty_percent=divergence_penalty * 100,
)
else:
metadata["_indicator_divergence"] = 0Trade-offs
- Pro: Trade fix(tests): database files should be created in /tmp instead of project folder #237 would score ~44 instead of 63, well below threshold
- Pro: Creates self-correcting mechanism for conflicting signals
- Con: May reduce some valid contrarian trades
Context
From post-mortem analysis: [Post-Mortem] Paper Trade Analysis - 2026-01-09
This issue was automatically created from post-mortem analysis.
The auto-fix label will trigger automatic fix attempt.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
fix-in-progressFix is being processedFix is being processedpost-mortemIssue originated from post-mortem analysisIssue originated from post-mortem analysis