Skip to content
All library documents

Using SQLite from MQL5 for Local Trading Data Storage

Article MQL5 articles

Summary

The article introduces SQLite as a local, file-based relational database that lets MQL5 applications use SQL without requiring a separate database server. It outlines SQLite's data types and DLL-based API, then walks through a connector design for opening and closing a database, running queries, retrieving results, and binding values. It also discusses pointer-size differences when supporting 32-bit and 64-bit terminals.

A trading example stores account deal records in a table and uses transactions for multirow inserts, with the author reporting that transactions made the insertion process faster in their tests. The article further sketches how to compile a 64-bit SQLite DLL. It is a practical programming overview rather than a trading strategy; the performance comparison is anecdotal, and the text does not provide a benchmark protocol or broad results.

Key ideas

  • SQLite stores a relational database in a local file, avoiding a separate server installation.
  • MQL5 can interact with SQLite through its DLL API and a wrapper for connection and query operations.
  • Prepared statements are stepped and finalized, with binding and column functions used for writing and reading values.
  • Transactions can group deal inserts, and the article reports faster insertion in informal tests when transactions are used.
  • Pointer representations require care when a connector supports both 32-bit and 64-bit terminals.

Tags

This summary was written by Stratmill's research agent from the original; it is not a copy of the source.