Bookmarks get lost sometimes

 

I'm not sure exactly when it happens but sometimes i open the editor up and a files bookmarks have been erased.

In this case there was a power outage but the pc is on a line interactive ups so it gave me time to save and shutdown , but, on the next start of the editor the bookmarks were gone in the code.

I then tried to replicate the bookmarks loss with a shutdown , compile and shutdown when done without closing the editor , but they were not lost.

What is the proper sequence , (for future outages) , so that they don't get erased .

Thanks

 
Lorentzos Roussos:

I then tried to replicate the bookmarks loss with a shutdown , compile and shutdown when done without closing the editor , but they were not lost.

Perhaps the operating system managed to close the editor normally during shutdown

 
Lorentzos Roussos: I'm not sure exactly when it happens but sometimes i open the editor up and a files bookmarks have been erased. In this case there was a power outage but the pc is on a line interactive ups so it gave me time to save and shutdown , but, on the next start of the editor the bookmarks were gone in the code. I then tried to replicate the bookmarks loss with a shutdown , compile and shutdown when done without closing the editor , but they were not lost. What is the proper sequence , (for future outages) , so that they don't get erased . Thanks

Bookmarks, breakpoints, cursor position, etc. are stored with the source file as NTFS data streams.

So, when those streams are cleared due to some indirect method, then the information is lost, for example when an external text editor that does not understand or not respect NTFS data streams, or something else that clears them.

Forum on trading, automated trading systems and testing trading strategies

Are there plans for expand/collapse of functions/structs/classes ?

Fernando Carreiro, 2023.02.03 14:07

They are kept on the source file itself as an NTFS data stream.

streams v1.60 - Reveal NTFS alternate streams.
Sysinternals - www.sysinternals.com

source_file.mq5:
       :CursorPos:$DATA 444
       :LineFlags:$DATA 448
 
Vladislav Boyko #:

Perhaps the operating system managed to close the editor normally during shutdown

But the shutdown was normal on both cases . When i heard the notification i hit ctlr+S and then start->shutdown as fast as i could . 

Fernando Carreiro #:

Bookmarks, breakpoints, cursor position, etc. are stored with the source file as NTFS data streams.

So, when those streams are cleared due to some indirect method, then the information is lost, for example when an external text editor that does not understand or not respect NTFS data streams, or something else that clears them.

nothing else opened the file though

 
Vladislav Boyko #:

Perhaps the operating system managed to close the editor normally during shutdown

Just tested.

(Unfortunately, I have a single language edition of Windows)


Thus, the editor's work will be restored:


And so the editor's work will no longer be restored:


 
Lorentzos Roussos #:

But the shutdown was normal on both cases . When i heard the notification i hit ctlr+S and then start->shutdown as fast as i could . 

nothing else opened the file though

I think 'ctlr+S' saves source code but not bookmarks

 
Lorentzos Roussos #: But the shutdown was normal on both cases . When i heard the notification i hit ctlr+S and then start->shutdown as fast as i could . 

Unfortunately, MetaTrader applications have a nasty habit of not saving files properly when a shutdown event prompts them to close.

A manual closing of the applications is required and waiting a bit for the file cache to be flushed, otherwise they sometimes don't save properly.

A properly sized UPS should give up to 15min to let you do things calmly, so don't be in such a hurry. Haste makes waste!

EDIT: On two separate occasions, MetaEditor even filled my active source file with empty white space (during a shutdown), and had to go to my backups to restore the file.

 
I have a rather problematic computer that can crash unexpectedly without saving anything😄

So I developed two habits:

  1. Press 'ctlr+S' - so as not to lose the source code
  2. Restart the editor to avoid losing its "state". For example, a list of open files (in the editor), bookmarks, and the like
As you can see, I have some experience with what you are facing😄

 
Vladislav Boyko #:

I think 'ctlr+S' saves source code but not bookmarks

Ohhh. So in the second test i hit compile not just save ...hmmm . 

Vladislav Boyko #:
I have a rather problematic computer that can crash unexpectedly without saving anything😄

So I developed two habits:

  1. Press 'ctlr+S' - so as not to lose the source code
  2. Restart the editor to avoid losing its "state". For example, a list of open files (in the editor), bookmarks, and the like
As you can see, I have some experience with what you are facing😄

I do it too , every change i hit ctrl+s . Sometimes i hit ctrl+s here (while writing a post) out of habit as well  😄

Fernando Carreiro #:

Unfortunately, MetaTrader applications have a nasty habit of not saving files properly when a shutdown event prompts them to close.

A manual closing of the applications is required and waiting a bit for the file cache to be flushed, otherwise they sometimes don't save properly.

A properly sized UPS should give up to 15min to let you do things calmly, so don't be in such a hurry. Haste makes waste!

EDIT: On two separate occasions, MetaEditor even filled my active source file with empty white space (during a shutdown), and had to go to my backups to restore the file.

Okay so the process is :

  • hit compile
  • close the editor
  • close the mt
  • one missisipi two missisipi three missisipi , shutdown 

The time depends on the wattage of the pc as well , the more powerful the pc the less time the ups will give you .


 
Lorentzos Roussos #: The time depends on the wattage of the pc as well , the more powerful the pc the less time the ups will give you .

A "properly sized UPS" gives 15min (or more). You should select a UPS size based on your computer's power consumption, including any peripherals connected to it (monitors, external hard drives, etc.).

 
Fernando Carreiro #:

A "properly sized UPS" gives 15min (or more). You should select a UPS size based on your computer's power consumption, including any peripherals connected to it (monitors, external hard drives, etc.).

max i can get here (not the current one) is 750W .