Skip to content

Check custom alerts after several closes; draw Fibonacci retracements from 1 to 0 - #48

Merged
JanGradkowski merged 3 commits into
mainfrom
multi-interval-custom-alerts
Nov 8, 2026
Merged

JanGradkowski merged 3 commits into
mainfrom
multi-interval-custom-alerts

Conversation

@JanGradkowski

Copy link
Copy Markdown
Owner

What changes

Custom alerts on several intervals. In the builder, "Check after every" is now three chips (daily, weekly, monthly close), and any of them can be ticked. It stays one alert: editing, pausing and its watchlists apply to every interval, and each trigger says which interval fired.

Fibonacci retracement direction. The drawing tool on the stock page now puts 1 at the first click (the swing start) and 0 at the second (its end). TradingView, MetaTrader and the app's own Auto Fib indicator all do it this way. Before, it was the other way round: on a swing from 100 to 130 the line labelled 0.618 sat at 118.54, which is a 38.2% pullback. "Reverse" now gives the old layout.

Custom alerts in detail

  • Database (V101): custom_alerts.interval becomes an intervals array (one to three of DAILY, WEEKLY, MONTHLY), and existing alerts keep their one interval. Per-stock states and triggers gain an interval column. It is part of each trigger's unique key, because a daily and a weekly candle can share a timestamp.
  • Checking: each interval runs the rule on its own candles, with its own state per stock. Windows and quiet periods count that interval's candles. Outcomes, baselines and the scheduled job queue follow each trigger's or state's interval.
  • Changing intervals is not a rule change. Intervals you keep carry on where they were, an added one gets its own baseline, a dropped one loses its states, and past triggers stay.
  • Validation: a condition's timeframe must not be shorter than any of the alert's intervals. For example, a weekly RSI cannot run on monthly candles. The builder only offers timeframes that suit them all.
  • Preview: it tests one interval at a time. With several ticked, a Daily | Weekly toggle picks which one.
  • Pages:
    • Alert cards say "Daily and weekly".
    • Each stock shows its most telling state across the intervals, and names the intervals when that state holds on only some of them ("Matches now · Weekly"), on the alert's stock list and on the stock page.
    • Stock counts count each stock once.
  • Email: a digest that mixes intervals says "Intervals: Daily, Weekly" and labels each stock with its interval. The Polish translation is included.
  • Assistant: drafts take "intervals": [...], and a single "interval" is still read. The reference and recipes are updated.

Testing

  • Full Java suite: 1130 tests, 0 failures, 33 skipped. A new integration test (an alert on daily + weekly: separate states and triggers, folded views, dropping an interval, timeframe validation) and the digest and assistant tests passed in a later run.
  • JS: all 146 tests pass. New tests cover the Fibonacci direction (it fails on the old code), the interval chips, the preview toggle and the state labels.
  • Browser:
    • Fibonacci: a retracement drawn on AAPL showed 1 at the low and 0 at the high.
    • Custom alerts: a daily-and-weekly alert was created, edited and tested on weekly candles, and its states showed per interval. This ran on a temporary schema, so V101 never ran on the shared dev schema. Phone width and light theme were checked too.

🤖 Generated with Claude Code

JanGrad and others added 2 commits November 8, 2026 16:27
The drawing tool put 0 at the first click and 1 at the second, the reverse
of TradingView, MetaTrader and the app's own Auto Fib indicator. On a swing
from 100 to 130 the line labelled 0.618 sat at 118.54, a 38.2% pullback.
Now 1 is at the first point and 0 at the second, so a level reads as the
share of the move given back; Reverse gives the old layout.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
"Check after every" in the builder becomes three chips (daily, weekly,
monthly close); any of them can be ticked. The alert stays one rule:
editing, pausing and its watchlists apply to every interval.

- V101: custom_alerts.interval becomes an intervals array; states and
  triggers gain an interval column, part of a trigger's key (a daily and
  a weekly candle can share a timestamp). Existing alerts keep theirs.
- The engine runs each interval on its own candles with its own state per
  stock; outcomes, baselines and the job queue follow the trigger's or
  state's interval. A digest mixing intervals names each stock's.
- Pages show a stock's most telling state across the intervals and name
  the intervals when it holds on only some ("Matches now · Weekly").
- Adding or dropping an interval is not a rule change: the kept intervals
  go on, an added one gets its baseline, history stays.
- A condition's timeframe must not be shorter than any of the intervals.
- The preview tests one interval at a time, with a toggle when several
  are ticked.
- The assistant drafts take "intervals" (a single "interval" still reads).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@JanGradkowski
JanGradkowski enabled auto-merge (squash) November 8, 2026 15:31
aPrefetchWaitsForItsDownloadAndACheckArrivingMeanwhileJoinsIt released
the download before the check asked for the same candles. A fast download
thread then finished and left the in-flight map first, so the check started
a second download (2 requests instead of 1). It failed CI on main on
7 November and on #48. The release now comes 300 ms after the check asks,
when it is already waiting on the running download.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@JanGradkowski
JanGradkowski merged commit b657b27 into main Nov 8, 2026
2 checks passed
@JanGradkowski
JanGradkowski deleted the multi-interval-custom-alerts branch November 8, 2026 15:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants