> For the complete documentation index, see [llms.txt](https://nytshift.gitbook.io/nytshift-docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://nytshift.gitbook.io/nytshift-docs/release-and-readiness/tradingview-advanced-charts.md).

# TradingView Advanced Charts

This runbook activates the licensed self-hosted Advanced Charts runtime. It does not obtain a license, grant TradingView repository access, enable execution or authorize a wallet.

## Approved source

Use only a `charting_library` directory obtained through TradingView's approved private repository access. NIGHTSHIFT currently reviews major v32. Do not use a public npm package, CDN, copied website bundle, demo iframe or third-party mirror.

Official references:

* <https://www.tradingview.com/charting-library-docs/latest/quick-start/>
* <https://www.tradingview.com/charting-library-docs/latest/getting_started/Package-Content/>
* <https://www.tradingview.com/charting-library-docs/latest/saving_loading/save-load-adapter/>

## Inspect without installing

From the repository root:

```powershell
pnpm advanced-charts:inspect -- --source C:\private\tradingview\charting_library
```

Record the reported version, file count, byte count and tree SHA-256 in the private release evidence. A version, package-shape, symlink or byte-budget error stops the release.

## Atomic installation

The operator must personally confirm that the source is the officially licensed package:

```powershell
pnpm advanced-charts:install -- --source C:\private\tradingview\charting_library --confirm-official-license
```

The fixed destination is `apps/web/public/charting_library`. It is intentionally Git-ignored. For an approved upgrade of an existing private installation, inspect first and then add `--replace`; the installer stages the new tree and preserves the prior tree until promotion succeeds.

Set the supervised web-process environment only after the install output is retained:

```
NIGHTSHIFT_ADVANCED_CHARTS_MODE=licensed
```

Do not add a source path, token or TradingView credential to `.env.example`, browser storage, logs or release markers. Leave `NIGHTSHIFT_ADVANCED_CHARTS_PRODUCTION_EVIDENCE_PATH` unset for the first candidate start; asset integrity must be observable before rehearsal evidence can be created.

## Release gates

Run the normal repository gates and build only after the private assets are present:

```powershell
pnpm preflight
pnpm --filter @terminal/web test
pnpm --filter @terminal/web typecheck
pnpm --filter @terminal/web build
pnpm handoff:check
```

Promote/restart the candidate under the normal immutable release workflow. `/api/health` must report `advancedChartsState=ready`, the expected v32 version and the recorded tree hash while `advancedChartsProductionEvidenceState=unconfigured`. It must still report both execution modes disabled and both mainnet flags false. A ready tree is only the authority to begin rehearsal.

In desktop and 390px mobile browser QA, verify:

1. The native left drawing toolbar is visible and usable.
2. Symbol changes and every supported interval use NIGHTSHIFT UDF/provider history rather than a demo feed.
3. Pan, wheel zoom, pinch zoom, reset, indicators and full history ranges work.
4. Layouts and study templates survive reload; drawings retained inside a saved layout survive reload. Do not claim the separate Trading Platform-only chart/drawing-template UI.
5. The risk drawer remains collapsible and does not cover the drawing rail.
6. `NIGHTSHIFT CHART` returns to the complete custom fallback.
7. No console, CSP, iframe, asset, overflow or accessibility error appears.

## Retain exact production rehearsal

Create an absolute checklist outside the repository. It must contain exactly this scope, fresh observed/expiry timestamps and every check set to `true` only after direct observation:

```json
{
  "environment": "production",
  "origin": "https://nytshift.xyz",
  "observedAtMs": 0,
  "expiresAtMs": 0,
  "requiredResolutions": ["1", "5", "15", "60", "240", "1D"],
  "requiredIndicators": ["SMA", "EMA", "VWAP", "RSI", "MACD", "Bollinger Bands", "ATR", "Volume"],
  "checks": {
    "assetManifestMatchesRuntime": true,
    "cspNoViolations": true,
    "customFallbackRestored": true,
    "datafeedProviderOnly": true,
    "desktop1280": true,
    "drawingToolInteraction": true,
    "drawingToolbarVisible": true,
    "fullHistoryRange": true,
    "indicatorDialog": true,
    "layoutPersistence": true,
    "liveStreaming": true,
    "mobile390": true,
    "nativeWidgetLoaded": true,
    "noHorizontalOverflow": true,
    "pan": true,
    "pinchZoom": true,
    "requiredIndicators": true,
    "requiredResolutions": true,
    "riskDrawerDoesNotObstruct": true,
    "symbolSwitch": true,
    "timezoneAndSession": true,
    "udfProviderHistory": true,
    "wheelZoom": true,
    "websocketReconnectAndGapRepair": true,
    "wwwRedirectsToApex": true,
    "zeroConsoleErrors": true,
    "zeroPageErrors": true
  }
}
```

`expiresAtMs` must be after `observedAtMs` and no more than 30 days later. Generate the private document by joining that checklist to the exact public release and chart-tree health:

```powershell
pnpm charts:evidence -- create --input C:\private\nytshift\advanced-charts-checklist.json --origin https://nytshift.xyz --output C:\private\nytshift\advanced-charts-production.json
pnpm charts:evidence -- verify --evidence C:\private\nytshift\advanced-charts-production.json --origin https://nytshift.xyz
```

Install that document on the web host as a regular private file readable only by the supervised `nytshift` identity, set its absolute path in `NIGHTSHIFT_ADVANCED_CHARTS_PRODUCTION_EVIDENCE_PATH`, and restart without changing the licensed asset tree or release. Health must now report `advancedChartsProductionEvidenceState=verified`, a future expiry, the same release/tree and no path/checklist content. `pnpm activation:audit --origin https://nytshift.xyz` must make `nativeCharts` ready. A new release or asset tree requires a new rehearsal; an expired or mismatched document never preserves readiness.

## Fail closed and rollback

Any manifest, version, file-set, hash, evidence or runtime load error must leave the custom NIGHTSHIFT chart available. For immediate rollback, set `NIGHTSHIFT_ADVANCED_CHARTS_MODE=disabled`, unset `NIGHTSHIFT_ADVANCED_CHARTS_PRODUCTION_EVIDENCE_PATH`, rebuild/restart the supervised web process and prove both chart states are `unconfigured`. Do not delete the prior asset tree or rehearsal document during an incident; preserve them privately for checksum and license review.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://nytshift.gitbook.io/nytshift-docs/release-and-readiness/tradingview-advanced-charts.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
