Storing data on open orders or some events that happened

 

Hello,

I'd like to store some information about open orders, closed orders, their relation to each other. Mostly for money management but also it's a part of my strategy. But it seems that in MQL5 it's not an easy thing to do. Normally I would go for some database, or a JSON file. Any SQL database would be perfect.

I don't want to parse text files, as I might want to modify records etc. I image it can get messy very quickly. Could you suggest anything? What do you use to persist some information that can be later modified?

Cheers

 
dmdamiyo:

Hello,

I'd like to store some information about open orders, closed orders, their relation to each other. Mostly for money management but also it's a part of my strategy. But it seems that in MQL5 it's not an easy thing to do. Normally I would go for some database, or a JSON file. Any SQL database would be perfect.

I don't want to parse text files, as I might want to modify records etc. I image it can get messy very quickly. Could you suggest anything? What do you use to persist some information that can be later modified?

Cheers

It is possible to run a webserver with MySQL for example and do your administration there using webrequest.

 
Enrique Dangeroux:

It is possible to run a webserver with MySQL for example and do your administration there using webrequest.

You mean use a database that exposes REST endpoints? That'd be perfect! I didn't know about webrequest, thanks!

 
dmdamiyo:

You mean use a database that exposes REST endpoints? That'd be perfect! I didn't know about webrequest, thanks!

You can dress the Christmas Tree any which way you like. External ommunication without DLL's, webrequest is probably the only.

If you don't mind using DLL, this https://www.mql5.com/en/articles/2599 could be an alternative option to communicate. 

Working with sockets in MQL, or How to become a signal provider
Working with sockets in MQL, or How to become a signal provider
  • 2016.07.20
  • o_o
  • www.mql5.com
Sockets… What in our IT world could possibly exist without them? Dating back to 1982, and hardly changed up to the present time, they smoothly work for us every second. This is the foundation of network, the nerve endings of the Matrix we all live in. In the morning, you turn on the MetaTrader terminal, and it immediately creates sockets and...
 
dmdamiyo: I don't want to parse text files, as I might want to modify records etc.

Parsing text files has nothing to do with modifying them. Read the file into your data structure, modify the structure, write the structure.

 
dmdamiyo:

I'd like to store some information about open orders, closed orders, their relation to each other.

I write this type of data using CSV to a flat file. CSV is readily opened by OpenOffice Calc (or Excel if you prefer).

I can then use macros to highlight or otherwise massage the data.

I can also use other tools, like gnuplot, to show me good things.

I don't want to parse text files, as I might want to modify records etc. I image it can get messy very quickly.

I use python, which has useful modules such as "csv" for CSV files and "ElementTree" for XML (from the optimizer). I also built some OOP code to read/manipulate/write a unicode .set file. It wasn't too messy.
What do you use to persist some information that can be later modified?

I do exactly as @whroeder1 says above. To me, this was the simplest solution. So far I haven't needed the power of a full-fledged database.