If the bot trades on different trading instruments at once, and it has periods when there are several open orders at some point in time. In a class that receives a General trading signal, depending on various factors, I want to remember the dates and times of the bar on which the trading signal was received and, accordingly, the trade was made. So this data, i.e. the date and time of the bar on which the trading signal was received, can be steamed during the execution of the program, if, for example, the program is reinitialized, depending on some factors. I decided that they should be saved after a successful transaction. If you do not do this, after reinitializing the program, I will have a transaction made on the same signal that has already been worked out. And this is not an option.
I decided to write this data to a file. Everything is logical here. But there is one point!
Here, for example, there is a bot that is running on some thread currency instrument, let’s say, AUDEUR. The second bot is also running on the same trading instrument. But each bot trades its own trading tools, registered in its settings. Not necessarily AUDEUR.
It turns out that if I write the date and time of the bar on which the trading signal was received in a file with the name of the bot, they will interfere with each other because they will overwrite each other’s data, if the flag when opening is FILE_SHARE_READ. The question arose, how best to identify the file, so that such a thing would not happen?
It is clear that this is not a frequent case, but it still needs to be handled somehow..