CPlugin

MT5 v2 :: History Data

API v2 (beta) · MT5 · 2 operations · base URL https://cloud.mywebapi.com · OpenAPI v2 (JSON) · Redoc

Every call needs Authorization: Bearer $TOKEN — an OAuth 2.0 client-credentials token from https://auth.cplugin.net/connect/token (scope webapi). $TRADE_PLATFORM_ID is the id of a trade platform registered in Toolbox.

Operations

Get chart bars

GET /api/v2/MT5/{tradePlatform}/ChartRequest/{symbol}

OHLC bars of a symbol for a time window, ordered by time ascending. The trade server keeps history as minutes; bars of a coarser period are aggregated from those minutes on the boundaries of the server's trading time, so a day starts at 00:00 of the server clock. A bar opens with the first minute of the bucket and closes with the last one, its high and low are the extremes of the bucket, tick volume and real volume are summed, and spread is the lowest of the bucket. Buckets without minutes are not produced.

Times are the trading times of the trade server, not UTC: time repeats the seconds-from-1970 value the platform uses, dateTime is the same moment without an offset. Prices are returned as the platform holds them, without rescaling.

from and to are optional: without from the window starts at the beginning of the history, without to it ends at the current server time. limit is 0 by default and returns the whole window; a positive value caps the returned bars and sets truncated. There is no pagination: to read further, repeat the request with from moved past the last returned bar.

The call only reads and changes nothing. When the platform has not received the requested history yet, the call fails with the platform code MT_RET_OK_NONE and a message saying the history is not synchronized — such a request may be repeated later. W1 and MN1 are rejected: such bars are not built.

Timeout: 30 s by default, adjustable per request with the X-Request-Timeout header. When the trade server does not answer in time: Nothing was changed; the request is safe to repeat.

Parameters

NameInTypeRequiredDescription
tradePlatform path string (uuid) yes Trade platform identifier (GUID).
symbol path string yes Symbol name the chart data is requested for.
period query MT5ChartPeriod no Bar period: M1, M5, M15, M30, H1, H4 or D1. Defaults to M1.
from query string (date-time) no Window start, as a trading time of the trade server. Optional — the beginning of the history when omitted.
to query string (date-time) no Window end, as a trading time of the trade server. Optional — the current server time when omitted.
limit query integer (int32) no Maximum number of bars returned; 0 means no limit. Defaults to 0.
X-Request-Timeout header number (double) no How long to wait for the trade server, in seconds (1–300). Default for this operation: 30 s (history or report). The query parameter requestTimeout does the same for clients that cannot set headers. The applied value is returned in the X-Request-Timeout-Applied response header.

Responses

Example

curl "https://cloud.mywebapi.com/api/v2/MT5/$TRADE_PLATFORM_ID/ChartRequest/$SYMBOL" \
  -H "Authorization: Bearer $TOKEN"

Get historical ticks

GET /api/v2/MT5/{tradePlatform}/TicksHistory/{symbol}

Historical ticks of a symbol for a time window, filtered by the symbol's tick filters, ordered by time ascending.

Times are the trading times of the trade server, not UTC: timeMsc and time repeat the millisecond and second values the platform uses, dateTime is the same moment without an offset. Prices are returned as the platform holds them, without rescaling. flags names the set bits of the tick kind, the same way the streaming events do.

from is required — ticks are far denser than bars, and a window without a start would scan the whole stored history. to is optional and defaults to the current server time. limit is 0 by default and returns the whole window; a positive value caps the returned ticks and sets truncated. There is no pagination: to read further, repeat the request with from moved past the last returned tick.

The call only reads and changes nothing. When the platform has not received the requested history yet, the call fails with the platform code MT_RET_OK_NONE and a message saying the history is not synchronized — such a request may be repeated later.

Timeout: 30 s by default, adjustable per request with the X-Request-Timeout header. When the trade server does not answer in time: Nothing was changed; the request is safe to repeat.

Parameters

