Skip to content

Compare other symbols on the main chart - #10

Merged
Kernel-Hunter merged 1 commit into
mainfrom
compare-symbols
Nov 3, 2026
Merged

Kernel-Hunter merged 1 commit into
mainfrom
compare-symbols

Conversation

@Kernel-Hunter

Copy link
Copy Markdown
Owner

Adds a Compare button to the top bar. It draws up to 5 other symbols as lines over the main chart, for example ETH and SOL over BTC.

How it works

  • Each line is matched to the chart's bars by time and scaled to start at the chart's price at the left edge. When the visible range changes, the lines are rescaled in the same call, before the price axis is sized, so the axis fits them.
  • The first compared symbol switches a normal price scale to percent, so the chart and every line read as change since the left edge. Removing the last one switches it back, unless the scale was changed by hand in between. That flag is saved with the layout.
  • Series load through the same feeds as request.security, so a symbol used by both a script and a compare line is fetched once. Any source works, including the keyed ones and CSV.
  • The legend shows each symbol's real price and change under the crosshair. Clicking Compare again lists the lines with their change and a remove button.

Saved and shared

  • Compared symbols are saved in the layout.
  • Share links carry them with the indicators, in a new c field. Only keyless sources go into a link. Keyed and CSV ones are left out with a note, and a link edited to include one drops it instead of using the viewer's key. Older versions ignore the field.
  • Embeds draw them too.

Agents

New tools add_compare and remove_compare (28 tools now). get_chart_state lists the compared symbols with last price and change. window.kandle.compare has list, add, remove and clear.

Docs and tests

Docs: the README features list, a Compare symbols section with a screenshot, the tool table, the Chinese README and the agent skill.

Tests cover the alignment and rescaling math, the controller against a fake chart, layout sanitizing, share link round trips and hostile input, the shared view, embeds and the new handlers. I also checked it in Chromium at 1600x1000, 1400x850 and 390x844, and an embed at 800x450.

Compare in the top bar draws up to 5 other symbols as lines over the
main chart. Each line starts at the chart's price at the left edge and
follows its own percent changes, so the lines are rescaled as the chart
scrolls. The first one switches a normal price scale to percent and the
last one switches it back.

Compared symbols are saved with the layout, travel with the indicators
in share links and embeds (keyless sources only), and agents get
add_compare and remove_compare, with the list in get_chart_state.
@Kernel-Hunter
Kernel-Hunter merged commit c771af5 into main Nov 3, 2026
2 checks passed
@Kernel-Hunter
Kernel-Hunter deleted the compare-symbols branch November 3, 2026 12:55
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.

1 participant