Very interesting, I'm having problems with Mysql, I'll try to use your approach.
abimael Silva #:
Very interesting, I'm having problems with Mysql, I'll try to use your approach.
Very interesting, I'm having problems with Mysql, I'll try to use your approach.
It is a very simple and well-known approach, Abimael. It is only a REST app between your client and your server.
Depending on your needs, I would suggest that you look for ready-made open-source API generators. Here you have an open-source example on GitHub. It is in Ruby (waaaay better :)) but the concept is the same.
Good luck!

GitHub - blocknotes/sinatra-rest-api: Sinatra REST API generator
- blocknotes
- github.com
A Sinatra component that generates CRUD routes for database ORM models. Install: (or in Gemfile) For resource DSL keyword: actions : list of actions to enable (array of symbols) include : list of associations to expose in list/read actions (array of symbols) or false to skip every association limit : set a fixed limit server side plural...

You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
New article How to connect MetaTrader 5 to PostgreSQL has been published:
This article describes four methods for connecting MQL5 code to a Postgres database and provides a step-by-step tutorial for setting up a development environment for one of them, a REST API, using the Windows Subsystem For Linux (WSL). A demo app for the API is provided along with the corresponding MQL5 code to insert data and query the respective tables, as well as a demo Expert Advisor to consume this data.
MetaTrader 5 already has the functions you may need to work with a database and the functions you may need to connect to a database via network.
Since 2020 the platform provides native integration with SQLite. You can use those database functions mentioned above to interact with it from code. Besides that you can interact with your databases via a dedicated GUI in MetaEditor, making it easy to create tables, alter tables, and perform CRUD operations without the need for additional software.
That was a great improvement in the end-user experience and a key addition to the MQL5 developer arsenal.
Among dozens of RDBMS available, many of them with open-source licenses, SQLite seems to have been a smart choice by MetaTrader 5 developers. Despite being a full-featured SQL database, with multi-column indexes, triggers, views, acid transactions, full-text search, aggregate functions, and more, it is lightweight, file-based, scalable, and requires zero maintenance. According to its website, "it seems likely that there are over one trillion (1e12) SQLite databases in active use".
Regardless of its impressive features, SQLite is limited by design to a single user and is not aimed at concurrent access in web deployments. The large number of forum posts and articles on the MQL5 website about how to connect MetaTrader 5 to MySQL reveals that there is a demand for a more robust solution for other use cases.
This article is focused on setting up a development environment for these use cases using Postgres.
Author: Jocimar Lopes