Discussion of article "MQL5 Cookbook — Services" - page 2

 
Aleksey Vyazmikin #:

Doesn't SQLite know how to work with transaction queue? I haven't looked into it, but you wrote an article, that's why I'm asking :)

You can write to each section of the database (a separate table), or even each Expert Advisor can create its own database, and the service will check the availability of the base and connect it to work.

Of course, the issue is delays, but on the other hand it is compensated by the saved spread.

But SQLite is limited by multithreading - simultaneous execution of several processes. Several processes can read from the database at the same time, but only one can write to it by default....

 
JRandomTrader OnTrade, OnTradeTransaction. OnDeinit would also be useful for regular stopping when the terminal is closed.

And then the service will be almost no different from an Expert Advisor. I am more interested in the events of transition to another chart, change of chart period... Well, maybe something else that is not in Expert Advisors or indicators....

 
Alexey Viktorov #:

And then the service will be almost no different from an Expert Advisor. I am more interested in the events of switching to another chart, changing the chart period... Well, maybe something else that is not in Expert Advisors or indicators....

The key thing is that it does not require a separate chart.

 

Very nice. Thank you for sharing this article and the code examples.

I created a very simple service that identifies when it is a new day and runs a task just once a day to save the trade history in a CSV file. Afterward, this file is updated only with the new trades from the history.

The advantage is that I don't need a chart window to do this, however it raised a question about whether the service will use more or less processing power and memory from my computer compared to if I used this task inside an empty indicator for example, running an 'OnTimer' function.

If you have the answer to my question about the processing power and memory usage, could you please let me know? Thanks again for sharing this article and the code examples.