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

# Integrate Sierra Chart with QuanuX via DTC

> Connect Sierra Chart to QuanuX via the DTC protocol. QuanuX acts as DTC client, pulling market data from Sierra Chart and routing orders back through it.

Sierra Chart is a professional desktop trading platform. QuanuX integrates with it through the **Data and Trading Communications (DTC) protocol**: Sierra Chart runs as the DTC server, and the QuanuX extension runs as the DTC client. This lets QuanuX pull live market data from Sierra Chart and send order execution commands back through it, using your existing Sierra Chart data subscriptions and broker connections.

## Data flow

```
Sierra Chart (DTC server) → DTC → QuanuX Extension → QuanuX Core
QuanuX Strategy → QuanuX Core → QuanuX Extension → DTC → Sierra Chart
```

Data moves from Sierra Chart into the QuanuX extension, which forwards it to the QuanuX core over HTTP or WebSocket. Execution commands travel the opposite direction: your strategy tells the core, the core tells the extension, and the extension sends the DTC order to Sierra Chart.

## Setup

<Steps>
  <Step title="Enable the DTC server in Sierra Chart">
    Open Sierra Chart on your machine and configure it as a DTC server:

    1. Go to **Global Settings → Data/Trade Service Settings**.
    2. Click **DTC Protocol Server**.
    3. Check **Enable DTC Protocol Server**.
    4. Note the **Listening Port** — the default is `11099` for historical and market data.
    5. Confirm that the **Encoding** setting is compatible with the extension (JSON encoding is supported).

    <Note>
      Leave Sierra Chart running with the DTC server enabled whenever you want QuanuX to receive data from it.
    </Note>
  </Step>

  <Step title="Configure QuanuX">
    In the QuanuX web interface or desktop app, go to **Settings** and set:

    * **Sierra Chart Host**: `localhost` (or the remote IP if you are using an SSH tunnel — see the remote usage section below)
    * **Sierra Chart DTC Port**: `11099`
    * **Sierra Chart Bridge Key**: generate a local key by clicking **Generate Key** in **Settings → QuanuX Extensions**, then paste it here
  </Step>

  <Step title="Store the bridge key">
    Save the bridge key you generated to the OS keyring so the extension can retrieve it at runtime:

    ```bash theme={null}
    quanuxctl secrets set QUANUX_SIERRA_BRIDGE_KEY "your_generated_key_here"
    ```
  </Step>

  <Step title="Start the extension">
    Export the bridge key into your shell environment and start the extension:

    ```bash theme={null}
    cd extensions/sierra-chart
    export QUANUX_BRIDGE_KEY=$(quanuxctl secrets get QUANUX_SIERRA_BRIDGE_KEY)
    go run main.go
    ```

    The extension connects to Sierra Chart on `localhost:11099` and begins streaming data to the QuanuX core.
  </Step>
</Steps>

## Remote and cloud usage

If you run QuanuX on a cloud server and Sierra Chart on your local desktop machine, the extension cannot reach Sierra Chart directly. Use an **SSH reverse tunnel** to forward the DTC port from your desktop to the cloud server.

<Steps>
  <Step title="Open an SSH reverse tunnel">
    On your local desktop machine, run:

    ```bash theme={null}
    ssh -R 11099:localhost:11099 user@your-quanux-cloud-server
    ```

    This maps port `11099` on the cloud server to port `11099` on your local machine, where Sierra Chart is listening.
  </Step>

  <Step title="Set the host to localhost on the cloud server">
    In QuanuX **Settings**, set **Sierra Chart Host** to `localhost`. The extension on the cloud will connect to `localhost:11099`, which the SSH tunnel forwards to your local Sierra Chart instance.
  </Step>
</Steps>

<Warning>
  Keep the SSH tunnel session alive for as long as you need QuanuX to receive data from Sierra Chart. If the tunnel drops, the extension will lose its connection and need to be restarted after the tunnel is re-established.
</Warning>

## Configuration summary

| Setting                 | Value                        | Notes                                                       |
| ----------------------- | ---------------------------- | ----------------------------------------------------------- |
| Sierra Chart Host       | `localhost`                  | Use `localhost` whether running locally or via SSH tunnel   |
| Sierra Chart DTC Port   | `11099`                      | Default Sierra Chart DTC listening port                     |
| Sierra Chart Bridge Key | Generated in QuanuX Settings | Stored via `quanuxctl secrets set QUANUX_SIERRA_BRIDGE_KEY` |

## Troubleshooting

<AccordionGroup>
  <Accordion title="Extension fails to connect on startup">
    Verify that Sierra Chart is running and that the DTC server is enabled under **Global Settings → Data/Trade Service Settings → DTC Protocol Server**. Also confirm that no firewall is blocking port `11099`.
  </Accordion>

  <Accordion title="No data flowing to QuanuX core">
    Check that you have subscribed to at least one symbol in Sierra Chart. The DTC server only streams data for symbols that Sierra Chart is actively tracking. Also confirm the bridge key in QuanuX **Settings** matches the value stored in `QUANUX_SIERRA_BRIDGE_KEY`.
  </Accordion>

  <Accordion title="SSH tunnel disconnects during trading hours">
    Use `ssh -o ServerAliveInterval=30 -o ServerAliveCountMax=3` with your tunnel command to send keepalive packets and reduce the chance of the tunnel dropping silently.
  </Accordion>
</AccordionGroup>
