> ## Documentation Index
> Fetch the complete documentation index at: https://docs.aioka.io/llms.txt
> Use this file to discover all available pages before exploring further.

# TradingView Integration

> Overlay AIOKA AI signals on any BTC chart with the free Pine Script v5 indicator

<Note>
  The AIOKA Pine Script indicator is **free** on TradingView. It requires an
  AIOKA API key to fetch live signals.
  [Get a free key →](/api-reference/keys/generate)
</Note>

## What The Indicator Shows

The AIOKA Pine Script indicator overlays these signals on any BTC chart:

* **ACCUMULATE / REDUCE labels** above and below candles when the Judiciary
  verdict flips
* **Ghost Trader entry / exit markers** — gold triangles at the exact bars the
  internal paper-trading engine opens and closes positions
* **Regime background color** — a subtle tint reflecting the current HMM regime
  (bull trend, low volatility, whale accumulation, etc.)
* **EMA 200 overlay** — the exact 1H EMA(200) Ghost Trader uses, not a
  TradingView recomputation
* **Bottom info panel** — a compact table in the lower-right showing:
  * Verdict
  * Confidence %
  * Dark Pool score (0-100)
  * 1H RSI
  * Ghost Trader status

## Installation

<Steps>
  <Step title="Get a free AIOKA API key">
    Generate a key at [api.aioka.io/v1/keys/generate](https://api.aioka.io/v1/keys/generate).
    Save the value — it is shown once.
  </Step>

  <Step title="Open the Pine Editor on TradingView">
    On any chart, click **Pine Editor** at the bottom of the screen.
  </Step>

  <Step title="Paste the indicator source">
    Copy the source from
    [`aioka-signals.pine`](https://github.com/aioka-io/aioka/blob/main/docs/tradingview/aioka-signals.pine)
    into the Pine Editor and click **Save**, then **Add to chart**.
  </Step>

  <Step title="Paste your API key">
    In the indicator settings, paste your key into the **API Key** field.
  </Step>
</Steps>

## Free vs Paid Limits

| Tier      | Daily calls | Per-minute | Price    |
| --------- | ----------- | ---------- | -------- |
| **Free**  | 100         | 2          | \$0      |
| **Basic** | 1,000       | 30         | \$49/mo  |
| **Pro**   | 10,000      | 100        | \$199/mo |

The indicator polls `GET /v1/tradingview/signal` once per bar close. On a 1H
chart that is 24 calls/day — well inside the Free tier. On a 1m chart you will
burn through 100 calls in under two hours; upgrade to **Basic** to stay live
around the clock.

## How The Data Gets Into Pine Script

Pine Script v5 cannot issue arbitrary HTTP requests, so AIOKA publishes its
signals as a set of numeric symbols under the `AIOKA:*` namespace:

| Symbol             | Value                                |
| ------------------ | ------------------------------------ |
| `AIOKA:VERDICT`    | Numeric ruling code (-3 … +3)        |
| `AIOKA:CONFIDENCE` | 0-100 composite confidence           |
| `AIOKA:DARK_POOL`  | 0-100 dark pool score                |
| `AIOKA:RSI`        | BTC 1H RSI(14)                       |
| `AIOKA:EMA200`     | BTC 1H EMA(200)                      |
| `AIOKA:REGIME`     | Numeric regime code                  |
| `AIOKA:GHOST`      | 0 WAITING / 1 READY / 2 IN\_POSITION |

The indicator uses `request.security()` to pull each of these series. Your API
key authenticates your AIOKA publisher account so TradingView can serve the
feed to your chart; the key is **never transmitted from your browser** to an
external host.

## Alerts

The indicator exposes four native TradingView alerts you can wire into your
normal notification flow (email, SMS, webhook, push):

* **Ghost Trader Entered** — fires at the bar Ghost opens a new position
* **Ghost Trader Exited** — fires at the bar Ghost closes a position
* **Bullish Verdict Flip** — fires when the verdict becomes STRONG\_BUY / BUY /
  ACCUMULATE
* **Bearish Verdict Flip** — fires when the verdict becomes REDUCE / SELL /
  STRONG\_SELL

To enable, right-click on the chart → **Add Alert** → pick the condition from
the `AIOKA AI Signals` group.

## Screenshots

<Frame caption="BTC 1H chart with AIOKA AI Signals — ACCUMULATE label fires below a Ghost Trader entry">
  *Screenshot placeholder — see docs.aioka.io/tradingview for latest rendering.*
</Frame>

## Troubleshooting

<AccordionGroup>
  <Accordion title="The indicator shows 'n/a' on every field">
    The indicator is waiting for the `AIOKA:*` feed to publish its first bar.
    Give it one full hour after installation.
  </Accordion>

  <Accordion title="I get a '429 rate limit exceeded' alert">
    You are polling faster than your tier allows. Switch to a higher timeframe
    (1H is enough for 24 calls/day) or upgrade your API key tier.
  </Accordion>

  <Accordion title="Ghost Trader markers never appear">
    The internal Ghost Trader engine is only active on BTC. If you load the
    indicator on ETH / SOL / other charts the gold triangles will be quiet
    until the multi-asset council spec ships.
  </Accordion>
</AccordionGroup>

## Related Endpoints

* [`GET /v1/tradingview/signal`](/api-reference/tradingview/signal) — the raw
  feed the indicator consumes
* [`GET /v1/verdict/latest`](/api-reference/verdict/latest) — full Judiciary
  verdict including explanation context
* [`GET /v1/ghost/status`](/api-reference/ghost/status) — Ghost Trader 7/7
  gate breakdown
