Skip to content

IndiChart Protocol ​

This page defines the chart-data messages emitted by the dxLink IndiChart channel service. Channel setup, subscription, configuration, and indicator status messages are part of the dxLink service API. See IndiChart service.

1. Snapshot flow ​

An initial snapshot is ordered as follows:

  1. One or more INDICHART_CANDLE_SNAPSHOT messages.
  2. Zero or more INDICHART_INDICATORS_SNAPSHOT data messages.
  3. Exactly one empty INDICHART_INDICATORS_SNAPSHOT end marker.

Candle snapshot messages contain:

  • candles: candle data in the negotiated market-data format;
  • reset=true only on the first candle batch;
  • pending=true while more candle batches remain.

Every indicator data message has pending=true. The end marker is always:

json
{
  "pending": false,
  "indicators": {}
}

Clients must use that marker—not the last non-empty indicator message—to complete the indicator snapshot. It is emitted even when no indicators are configured or every indicator calculation fails.

1.1. Snapshot example ​

The following example uses a full candle format with volume as the negotiated candle field. The message type labels are not part of the JSON payload.

INDICHART_CANDLE_SNAPSHOT begins the snapshot:

json
{
  "pending": true,
  "reset": true,
  "candles": [{ "volume": 1000 }, { "volume": 1200 }]
}

The final candle batch clears pending and does not reset client state:

json
{
  "pending": false,
  "reset": false,
  "candles": [{ "volume": 1100 }]
}

Each INDICHART_INDICATORS_SNAPSHOT data message remains pending:

json
{
  "pending": true,
  "indicators": {
    "sma": {
      "output": {
        "sma": [100.0, 100.5, 101.0]
      }
    }
  }
}

The empty INDICHART_INDICATORS_SNAPSHOT end marker completes the snapshot:

json
{
  "pending": false,
  "indicators": {}
}

2. Updates ​

After the snapshot, INDICHART_UPDATE messages carry both candles and indicators. Updates may be batched; pending=false marks the final message of an update batch.

2.1. Update batch example ​

Every INDICHART_UPDATE message includes both channels. This two-message batch carries one candle and its aligned indicator values in each message:

json
{
  "pending": true,
  "candles": [{ "volume": 1300 }],
  "indicators": {
    "sma": {
      "output": {
        "sma": [101.5]
      }
    }
  }
}
json
{
  "pending": false,
  "candles": [{ "volume": 1400 }],
  "indicators": {
    "sma": {
      "output": {
        "sma": [102.0]
      }
    }
  }
}

3. Indicator payload ​

indicators is keyed by indicator name. Each successful calculation may contain these channels:

ChannelShape
outputNamed arrays of numbers
splineNamed arrays of spline samples
shapeNamed arrays of shape samples
backgroundColorNamed arrays of color samples
barColorIndex-keyed arrays of color samples

All channel arrays align with the candle slice in the same message. Missing values are serialized as null, including padding when a result is shorter than its batch.

3.1. Samples and metadata ​

A spline sample always has value; it may also carry color. Its static metadata is title, style, offset, and overlay.

A shape sample always has value; it may also carry color, textColor, and text. Its static metadata is title, style, location, offset, and overlay.

A color sample has color, which may be null. Static color metadata is title, offset, numberOfLast, and overlay.

Static metadata is normally present on the first sample and omitted from later samples. Clients retain it for the series. Optional dynamic fields may also be omitted; clients retain the last transmitted value when required by the corresponding dxScript output contract.

Colors use an object with a required value and optional alpha, for example:

json
{ "value": "red", "alpha": 128 }

3.2. Indicator channel example ​

This indicator payload has three aligned samples per channel. Where required by the corresponding dxScript output contract, omitted metadata and dynamic fields retain their prior values; null denotes an absent sample or an explicit color clear.

json
{
  "trendAndSignals": {
    "output": {
      "sma": [100.0, 100.5, null]
    },
    "spline": {
      "trend": [
        {
          "value": 100.0,
          "title": "Trend",
          "style": "CROSS",
          "offset": -1,
          "overlay": true,
          "color": { "value": "red", "alpha": 128 }
        },
        { "value": 100.5 },
        null
      ]
    },
    "shape": {
      "entry": [
        {
          "value": 100.5,
          "title": "Entry",
          "style": "CROSS",
          "location": "ABOVE_BAR",
          "offset": 0,
          "overlay": true,
          "color": { "value": "green" },
          "textColor": { "value": "white" },
          "text": "Buy"
        },
        { "value": 101.0 },
        null
      ]
    },
    "backgroundColor": {
      "session": [
        {
          "color": { "value": "yellow", "alpha": 128 },
          "title": "Session",
          "offset": 0,
          "numberOfLast": 2,
          "overlay": true
        },
        { "color": null },
        null
      ]
    },
    "barColor": {
      "0": [
        {
          "color": { "value": "green" },
          "title": "Signal",
          "offset": 0,
          "numberOfLast": 1
        },
        { "color": null },
        null
      ]
    }
  }
}

4. Failure semantics ​

An indicator whose calculation failed is omitted from the data payload. The service reports disabled indicators through its indicator-status message after the snapshot end marker or before update data, as applicable. A calculation failure must not change snapshot termination semantics.

See also ​