Any Tips to Fix Data File Being Overwritten by Utility/EA?

 

Hey guys, there is a bug in this tool I created which is causing the file it creates to be overwritten, without an apparent reason.

The utility is supposed to grab the new data from a site, then it updates the existing historical file it creates, so you have continuous historical data.

For some reason, and so far weirdly only for the EURUSD symbol, the historical data is being overwritten with a new file, so it erases the previous data you had and start from the day you relaunched the application.

BUT it's not every time you relaunch the application. }

I was collecting data for EURUSD since last week. On the 27th of november, for some reason the Utility erased the whole data and started from scratch on the 27th. Ok, it was working properly (turning off, relaunching metatrader) until this morning, when I relaunched the application it decided to erase the data again BUT weirdly enough it deleted all data before yesterday 29th november 15pm server time.


So what I am looking for here is some tips of what might  be causing this.

I did not have problems with other symbols yet, only with EURUSD.


 
Your topic has been moved to the section: Technical Indicators
Please consider which section is most appropriate — https://www.mql5.com/en/forum/172166/page6#comment_49114893
 

The obvious cause is the code logic and/or the source of the data.

The terminal may deem it necessary to force an indicator to re-calculate it's buffer contents from scratch for various reasons. At those times, your indicator will need to re-collect the data from your external source, and if the external source does not cache that data that far back, then it will start from a more recent date.

To resolve the issue, separate the two functionalities.

  • Have a process that collects the data from the external source and saves it locally on file, building up an historical database (this can be the Indicator itself or a separate MQL5 program, such as a MQL5 Service).
  • Then have the second process build the indicator buffers from the local database and not directly from the external source.
 
Fernando Carreiro #:

The obvious cause is the code logic and/or the source of the data.

The terminal may deem it necessary to force an indicator to re-calculate it's buffer contents from scratch for various reasons. At those times, your indicator will need to re-collect the data from your external source, and if the external source does not cache that data that far back, then it will start from a more recent date.

To resolve the issue, separate the two functionalities.

  • Have a process that collects the data from the external source and saves it locally on file, building up an historical database (this can be the Indicator itself or a separate MQL5 program, such as a MQL5 Service).
  • Then have the second process build the indicator buffers from the local database and not directly from the external source.

Hello Fernando, it does work like that.

The EA part (the utility) grabs the data from the site and stores in a file.

Then the indicator does the job of reading the file and plotting the lines.

 
Alberto Gauer Borrego #: Hello Fernando, it does work like that. The EA part (the utility) grabs the data from the site and stores in a file. Then the indicator does the job of reading the file and plotting the lines.

Then your code has bugs and needs to be fixed.

The bug may be in the EA that stores the data, or in the indicator that reads the data.

We can't do anything here for you. Ask your programmer to properly debug both their code and find the cause.

Reason: