A solution for streaming real-time ticker updates from MetaTrader 5 over WebSockets to any server.
- 📘 Leverages the robust WebSocket library implementation from the MQL5 Book
- ⚡️ Implements tight update intervals for near-zero latency ticker updates
- 🚚 Batches ticker updates for symbols that changed within the same interval
- 📚 Utilizes JAson library for JSON serialization/deserialization
Currently powering our trade signaling platform: https://solidsignals.xyz — Consistent Profitable Trades Written in MQL5, by polyclick
MetaTrader 5 restricts symbol tracking to those listed in the Market Watch window. When configuring the Expert Advisor, ensure that:
- All symbols you want to track are added to the Market Watch
- Symbol names in your configuration array match exactly with those in Market Watch
- Spelling is correct for all symbol names
Shouldn't be too hard :)
Place the MQL5Book
directory in your MetaTrader 5 include directory:
/MQL5/Include/MQL5Book
When installed correctly, your directory structure should look like this:
- Create a custom Expert Advisor folder at
/MQL5/Experts/{YOUR_FOLDER_NAME}
- Copy all files from the
Expert/
directory in this repo to your custom folder
- Open MetaEditor
- Compile the Expert Advisor
- Resolve any include path issues that may arise
In MetaTrader 5:
- Navigate to Tools > Options
- Add your WebSocket server URL to the allowed URLs list
Even though the Expert Advisor doesn't primarily use the onTick()
event, it needs to be attached to a chart to initialize and run.
Debug messages are included in the code to assist with troubleshooting.
For development and testing, you can create a temporary WebSocket server:
- Start a local WebSocket server using
wscat
:
npx wscat -l 8080
- Expose your local server to the internet using
untun
(CloudFlare-based tunneling):
npx untun@latest tunnel http://localhost:8080
- Use the public URL provided by
untun
in:- The MetaTrader 5 Tools > Options whitelist
- The Expert Advisor input parameters
If connection fails, try these URL variations in both the whitelist and EA parameters:
http://random-url.trycloudflare.com
https://random-url.trycloudflare.com
ws://random-url.trycloudflare.com
wss://random-url.trycloudflare.com
- Open an issue on GitHub
- Visit our website: https://solidsignals.xyz
- Join our Discord community: https://discord.gg/NMVSE5mGkX