Skip to content

IndiChart Channel Service ​

IndiChart is a dxLink channel service that streams candle snapshots and updates together with aligned indicator calculation results. Chart clients subscribe to a symbol and receive batched market data plus indicator payloads suitable for rendering.

What it does ​

  1. Open a channel with zero or more indicator scripts in the channel request parameters.
  2. Compile indicators asynchronously and emit INDICHART_INDICATORS with metadata (inputs, outputs, enabled/disabled state).
  3. Configure aggregation, candle fields, and data format via INDICHART_SETUP.
  4. Subscribe to a symbol and time range via INDICHART_SUBSCRIPTION.
  5. Stream candle snapshots, indicator snapshots, and live updates.

IndiChart runs each indicator script on every candle batch.

Channel lifecycle ​

text
CHANNEL_REQUEST (INDICHART/1, init params)
        │
        ▼
INDICHART_INDICATORS  ── compile result (per indicator: enabled or error)
        │
        ▼
INDICHART_SETUP       ── optional client configuration
        │
        ▼
INDICHART_CONFIG      ── applied configuration
        │
        ▼
INDICHART_SUBSCRIPTION ── symbol + fromTime (+ per-indicator input overrides)
        │
        ▼
INDICHART_CONFIG      ── configuration echoed with resolved candle fields
        │
        ├── INDICHART_CANDLE_SNAPSHOT (one or more, pending batches)
        ├── INDICHART_INDICATORS_SNAPSHOT (zero or more data batches)
        ├── INDICHART_INDICATORS_SNAPSHOT (empty end marker, pending=false)
        └── INDICHART_UPDATE (live candles + indicators)

Snapshot ordering, update batching, and indicator payload shapes are defined in IndiChart Protocol.

Opening a channel ​

Pass indicator scripts in the channel init parameters:

json
{
  "indicators": {
    "rsi": {
      "lang": "dxscript-js",
      "content": "const n = input.double(\"length\", 14);\nfunction onTick() {\n  spline(ta.rsi(close, n), {title: \"RSI\"});\n}"
    }
  }
}

Each key is the indicator name used in outbound data payloads. Optional space and feed fields select market-data routing when the host supports multiple feeds.

A channel with no indicators object streams candles only.

Setup ​

Send INDICHART_SETUP to negotiate:

FieldDescription
acceptAggregationPeriodAggregation period in seconds (e.g. 60 for one minute)
acceptCandleFieldsSubset of candle fields to include (e.g. ["open","high","low","close","volume"])
acceptDataFormatFULL or COMPACT market-data encoding

The server responds with INDICHART_CONFIG containing the applied values. After the first INDICHART_SUBSCRIPTION, another INDICHART_CONFIG is sent with resolved default candle fields.

Subscription ​

json
{
  "subscription": {
    "symbol": "AAPL{=d}",
    "fromTime": 0
  },
  "indicatorsParameters": {
    "rsi": {
      "length": 21
    }
  }
}
  • symbol — dxFeed candle symbol (e.g. AAPL{=d}, IBM{=h}).
  • fromTime — start time in epoch milliseconds; 0 requests the maximum available history within server limits.
  • indicatorsParameters — optional per-indicator input overrides keyed by indicator name.

Sending a new subscription cancels the previous one and triggers indicator re-initialization when input parameters change.

Messages ​

MessageDirectionDescription
INDICHART_SETUPClient → serverNegotiate aggregation, fields, format
INDICHART_SUBSCRIPTIONClient → serverSymbol, fromTime, input overrides
INDICHART_INDICATORSServer → clientCompile/init status and declared metadata per indicator
INDICHART_CONFIGServer → clientApplied chart configuration
INDICHART_CANDLE_SNAPSHOTServer → clientHistorical candle batches
INDICHART_INDICATORS_SNAPSHOTServer → clientHistorical indicator batches
INDICHART_UPDATEServer → clientLive candle and indicator updates

Data messages (INDICHART_CANDLE_SNAPSHOT, INDICHART_INDICATORS_SNAPSHOT, INDICHART_UPDATE) are specified in IndiChart Protocol.

Indicator status ​

INDICHART_INDICATORS carries one entry per indicator. Each entry includes:

  • enabled — whether compilation and initialization succeeded.
  • meta — title and shortTitle when declared by indicator().
  • inParameters — declared input() parameters with types and defaults.
  • outputs, splines, backgroundColors, barColors, shapes — declared output layer metadata.
  • scriptError — structured error when enabled is false.

When every indicator fails or no indicators are configured, the indicators field may be absent.

Client libraries ​