Commit Graph

4 Commits

Author SHA1 Message Date
Harwinder 8df42cd384 Fix Ichimoku look-ahead bias: lag Senkou Spans by 26 bars
Senkou Span A and B are plotted 26 periods ahead of calculation.
Comparing current price to iloc[-1] cloud means comparing against the
cloud 26 bars in the future — a textbook look-ahead bias that inflates
signal grades in backtests. Now uses iloc[-(kijun+1)] so the cloud
boundaries reflect where the cloud actually is at the current candle.
TK cross (tenkan_val/kijun_val) stays at iloc[-1] — that is a current
condition, not a projected one.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-06 18:13:59 -04:00
Harwinder 402d49e094 Fix scoring math; add 10-min auto-scan A-grade alerts with news block
- engine: composite-score denominator now confidence-weighted, so the
  output actually spans -100..+100 (the prior formula put confidence
  in the numerator only, capping the realistic score around ±25-30
  and making STRONG_BUY ≥40 essentially unreachable).
- engine: ATR percentile uses iloc[-50:-1] to exclude the current bar
  from its own comparison (off-by-one in volatility regime).
- signal_aggregator: always blend primary score with MTF average. The
  prior code only blended on agreement, leaving the primary unblended
  on disagreement — backwards. Disagreement is exactly when the score
  should be pulled toward consensus.
- telegram_bot: JobQueue auto-scan every 10 min that pushes A/A+ to
  ALERT_CHAT_ID with a prominent News & Events block (sentiment +
  headline summary + event-risk + alignment hint). Per-bar dedup so
  persistent setups alert once per new candle, not every 10 min.
  Suppresses alerts when event_risk = "danger".
- telegram_bot: /myid returns chat ID for ALERT_CHAT_ID setup. Auto-scan
  silently disabled when ALERT_CHAT_ID is unset.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-06 12:50:30 -04:00
harry e4138ee60a Fixed code 2026-05-04 14:29:32 +00:00
harry dacf337e87 Add engine.py 2026-05-04 04:08:58 +00:00