Quotes streaming from Binance to your MetaTrader 5

3 June 2023, 19:43
Andrey Khatimlianskii
0
931

To get quotes from Binance into your MetaTrader 5, as well as build comprehensive charts, you need the Binance Quotes Updater utility. It is a service, which provides a live tick data streaming from the exchange to your terminal, and also downloads and synchronizes the latest quotes history.

To get started with the Binance Quotes Updater:

1. Log your terminal to mql5.community (Tools - Settings - Community tab), check the "Market" box:



2. Go to Market - Utilities, and find Binance Quotes Updater:



3. Rent the utility for the desired period , or just install it if you have already purchased it:



4. Go to the menu File - Data Folder. In the navigator window that opens, go to the "MQL5\Experts\Market\" folder and move the "Binance Quotes Updater.ex5" file to the "MQL5\Services\" folder:



5. Restart the terminal. Find the Binance Quotes Updater service in the Navigator and start it:


6. Before clicking OK, go to the Inputs tab and set values for all parameters:

  • Binance section — the section of the exchange with which you are going to work (spot or futures).

  • Symbols/coins — the list of symbols and/or coins to load (delimiter is a comma):
    • If you specify a single coin, all instruments that include that coin will be loaded.
      For example, if you specify "BTC", all BTCxxx and xxxBTC instruments will be loaded: BTCUSDT, ETHBTC, LTCBTC, etc.

    • If you specify multiple coins, all the symbols that can be composed from coins combinations will be loaded.
      For example, if you specify "BTC,ETH,USDT", "BTCUSDT", "ETHBTC" and "ETHUSDT" will be loaded.

    • Finally, if you specify "all", all available symbols will be loaded.
      Be careful! There are more than 1700 instruments in the spot section of the exchange, it can take a long time to download the history for all instruments!

  • Check symbols every days  — periodic check of changes in the symbols list.
    New instruments may appear on the exchange or the properties of existing instruments may change. These changes check is performed at service startup. This option will allow you to periodically perform this check if the terminal works for a long time without restarting.

  • Update Type — quote update mode:
    • Live ticks and bars streaming (recommended mode)  — updates ticks and bars by WSS (web socket) in real time. Does not use API limits.

    • REST ticks streaming — updates ticks with a specified frequency (not all ticks that were on the exchange will be received).

    • Bars synchronization — bar history update with specified frequency. Ticks are not streamed in this mode.

  • History days to download — history depth (in days) for the initial download (maximum - 30 days).

  • WSS properties

    • Realtime volume & last price update — updating real volumes and last prices.

  • REST API properties

    • Quotes update frequency (ms) — frequency of quotes update (in milliseconds). Set the value to 0 to disable the update.
      Choose the right value for you, depending on the speed of your Internet connection and the number of instruments to be updated.

    • Bars sync frequency (sec) — frequency of bar synchronization (in seconds). Set to off to disable the synchronization.
      If a quote that should form a low or high of a bar has been missed, the bar will differ from the original bar from the exchange. Therefore, the service periodically synchronizes the last formed bars. Do not use too frequent synchronization of bars, it will greatly slow down the reception of actual quotes! If you need to update many instruments, run a separate instance of the service to synchronize bars.

    • API weight limit percent  maximum percentage of API limits usage. When it is reached, the service will stop until the end of the minute.
      API limits - this is the maximum number of requests allowed by the exchange. If you exceed the API limit, the exchange may block access from your IP.

  • Time Zone Parameters:

    • GMTAutoOffset  — automatic detection of your time zone mode.
      If set to true, the time of the bars on the chart will correspond to your computer's time.
      If set to false, the GMTOffsetHours shift will be used.


For best performance

Run one service instance to update the current quotes (Update Type = Live ticks and bars streaming), and a second service instance to synchronize bars (Update Type = Bars synchronization, Bars sync frequency = desired synchronization frequency):





If you use many instruments (more than 20), you can run multiple instances of the service to synchronize bars, separating currencies into several groups:





After launching

Wait for the initial download of the quotes history and appearance of all instruments in the Market Watch. You can monitor the download status in the Experts log:



After a successful download of the history, the service will start streaming ticks for all specified instruments:



Congratulations! Now you can analyze the charts of any cryptocurrency available on Binance right in your terminal!


Limits and restrictions

Quotes download and update speed depends on the number of selected symbols and the selected depth of history, also the speed can be affected by the quality of your Internet connection.

For maximum speed rent a VPS near the exchange server (contact me if you need help selecting and configuring).

Be careful! Tick data can consume quite a lot of disk space (>500 Mb per week for a single instrument). If you use a VPS with a small disk (e.g. 20 Gb), periodically check for free disk space and clean it up if necessary!



Detailed MetaTrader 5 to Binance connection guide you can find here.
Do not hesitate to ask any questions you have personally, or in the official support group.
Share it with friends: