MQL5 Algo Trading
494K subscribers
3.18K photos
1 video
3.18K links
The best publications of the largest community of algotraders.

Subscribe to stay up-to-date with modern technologies and trading programs development.
Download Telegram
This article shifts from socket-based MT5/Excel exchange to building the SQL foundation needed for reliable data workflows in algorithmic trading.

It compares practical ways to run SQL: command line, MySQL Workbench, MetaEditor, embedded MQL5, or sending SQL via sockets to a server. The key constraint is portability: stick to standard SQL to avoid vendor-specific features that break across engines.

Core setup focuses on CREATE DATABASE and USE, plus Workbench execution mechanics (run selection vs current statement). For repeatable scripts, it recommends conditional creation (IF/EXISTS patterns) instead of failing on reruns.

Table design is treated as the real challenge: data types and schema planning matter more than column order. A quotes example shows why a “price-only” table cannot store history, then uses ALTER TABLE to add a date field, emphasizing c...

👉 Read | Docs | @mql5dev

#MQL5 #MT5 #SQL
25👍3👌2
MetaTrader 5 uses SQLite, so standard SQL fits naturally inside MQL5 executables. One exception is execution from MetaEditor: it blocks DROP DATABASE for safety, even though DROP TABLE works. The takeaway is to treat destructive statements as production-grade risks.

The article then builds a clean workflow for quote storage: always modify data via SQL, not manual file edits. INSERT INTO is order-sensitive between column lists and VALUES, and careless table design permits unlimited duplicates.

To enforce consistency, define a PRIMARY KEY (e.g., trading day for daily bars). INSERT always creates rows; to change existing rows, use UPDATE ... SET ... WHERE keyed by the primary key. This pattern enables reliable incremental writes for trading data pipelines.

👉 Read | Calendar | @mql5dev

#MQL5 #MT5 #SQL
34
This part shows a practical path from raw MT5 tick exports to queryable data: request ticks in MetaTrader 5, save to CSV, then import the file into a clean .db using MetaEditor’s table import. Key details are choosing the correct delimiter (MT5 uses tabs by default) and naming the new table so the CSV header becomes the table schema.

With the data structured as a real table, SQL becomes usable for analysis and simulation. The article introduces SELECT as the core inspection tool, then moves to filtering with a WHERE clause, using column criteria (e.g., FLAGS = 88) to reduce large result sets.

MetaEditor’s result paging (blocks of 1,000 rows) is highlighted as a simple way to navigate big tick datasets during exploration.

👉 Read | VPS | @mql5dev

#MQL5 #MT5 #SQL
29