restoring lost mt4 chart data

 

I spend a lot of time marking up my charts. Occasionally my computer will crash or mt4 will close unexpectedly and the next time i load mt4 either all my chart markings are gone (back to initial settings) or a previous saved copy of my work will be there (from the last time mt4 was closed normally).

Is there a way for me to keep a backup of my active mt4 session data? Or another solution?

 

Thanks! 

 
Save a template, or restart the terminal.
 

Bump

 

I have more than a dozen charts marked up all the time, so  templates doesn't really help. Today i had to restart my pc, and all my charts are gone again on when i reopened mt4.

 

thanks 

 

You can backup your profile folder. Normally it's the "default" folder containing a shitload of *.chr (chart01.chr, chart02.chr ...) files and a (order.wnd) file. Every evening (or whenever you shut down terminal.exe) create a backup of it. I made a bash script that backups that directory as "backup-15112015120212.tar.bz2". Alternative you can backup it using the date since in seconds format. In case of a crash or data-loss. Simply shut down terminal.exe and restore the directory and files from that backup.

BTW: I had that issue myself once... That's why I am doing this :) 

 

thanks for the reply I found the *.chr files in a strange place c:/users/me/appdata/roaming/metaquotes/Terminal\79E2198BC258682BB7D9E82A1BF3F4E7\profiles

I'll try backing them up:)

 
That is ok. Either it's in "MetaTrader 4/profiles" or the path that you described. Usually you only need to backup the "default" directory inside that profile folder. Simply open one of these .chr files with an text editor and verify whether it's one of your charts. And remember! Please shut terminal.exe down (e.g. closing it) before making a backup. This makes sure that the last things written or done on the chart are written to the files as well. Otherwise you end up with missing objects, documentations, labels etc...
 
That's not a "strange place." That is where they should be. Data Structure in MetaTrader 4 Build 600 and Higher - MQL4 Articles 17.02.2014
 

Metatrader4 -> Wine -> Linux = C:\\Program Files\\MetaTrader 4\\profile\\...

That's why I refer it as "strange place". Under Linux (and specially using Wine) things behave a bit differently.

If you install MT4 by issuing

wine mt4setup.exe (or how's it called) then all files are being installed in above said directory. C:\\Program Files\\MetaTrader 4\\

If you click on the icon that gets installed on your Linux desktop then it refers and uses all files in that said directory. You also install all your stuff in that directory.

But!

If you issue wine terminal.exe within the "MetaTrader 4" path then it sets up the said directory of the initial poster (which I called strange path).

I don't consider this a bug since MetaTrader 4 is happily introduced as Linux ready by MetaQuotes. Therefore I pretend that they tested it exessively with Linux and Wine :) 

 

I just came back from showering and while doing this, I thought to add a few lines more about that issue here:

To say the truth, I was a bit sarcastic when I wrote "excessively testing". I believe that Metatrader4 *may* be broken in terms of installing files correctly using Wine.

Now let me explain in more depth about my investigations as a Linux user.

Wine has two modes of dealing with files.

  1. Unix file mode
  2. Windows file mode
E.g.:

  1. wine .drive_c/Program\ Files/MetaTrader\ 4/terminal.exe 
  2. wine C:\\Program\ Files\\MetaTrader\ 4\\terminal.exe

They both start terminal.exe but behave (or operate) differently.

Even I was once hit by the issue when MetaQuotes announced the directory hierarchy changes. During these days I usually launched terminal.exe by issuing a command line argument under Linux (The first line above). Then one day to another the situation changed and I ended up with empty chart windows. 

What happened ?

Yes the new directory hierarchy happened and it operates incorrectly! (And most likely still does. Does it ?).

When installing Metatrader 4 by issuing:

wine mt4setup.exe

Wine install *all* files and directories into C:\\Program\ Files\\MetaTrader\ 4\\*

If you launch Metatrader 4 by clicking on its newly created icon on the desktop then it launches and operates everything in that directory (no portable flag used). 

I by accident launched it by invocing wine .drive_c/Program\ Files\MetaTrader\ 4/terminal.exe

After the terminal.exe started parts of the directories and files that initially was installed under the C:\\Program\ Files\\MetaTrader\ 4\\* directory get moved inside the Wine users folder (including the cryptic folder with the long HASH (or ID) number).

Unfortunately it's recommended to start Wine using the windows pathing scheme c:\\... rather than .drive_c/...

Somehow MetaTrader's internal mechanism (I believe some sort of propriaty way of dealing with this) causes this irritation.

I of course expect, that even under Wine the HASH directory is being created and used. This happens only if you invoce terminal.exe using the Unix file mechanism. But it doesn't create that directory, if you invoke terminal.exe using the Windows file mechanism of Wine. The Windows file mechanism is also what is being written inside the icons that get installed on your desktop after the installation process ends.

MetaTrader behaves like in portable mode when installed under Wine. I am not sure whether this is the intended way or not. Though I consider this not to be broken, because I really like having the stuff deal like in portable mode.

 
supermad4it:

thanks for the reply I found the *.chr files in a strange place c:/users/me/appdata/roaming/metaquotes/Terminal\79E2198BC258682BB7D9E82A1BF3F4E7\profiles

I'll try backing them up:)

 

Did the backup work out? I would expect the files won't get flushed until profiles swap or terminal shuts down.

 

Hello Guys,

Anyone have solution for metatrader 5 same issue?
All my charts are gone, I am not happy.

Is there a way you can save your last position (session) all at once without using templates?

Thanks in advance for help.

Gihon