MetaTrader 4 and MetaTrader 5

SpreadMon versions for MetaTrader 4 and MetaTrader 5 both have a common code-base. Even though the executable for MT5 is nearly twice the size of the MT4 version, functionality is almost identical. Resolution is higher on MT5 charts because of better support for graphics, and this shows up mainly when the bars are scaled to minimum width. There are problems in MT5 when running multiple copies of indicators with identical parameters [ which could happen, mainly by accident ], and code has been added to ensure this situation does not arise.

GMT Correction

One of the most challenging issues when dealing with data from different brokers, is the synchronization of dates and times. We built a mechanism into SpreadMon to automatically translate between server-time and GMT, and all data is recorded with a GMT timestamp. This works well when data is imported into a chart from different terminals which have different server times. It also works without any known problems for data used on its 'home' terminal, where the server-time stays consistent.

However, many brokers adjust server-time for daylight-saving at various times throughout the year, and this can occasionally lead to a shift of one hour between price bars on the main chart, and bars in the indicator. This effect will not be noticeable very often, but do be aware of the cause if it does occur. A simple reset of the indicator will restore time synchronization, although there may be a couple of hiccups if this resynchronization occurs away from DS-time adjustment at the weekend. There is a workaround that requires setting broker-specific parameters related to daylight-saving. If this issue is of concern to you, please contact us for details of the workaround.

Data File Format

Data is written to a file in simple CSV format, and contains the following fields...

DDDDDDDDDD, PP, QQ, SSSS, NN

  • DDDDDDDDDD is the Unix timestamp
  • PP maximum spread
  • QQ minimum spread
  • SSSS is the sum of spreads in the interval
  • NN is the number of ticks in the interval, i.e. the number of spread-items included in the sum

This configuration allows for multiple entries with the same date, as long as all entries are sequenced from earliest to latest. After SpreadMon has been running for a while, the data can be examined by opening MetaEditor as shown below, and selecting the CSV file of interest in the Files folder.

SpreadMon screenshot

Switching Between Time-Frames

Switching between time-frames is normally quite fast and can be done on-the-fly. If data is stored for a year or more, large CSV data-files mean a slightly longer delay is noticeable if the time between first-displayed-bar and last-displayed-bar covers a long period. For shorter periods close to the current date, data is loaded immediately, whereas the remainder is loaded only when required. SpreadMon has been stress tested with files containing data captured over a two year period. Because of the demands these large files put on terminal resources, it is not recommended to save data to a single file over longer periods. New files can be created each year, saving older files if historic information is of interest.

When changing to a different time-frame where history files have not yet been downloaded from the broker, an alert will be displayed. This is only true for MetaTrader 4; MetaTrader 5 has a different mechanism for processing history files. If this alert is shown while the terminal is connected to the broker, it is usually sufficient to switch away from the new time-frame and back to it again. The history download should be triggered automatically.

Running Offline

SpreadMon has been coded to allow full switching between time-frames while offline, disconnected from the broker. As long as history files for the chosen time-frame are available to the terminal locally, the indicator should display the same as it does when on-line.