MetaEditor Help

Working with the Storage

Working with the Storage

The MQL5 Storage works only with the MQL4/MQL5 folder of the client terminal. All operations with the MQL5 Storage are performed via the context menu of the "Navigator" window and through the context menu of the source code editor:

Menu of MQL5 Storage

Using the menu commands you can perform the following actions in the MQL5 Storage:

  • Checkout of data from the repository
  • Update data from the repository
  • Commit changes in the repository
  • Add files/folders in the repository
  • Delete files/folders from the repository
  • Cancel current changes in the local copy of data
  • View logs of data changes in the repository
  • View changes in the working copy of the file

Getting Started

The storage contains the information as a tree of files. When connecting to the storage, the MetaEditor user reads and writes these files. The user always works with a local copy of data and, if necessary, sends changes to the repository.

Each transaction of changes is recorded in the storage journal, and later the user can view when, by whom and what files were changed. A certain revision number corresponds to each transaction of changes. A revision is a state of the storage at a point of time. Each time you send changes, a new revision is created (its number is increased) in the storage. Based on the revision number, the storage determines the state of data and merges them. The user can also update the local data copy to a selected revision or revert to any revision.

To begin to work with data in the MQL5 Storage, you must associate a local data folder with the appropriate folder in the storage. This can be done in two ways:

  • If you have just created a repository, it is empty. You need to add a directory in it. After that, an appropriate directory is created for the specified directory in the repository (at the same path relative to the /MQL4 or /MQL5 folder). This is a root directory. All operations with files are performed in this directory.
  • If the storage already has some data, you can download them to a local directory. For example, the storage contains the folder /Personal/account_name/MQL5/Experts. You can download the data stored in it to a local directory /MQL5/Experts.

The top directory in the hierarchy, which is bound to the storage, is a root directory. You work with the repository only within this directory. It is not necessary to bind the top directory /MQL4 or /MQL5 to the storage. Any subdirectory within /MQL5 or /MQL4 can be root. You can have several root directories, for example, /MQL5/Experts and /MQL5/Images.

  • The MQL5 Storage only works with the following types of files: mq4, mq5, mqh, cpp, h, bmp, wav. Other types of files cannot be added to the repository.
  • Files larger than 64 MB cannot be added to the storage.

Adding to the Repository

To add a folder or file in the repository, select it and execute the "Add to Storage Add to Storage" command. This will bring up a dialog box showing the list of folders and files to be added.

Files are added locally. To send changes to the repository, execute the "Commit to Storage Commit to Storage" command.

Add a folder to the storage

Tick ​​off the necessary files and folders, and then click "OK".

  • The principle of storage operation does not allow to add files without the folder in which they are located. You cannot add a file located in the folder, which is not added to the repository.
  • You cannot add individual files to the root directory /MQL4 or /MQL5.
  • In the folder associated with the repository, only its child directories can be added. Folders that are lower in the hierarchy cannot be added without their parent folders.

Added files and folders are marked with Added to repository:

Added Files and Folders

Next, these changes should be sent to the repository. Select the added folder/file and execute "Commit Commit" command.

Committing to the Repository

In this dialog, you can also choose the changes that should be sent to the repository. You can add a comment when committing changes. Detailed comments facilitate the analysis of changes in the future.

After committing the current changes in the repository, the corresponding folders and files are marked with No changes. This means that the local copy of data does not differ from the one that's in the storage at the time of the last commit/update operation.

  • If a folder that corresponds to the one you add already exists in the storage, error "Folder already exists, update it from storage" will appear. For such a folder select "Update from Storage Update from Storage". After that, it will be linked to the storage, and data from the repository will be added to it. Then you can send your changes to the repository using the"Commit to Storage Commit to Storage" command.
  • If the size of a file exceeds 1MB, it is automatically unselected in the "Commit" dialog. Upload large files carefully as it may result in excess load of the system.

Checkout

Another way to link a local folder with the same folder in the repository is the command "Checkout from Storage Checkout from Storage". However, in this case, the content is downloaded to a local folder of the same folder in the repository.

Getting Data from the Storage

  • Individual files can not be retrieved from storage. You can only download a folder, located in the root directory /MQL4 or /MQL5, or the entire root directory /MQL4 or /MQL5.
  • If the selected folder does not exist in the repository on the same path, the command "Checkout from Storage Checkout from Storage" will return the error 'Target path does not exist'. In this case, add a folder using the command "Add to Storage Add to Storage".
  • If a local folder contains data, then during checkout data obtained from the repository will be added to it. New files will be added. For files with matching names and paths it will try to merge data.

Updating Data from the Storage

To get the latest revision of data from the repository, select a folder or file and execute "Update from Storage Update from Storage".

