my computer turned off unexpectedly, I lost all the code in MQ5 file I was currently working with

 

I face this issue every once in a while, due to faulty electricity and some strange power problems in my pc the computer turns off after power up I found out that all the code on the mq5 file is completely gone 

mql5 code gone

Once I thought this was HDD errors which had troubles but now I have more reliable storage of SSD, I'm actually confused I'd be happy if someone would explain what's happening there and basically how does metraeditor works 

how can I restore back my data if possible

eventually I am using mql5 storage but I was in the middle of something big so I did not commit the changes to the repository, Is there any solution to this issue

 
Omega J Msigwa: I face this issue every once in a while, due to faulty electricity and some strange power reasons in my pc the computer turns off after power up I found out that all the code on the mq5 file is completely gone. Once I thought this was HDD errors which had troubles but now I have more reliable storage of SSD, I'm actually confused I'd be happy if someone would explain what's happening there and basically how does metraeditor works. how can I restore back my data if possible eventually I am using mql5 storage but I was in the middle of something big so I did not commit the changes to the repository, Is there any solution to this issue

To prevent it, you will have to save to file regularly, and also commit to MQL5 storage if possible, or have Windows keep a version history of file changes (enable "File History" backups in Windows), or use file sync feauture such as OneDrive, or DropBox, or Sync, or Google Drive, or something similar.

It has happened to me twice, but since I have enabled "File History", and I have files synced to OneDrive (with file history), I was able to recover the file.

 

Was it only the file that you were currently working on or all the files in the MQL5 folder?

Have you tried recovery software?

What kind of computer is it? Does it have overvoltage protection? There should also be overvoltage sockets, maybe this helps...
 
Fernando Carreiro #:

To prevent it, you will have to save to file regularly, and also commit to MQL5 storage if possible, or have Windows keep a version history of file changes (enable "File History" backups in Windows), or use file sync feauture such as OneDrive, or DropBox, or Sync, or Google Drive, or something similar.

It has happened to me twice, but since I have enabled "File History", and I have files synced to OneDrive (with file history), I was able to recover the file.

tell me more about one drive and file history, that sounds more interesting since I can allow automated backups with one drive, How can I allow backups to files in the experts directory to one drive?.

To my knowledge one drive backups means I have to add a file to One drive folder or desktop

 
Omega J Msigwa #:tell me more about one drive and file history, that sounds more interesting since I can allow automated backups with one drive, How can I allow backups to files in the experts directory to one drive?. To my knowledge one drive backups means I have to add a file to One drive folder or desktop

"File History" is part of the Windows 10/11 functionality. You will find it under SettingsUpdate & SecurityBackupBackup using File History (you can also find it in the under the older Control Panel).

OneDrive is by Microsoft, and if you have a Microsoft Office 365 subscription, then it is included with 1TB storage but you can subscribe to the service separately.

To use OneDrive you have to use Junction points to map folders/directories out from OneDrive to your MetaTrader instalations. In my case I have a single MQL5 and a MQL4 folder under OneDrive, and then in my my various MetaTrader installations I have Junction points mapping the MQL4 and MQL5 folders of each installation, to the shared ones under OneDrive.

 
Fernando Carreiro #:

"File History" is part of the Windows 10/11 functionality. You will find it under SettingsUpdate & SecurityBackupBackup using File History (you can also find it in the under the older Control Panel).

OneDrive is by Microsoft, and if you have a Microsoft Office 365 subscription, then it is included with 1TB storage but you can subscribe to the service separately.

To use OneDrive you have to use Junction points to map folders/directories out from OneDrive to your MetaTrader instalations. In my case I have a single MQL5 and a MQL4 folder under OneDrive, and then in my my various MetaTrader installations I have Junction points mapping the MQL4 and MQL5 folders of each installation, to the shared ones under OneDrive.

Thank you that helped a lot