NameInTypeRequiredDescription
tradePlatform path string (uuid) yes Trade platform identifier (GUID).
symbol path string yes Symbol name the tick data is requested for.
from query string (date-time) yes Window start, as a trading time of the trade server. Required.
to query string (date-time) no Window end, as a trading time of the trade server. Optional — the current server time when omitted.
limit query integer (int32) no Maximum number of ticks returned; 0 means no limit. Defaults to 0.
X-Request-Timeout header number (double) no How long to wait for the trade server, in seconds (1–300). Default for this operation: 30 s (history or report). The query parameter requestTimeout does the same for clients that cannot set headers. The applied value is returned in the X-Request-Timeout-Applied response header.

Responses

Example

curl "https://cloud.mywebapi.com/api/v2/MT5/$TRADE_PLATFORM_ID/TicksHistory/$SYMBOL?from=$FROM" \
  -H "Authorization: Bearer $TOKEN"

Schemas

Types the operations above take and return, with their first-level properties; * marks a required one. The full graph is in the OpenAPI specification.

MT5ChartBarPageApiResponse

Unified v2 response envelope: data is the payload (null on error); error is the error object (null on success, always serialised); meta contains response metadata (activityId and optional paging). HTTP status is always 200.

PropertyTypeDescription
data MT5ChartBarPage Bars of one chart history request, v2 read DTO.
error ApiError v2 error body. Code is the stable transport error code; ManagerCode is the raw MT4 ResultCode (serialized as a string for a known enum member, or as a number for an unrecognised value returned by MT4); Message is a human-readable description.
meta ApiMeta Response metadata. ActivityId identifies the request — quote it when you contact support. Paging is present only on paginated list responses; otherwise it is omitted.

MT5ChartPeriod

Bar period of a chart history request. Coarser bars than a minute are built by the service from the minute history of the trade server, on the boundaries of the trade server's trading time — a day therefore starts at 00:00 of the server clock.

Values: M1, M5, M15, M30, H1, H4, D1, W1, MN1

MT5TickPageApiResponse

Unified v2 response envelope: data is the payload (null on error); error is the error object (null on success, always serialised); meta contains response metadata (activityId and optional paging). HTTP status is always 200.

PropertyTypeDescription
data MT5TickPage Ticks of one history request, v2 read DTO.
error ApiError v2 error body. Code is the stable transport error code; ManagerCode is the raw MT4 ResultCode (serialized as a string for a known enum member, or as a number for an unrecognised value returned by MT4); Message is a human-readable description.
meta ApiMeta Response metadata. ActivityId identifies the request — quote it when you contact support. Paging is present only on paginated list responses; otherwise it is omitted.

MT5ChartBarPage

Bars of one chart history request, v2 read DTO.

PropertyTypeDescription
bars MT5ChartBarV2[] Bars of this page, ordered by time ascending.
total integer (int32) Total number of bars in the requested window.
truncated boolean True when Total exceeds the page and more bars were available than returned.

ApiError

v2 error body. Code is the stable transport error code; ManagerCode is the raw MT4 ResultCode (serialized as a string for a known enum member, or as a number for an unrecognised value returned by MT4); Message is a human-readable description.

PropertyTypeDescription
code WebApiErrorCode Stable transport-level error code.
managerCode ResultCode Raw MT4/MT5 manager result code, when the error came from the trading platform; otherwise null.
message string, nullable Human-readable error description.

ApiMeta

Response metadata. ActivityId identifies the request — quote it when you contact support. Paging is present only on paginated list responses; otherwise it is omitted.

PropertyTypeDescription
activityId string, nullable W3C trace id of the request. Quote it when you contact support: it finds this exact call in the server logs.
paging PagingMeta Pagination info; present only on list responses, omitted otherwise.

MT5TickPage

Ticks of one history request, v2 read DTO.

PropertyTypeDescription
ticks MT5TickV2[] Ticks of this page, ordered by time ascending.
total integer (int32) Total number of ticks in the requested window.
truncated boolean True when Total exceeds the page and more ticks were available than returned.