Home >> (Table of Contents) Data and Trading Communications (DTC) Protocol >> DTC Messages and Procedures >> Sierra Chart Custom
Sierra Chart Custom
- HISTORICAL_TRADES_REQUEST
- HISTORICAL_TRADES_RESPONSE
- HISTORICAL_TRADES_REJECT
- REPLAY_CHART_DATA
- REPLAY_CHART_DATA_PERFORM_ACTION
- REPLAY_CHART_DATA_STATUS
HISTORICAL_TRADES_REQUEST [s_HistoricalTradesRequest structure] Client >> Server
This is a message from the Client to the Server to request trades for a given symbol and trade account. A trade consists of an opening trade order fill and a closing trade order fill which constitute a single trade.
A trade can be long or short.
Field Name | Field Description |
---|---|
[unsigned int16] Size |
The standard message size field. Automatically set by constructor. |
[unsigned int16] Type |
The standard message type field. Automatically set by constructor. Value: 10100. |
[int32] RequestID |
A unique request identifier. The Server will return the same identifier in the HISTORICAL_TRADES_RESPONSE response. |
[char] Symbol |
Leave empty if want all trades for all symbols for the specified TradeAccount. Otherwise, request trades for given Symbol identifier. |
[char] TradeAccount |
This specifies the particular Trade Account to request trades for. |
[t_DateTime] StartDateTime |
The StartDateTime field specifies to the Server to return trades starting with the date-time specified. |
HISTORICAL_TRADES_RESPONSE [s_HistoricalTradesResponse structure] Server >> Client
This is a message from the Server to the Client providing an individual trade in response to a HISTORICAL_TRADES_REQUEST message.
The Server is expected to send this message to the Client in response to a HISTORICAL_TRADES_REQUEST message even when there are no trades to return.
Field Name | Field Description |
---|---|
[unsigned int16] Size |
The standard message size field. Automatically set by constructor. |
[unsigned int16] Type |
The standard message type field. Automatically set by constructor. Value: 10102. |
[int32] RequestID |
The RequestID specified in the HISTORICAL_TRADES_REQUEST message from the Client. |
[char] Symbol |
The symbol the trade is for. |
[char] TradeAccount |
This is the trade account that the trade associated with. |
[t_DateTime] EntryDateTime |
This is the Date and Time of the trade entry. |
[t_DateTime] ExitDateTime |
This is the Date and Time of the trade exit. |
[double] EntryPrice |
This is the price of the trade entry. |
[double] ExitPrice |
This is the price of the trade entry. |
[BuySellEnum] TradeType |
The side for the entry fill. Either Buy or Sell. |
[double] EntryQuantity |
This is the quantity of the trade entry. |
[double] ExitQuantity |
This is the quantity of the trade exit. |
[double] MaxOpenQuantity |
This is the maximum quantity of the trade. |
[double] ClosedProfitLoss |
This is the profit/loss for the trade. |
[double] MaximumOpenPositionLoss |
This is the maximum loss during the life of the trade. |
[double] MaximumOpenPositionProfit |
This is the maximum profit during the life of the trade. |
[double] Commission |
This is the commission for the trade. |
HISTORICAL_TRADES_REJECT [s_HistoricalTradesReject structure] Server >> Client
If the Server is unable to serve the request for a HISTORICAL_TRADES_REQUEST message received, for a reason other than there not being any historical trades, then send this message to the Client.
Field Name | Field Description |
---|---|
[unsigned int16] Size |
The standard message size field. Automatically set by constructor. |
[unsigned int16] Type |
The standard message type field. Automatically set by constructor. Value: 10101. |
[int32] RequestID |
This is set to the RequestID field sent in the HISTORICAL_TRADES_REQUEST message. |
[char] RejectText |
Free-form text indicating the reason for rejection. |
REPLAY_CHART_DATA [s_ReplayChartData structure] Client >> Server
The REPLAY_CHART_DATA message is used to request the replay of data which is sent over the DTC Protocol Server port.
The replay data is sent using the HISTORICAL_PRICE_DATA_RECORD_RESPONSE message.
The data is served from the historical Intraday data file for the symbol. Only the data that is contained within the existing historical Intraday data file for the symbol will be served.
It is possible also to submit ordersthrough the DTC Server for the symbol being replayed that will be filled using the pricing from this replaying data. When submitting an order to the DTC Server, it is necessary to associate it with the replaying data for it to fill using that replaying data. The following fields need to be set on the submitted order:
- TradeAccount: Must match the TradeAccount field specified with the REPLAY_CHART_DATA message.
- ForDataReplay: Set to 1. Currently only supported with JSON encoding.
- ReplaySymbol: Must match the Symbol field specified with the REPLAY_CHART_DATA message. Currently only supported with JSON encoding.
- SubAccountIdentifier: Must match the SubAccountIdentifier field specified with the REPLAY_CHART_DATA message. Currently only supported with JSON encoding.
It is also supported to submit option orders that will be filled using option price data generated from this replaying data. The option prices are calculated using the standard Black Scholes model.
The options symbol format is [Underlying]-[Strike]-[CP (Call or Put)]-[YYYYMM]-STK_OPT-[Exchange (optional)].
It is also supported to submit options spread orders where the Symbol is formatted using the Custom Calculated Symbols format. Therefore, these symbols must be entered into the Sierra Chart Global Symbol Settings as documented on the Custom Calculated Symbols page.
Field Name | Field Description |
---|---|
[unsigned int16] Size |
The standard message size field. Automatically set by constructor. |
[unsigned int16] Type |
The standard message type field. Automatically set by constructor. Value: 10104. |
[unsigned int32] RequestID |
A unique request identifier for the replay session. |
[char] Symbol |
The symbol to be replayed. |
[char] TradeAccount |
The trade account identifier that submitted orders using the replay data are associated with. |
[char] TimeZone |
The time zone as a POSIX text string. Example: "EST-05EDT+01,M3.2.0/02:00,M11.1.0/02:00". The time zone applies to the following fields: StartDateTimeForInitialData, StartDateTime, StopDateTime, SessionBeginTimeInSeconds, SessionEndTimeInSeconds. |
[t_DateTimeWithMilliseconds] StartDateTimeForInitialData |
The data replay functionality supports sending initial data immediately without any delay and without any regard to the replay speed. This field specifies the starting Date-Time for that data. The time zone of this field is according to the TimeZone field. |
[t_DateTimeWithMilliseconds] StartDateTime |
The starting Date-Time of the data to be replayed. This data is replayed according to the ReplaySpeed variable. The time zone of this field is according to the TimeZone field. |
[t_DateTimeWithMilliseconds] StopDateTime |
The last or final Date-Time of the data to be replayed. The replaying data stops at this Date-Time. The time zone of this field is according to the TimeZone field. |
[unsigned int16] SessionBeginTimeInSeconds |
The session begin time for historical data price records during the replay generated according to the BarTimeInSeconds field. This is an seconds since midnight. Valid values are 0 to 86399. For example, if this is set to 0, then the underlying trade data, beginning at midnight will be used to generate historical data price records. The time zone of this field is according to the TimeZone field. |
[unsigned int16] SessionEndTimeInSeconds |
The session end time for historical data price records during the replay generated according to the BarTimeInSeconds field. This is an seconds since midnight. Valid values are 0 to 86399. For example, if this is set to 86399, then the underlying trade data up until the end of the day (23:59:59.999) will be used to generate historical data price records. The time zone of this field is according to the TimeZone field. |
[float] ReplaySpeed |
The speed of the replay. This value can be .1 to 100000. |
[int32] BarTimeInSeconds |
The replay data is transmitted in specific timeframe sub-units of data. This field is the timeframe of the sub-unit of data in seconds. |
[unsigned int8] PauseReplayAfterInitialDataSent |
When PauseReplayAfterInitialDataSent is set to 1, then when the data beginning with the StartDateTimeForInitialData field is sent to the Client, then the replay will be paused at the StartDateTime field Date-Time. |
[unsigned int8] UseSavedPriorState |
When a replay is started using the message REPLAY_CHART_DATA, and if the Client closes the connection before the replay finishes, then the prior state is remembered. This data includes the last served Date-Time and the SubAccountIdentifier field. When UseSavedPriorState is set to 1 and the prior replay did not finish, then the replay will will continue from the last previously served Date-Time and the SubAccountIdentifier will remain the same and will override any new SubAccountIdentifier specified with the REPLAY_CHART_DATA message. |
[float] SymbolVolatility |
Used to calculate option prices. |
[float] InterestRate |
Used to calculate option prices. |
[int32] NumberOfOrdersToTriggerFinishToStopDateTime |
If this is a nonzero value, then after this number of orders is submitted during a replay session, the replay will complete automatically quickly until the specified StopDateTime field. To not use this feature, set this field to 0 which is the default. |
[int32] MaximumNumberOfOrdersPerReplaySession |
If this is set to a nonzero number, it represents the maximum maximum number of orders that can be submitted during the replay session. When this number is reached, the replay immediately completes. |
[int32] NumberOfDaysForInitialDataFromBeforeLastSavedDateTime |
When starting a replay that did not previously finish, this specifies the number of days of data for the symbol, before the last saved Date-Time of the prior replay, that will be immediately sent. |
[unsigned int32] SubAccountIdentifier |
A number from 1 to the maximum value of an integer specifying an identifier which associates trading activity, which includes order fills, performed with the replaying data. This additional identifier is in addition to the TradeAccount. |
[int32] OptionsPriceSendIntervalInSeconds |
This specifies the send interval in seconds when sending option prices generated from the underlying replay data. Option prices are only generated, for option orders submitted in relation to the replaying data. |
REPLAY_CHART_DATA_PERFORM_ACTION [s_ReplayChartDataPerformAction structure] Client >> Server
The REPLAY_CHART_DATA_PERFORM_ACTION message is used to subsequently control the replay after it has been started with the REPLAY_CHART_DATA message.
Field Name | Field Description |
---|---|
[unsigned int16] Size |
The standard message size field. Automatically set by constructor. |
[unsigned int16] Type |
The standard message type field. Automatically set by constructor. Value: 10105. |
[unsigned int32] RequestID |
A unique request ID value for this request. |
[ReplayChartDataActionEnum (int32)] Action |
Can be one of the following values.
|
[float] ReplaySpeed |
The new replay speed if the speed is being changed when the Action field is set to REPLAY_CHART_DATA_ACTION_CHANGE_SPEED = 5. |
REPLAY_CHART_DATA_STATUS [s_ReplayChartDataStatus structure] Server >> Client
The REPLAY_CHART_DATA_STATUS message is from the Server to the Client indicating the status of the replay started with the REPLAY_CHART_DATA message.
Field Name | Field Description |
---|---|
[unsigned int16] Size |
The standard message size field. Automatically set by constructor. |
[unsigned int16] Type |
The standard message type field. Automatically set by constructor. Value: 10106. |
[unsigned int32] RequestID |
The request identifier (RequestID) specified in the REPLAY_CHART_DATAmessage. |
[char] ErrorMessage |
An optional error message text field in the case of an error (Status=REPLAY_CHART_DATA_STATUS_ERROR). |
[ReplayChartDataStatusEnum (int32)] Status |
Can be one of the following values.
|
[unsigned int32] SubAccountIdentifier |
The SubAccountIdentifier specified in the REPLAY_CHART_DATA message. |
*Last modified Wednesday, 22nd February, 2023.