fx-chartingDocs
Data

Historical data

Your history function gets a request and returns bars. Any common bar shape works.

The request
history: async ({
  symbol,      // "EURUSD"
  info,        // the full symbol info
  interval,    // "1", "5", "15", "60", "240", "1D", "1W", "1M"
  intervalMs,  // the interval in milliseconds (60 000 for "1")
  to,          // undefined = newest bars; otherwise bars strictly OLDER than this time (ms)
  from,        // suggested start: to − countBack × interval
  countBack,   // how many bars the chart wants (more or fewer is fine)
}) => bars

Accepted bar shapes

js
// arrays (time, open, high, low, close, volume?)
[[1760000000, 1.0852, 1.0861, 1.0848, 1.0857, 1200], …]
// objects — full or short names
[{ time: 1760000000000, open: 1.0852, high: 1.0861, low: 1.0848, close: 1.0857, volume: 1200 }]
[{ t: "2026-10-12T10:00:00Z", o: "1.0852", h: "1.0861", l: "1.0848", c: "1.0857", v: "1200" }]
  • Time in seconds or milliseconds (detected), or an ISO date string.
  • Numbers or numeric strings. Unsorted is fine; duplicates are dropped.
  • Extra fields (bid, ask…) are kept.

Paging

On load the chart asks for the newest bars (to undefined). When the user scrolls left — or a script needs more history — it asks again with to = the oldest bar it has. If your API caps a call (e.g. 1000 bars), return what you can: the datafeed calls you again until it has enough. Return [] when there is no older data.

Scripts (Experts) load up to 10,000 bars before they run. Make sure your history can go back that far, or they'll just run on what's available.