Data Update

The appearing dialog box contains a list of changes.

If the local directory contains data, during the update they will be supplemented by data obtained from the repository. New files will be added. For files with matching names and paths it will try to merge data.

Update to Revision

MQL5 Storage stores the entire history of changes committed by users to the storage. Each commit of changes is a new revision (state of the storage at a particular time). During parallel work of multiple users with data through the storage, you need to periodically receive changes made by other users. Command "Update to Revision Update to Revision" allows you to gradually update the local copy of data from the repository.

For example, since the last update of the local copy of data, three new revisions appeared in the storage. You can first upgrade to the first revision, then to the second and to the third one.

To update to a specific revision, select a file or folder and call the storage log by clicking "Show Storage Log Show Storage Log".

Update to Revision

In the window that opens, select the required revision and run the "Update to Revision Update to Revision" command.

  • A local copy of data can only be updated to a higher (later) revision.
  • Data obtained from the repository are added to the local copy. For files with matching names and paths it will try to merge data. If files have been added to a revision, they will be added to the local copy. If files have been deleted from a revision, they will be deleted from the local copy.

Revert to Revision

MQL5 Storage stores the entire history of changes committed by users to the storage. Each commit of changes is a new revision (state of the storage at a particular time). At any time you can return to one of the previous states of a file or folder.

To revert to a specific revision, select a file or folder and call the storage log by clicking "Show Storage Log Show Storage Log".

Revert to Revision

In the opened window, select the required revision and click "Revert to This Revision Revert to This Revision".

After reverting to the revision, the selected file/folder will fully return to the specified state. You can revert both to earlier and to later revisions.

Committing Changes to the Storage

As mentioned earlier, you can work with the data only in their local copies. To transfer local changes to the repository, use the "Commit to Storage Commit to Storage" command. Local files and folders that have been changed are marked with an icon Changed.

Before committing changes you can view them by selecting a file and selecting "Difference of Versions Difference of Versions" in the context menu.

Committing to the Repository

In the commit dialog you can select changed files and folders that should be committed to the repository. You can add a comment when committing changes. Detailed comments facilitated the analysis of changes in the future.

  • Local changes are of higher priority, in any case they are added to the storage.
  • If the revision number in the storage is above the local revision (modified from another source, and local data is not updated from the repository), then you'll get an error like "Out of date" when trying to commit the changes. In this case, first execute the "Update from Storage Update from Storage" command to merge data, and then select the "Commit to Storage Commit to Storage" command.
  • Be careful when updating bmp and wav files. When merged these files are completely replaced by newer revisions. Thus, during update they may be replaced with files from the repository. To avoid such situations, save copies of these files separately, execute the "Update from Storage Update from Storage" command to increase the number of the local revision, move the previously copied files back and commit changes to the storage.

Delete

If you want to delete a file or a folder, use the command "Delete from Storage Delete from Storage". The folder/file will be deleted from the local copy of data. To delete a file or a folder from the repository, commit these changes using the "Commit to Storage Commit to Storage" command.

  • Deletion of a file or folder by the standard command "Delete Delete" of the "Navigator" window does not influence the MQL5 Storage. With the next update, the deleted data will be restored from the storage.
  • The root directory linked to the storage cannot be deleted.

Reverting Changes

If you want to undo the changes made in the current local copy of data, execute the "Revert changes Revert Changes" command for the necessary file or folder. The file/folder will be returned to a state that was saved locally during the previous synchronization with the repository.

When you revert changes, the initial local revision is restored, not the current revision in the repository.

Log of Changes

Each commit of changes to the repository using the "Commit to Storage Commit to Storage" command is logged. The logs help you to easily analyze the history of changes in your projects. To view the change log of a file/folder, select "Show Storage Log Show Storage Log".

View logs

The upper part shows a list of changes:

  • Revision — the unique number of the commit.
  • Author — the name of the user (same as the login of the MQL5.community account), who made these changes.
  • Date — date when the changes were committed in the UTC format.
  • Comment — a comment to changes.

Using the context menu command "Update to revision Update to Revision", you can update the local copy of data to a selected revision.

The bottom of the window displays a list of files modified in the selected revision. Icons show the types of changes:

  • Added — the file has been added.
  • Changed — the file has been changed.
  • Deleted — the file has been removed.

Using the context menu of the list of modified files, you can analyze the changes:

  • Compare with working copy Compare with Working Copy — compare the selected file with a working copy of this file.
  • Compare with previous revision Compare with Previous Revision — compare the selected file with its previous revision.
  • Compare revisions Compare Revisions — compare two revisions of a file pre-selecting them at the top of the window.