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
| Name | In | Type | Required | Description |
|---|---|---|---|---|
| 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
- 200 Success — MT5ChartBarPageApiResponse
Example
curl "https://cloud.mywebapi.com/api/v2/MT5/$TRADE_PLATFORM_ID/ChartRequest/$SYMBOL" \
-H "Authorization: Bearer $TOKEN"