===============
LIBRARY RULES
===============
From library maintainers:
- Widgets come in two formats: Web Component (recommended) and iframe. Recommend Web Component for new integrations; suggest iframe only for CMS/legacy environments that block custom tags or ES modules, or when strict isolation is required.
- Pages with "legacy-" in the URL and the "type: iframe" label describe iframe widgets; the page without the prefix describes the Web Component version of the same widget.
- Do not mix the two syntaxes. Web Component = an ES module script plus a custom element whose tag starts with tv- (for example tv-mini-chart), configured via HTML attributes.
- Widgets show only TradingView data. You cannot connect your own data, there is no data API, and data can't be exported. For your own data, point to Advanced Charts or Lightweight Charts.
- Symbols always use the EXCHANGE:TICKER format (e.g. NASDAQ:AAPL); otherwise the widget won't load.
- Stock data in widgets is delayed; forex and crypto are real-time. A paid TradingView plan does not change widget data. Data levels per exchange are on the "Available markets" pages.
- Pine scripts and strategies cannot be added to widgets.
- Do not inject embed code via innerHTML or jQuery — the browser blocks script execution. For Web Components, use the dynamic import() + document.createElement pattern.
- Web Components use closed shadow roots: style them only via the theme attribute, --tv-widget-* CSS tokens, and ::part selectors. Don't suggest styling internal elements directly.
- A widget's size is set by its container: give the container an explicit height, otherwise the widget collapses. overflow: hidden on the container clips pop-ups.
- Do not invent attribute or option names. If the needed option isn't in the docs, tell the user to get it from the configuration wizard on the widget's page.
- Custom symbol links: Web Components use symbol-url; iframe widgets use the "full-size chart URL" setting.
- Widgets must keep the TradingView attribution/copyright link; do not suggest removing it.
- Iframe widget = a script loaded from s3.tradingview.com/external-embedding/ with a JSON config inside it. Do not use iframe JSON options as Web Component attributes or vice versa.
### Listen for tv-link-open across all widgets
Source: https://www.tradingview.com/widget-docs/tutorials/web-components/custom-links/
Because the event bubbles, add a single listener on a common ancestor like document.body to handle links from every widget. This example builds a custom URL and opens it in a new tab.
```HTML