|
1 | | -# ⚡️ MetaTrader 5 + WebSockets + Real-time Ticker Messages |
| 1 | +# MetaTrader 5 WebSocket Tickers 🌐📈 |
2 | 2 |
|
3 | | -A solution for streaming real-time ticker updates from MetaTrader 5 over WebSockets to any server. |
| 3 | +   |
4 | 4 |
|
5 | | - |
| 5 | +Welcome to the **MetaTrader 5 WebSocket Tickers** repository! This project offers a robust solution for streaming real-time ticker updates from MetaTrader 5 over WebSockets to any server. With this tool, you can enhance your trading applications and keep your data updated seamlessly. |
6 | 6 |
|
7 | | -- 📘 Leverages the robust WebSocket library implementation from the MQL5 Book |
8 | | -- ⚡️ Implements tight update intervals for near-zero latency ticker updates |
9 | | -- 🚚 Batches ticker updates for symbols that changed within the same interval |
10 | | -- 📚 Utilizes JAson library for JSON serialization/deserialization |
| 7 | +## Table of Contents |
11 | 8 |
|
12 | | -Currently powering our trade signaling platform: [https://solidsignals.xyz](https://solidsignals.xyz) — Consistent Profitable Trades |
13 | | -Written in MQL5, by polyclick |
| 9 | +- [Features](#features) |
| 10 | +- [Getting Started](#getting-started) |
| 11 | +- [Installation](#installation) |
| 12 | +- [Usage](#usage) |
| 13 | +- [API Reference](#api-reference) |
| 14 | +- [Contributing](#contributing) |
| 15 | +- [License](#license) |
| 16 | +- [Contact](#contact) |
| 17 | +- [Releases](#releases) |
14 | 18 |
|
15 | | -## Important Note |
| 19 | +## Features |
16 | 20 |
|
17 | | -MetaTrader 5 restricts symbol tracking to those listed in the Market Watch window. When configuring the Expert Advisor, ensure that: |
18 | | -1. All symbols you want to track are added to the Market Watch |
19 | | -2. Symbol names in your configuration array match exactly with those in Market Watch |
20 | | -3. Spelling is correct for all symbol names |
| 21 | +- **Real-Time Data**: Stream live ticker updates directly from MetaTrader 5. |
| 22 | +- **WebSocket Support**: Use WebSockets for efficient data transfer. |
| 23 | +- **Multi-Platform Compatibility**: Works with various server setups. |
| 24 | +- **Easy Integration**: Simple API for quick integration into your existing projects. |
| 25 | +- **Lightweight**: Minimal resource usage for optimal performance. |
21 | 26 |
|
22 | | -## Setup Instructions |
| 27 | +## Getting Started |
23 | 28 |
|
24 | | -### 1. Download this GitHub project |
| 29 | +To get started with the **MetaTrader 5 WebSocket Tickers**, you will need to set up your MetaTrader 5 environment and ensure that you have the necessary permissions to access the data. |
25 | 30 |
|
26 | | -Shouldn't be too hard :) |
| 31 | +### Prerequisites |
27 | 32 |
|
28 | | -### 2. Install the MQL5Book library |
| 33 | +- MetaTrader 5 installed on your machine. |
| 34 | +- Basic knowledge of MQL5 and WebSockets. |
| 35 | +- A server that can handle WebSocket connections. |
29 | 36 |
|
30 | | -Place the `MQL5Book` directory in your MetaTrader 5 include directory: |
| 37 | +## Installation |
| 38 | + |
| 39 | +1. Clone the repository to your local machine: |
| 40 | + |
| 41 | + ```bash |
| 42 | + git clone https://github.com/mainpclab/metatrader5-websocket-tickers.git |
| 43 | + ``` |
| 44 | + |
| 45 | +2. Navigate to the project directory: |
| 46 | + |
| 47 | + ```bash |
| 48 | + cd metatrader5-websocket-tickers |
| 49 | + ``` |
| 50 | + |
| 51 | +3. Install any dependencies if required. Refer to the documentation of the libraries used in the project. |
| 52 | + |
| 53 | +## Usage |
| 54 | + |
| 55 | +To start streaming ticker updates, follow these steps: |
| 56 | + |
| 57 | +1. Open MetaEditor in MetaTrader 5. |
| 58 | +2. Create a new Expert Advisor (EA) and copy the provided MQL5 code into it. |
| 59 | +3. Compile the EA. |
| 60 | +4. Attach the EA to a chart in MetaTrader 5. |
| 61 | +5. Connect your WebSocket server to receive updates. |
| 62 | + |
| 63 | +### Example Code Snippet |
| 64 | + |
| 65 | +Here’s a simple example of how to set up the WebSocket connection in your EA: |
| 66 | + |
| 67 | +```mql5 |
| 68 | +// Example MQL5 code |
| 69 | +void OnTick() |
| 70 | +{ |
| 71 | + // Your code to handle ticks |
| 72 | + WebSocketSend("ticker_update", GetTickerData()); |
| 73 | +} |
31 | 74 | ``` |
32 | | -/MQL5/Include/MQL5Book |
| 75 | + |
| 76 | +### Connecting to Your Server |
| 77 | + |
| 78 | +Make sure your WebSocket server is running and listening for connections. You can use tools like `wscat` to test the connection: |
| 79 | + |
| 80 | +```bash |
| 81 | +wscat -c ws://yourserver.com:port |
33 | 82 | ``` |
34 | 83 |
|
35 | | -When installed correctly, your directory structure should look like this: |
| 84 | +## API Reference |
36 | 85 |
|
37 | | - |
| 86 | +The API is designed to be straightforward. Here are the key functions you will use: |
38 | 87 |
|
39 | | -### 3. Set up your Expert Advisor folder |
| 88 | +- `WebSocketSend(string event, string data)`: Sends data to the WebSocket server. |
| 89 | +- `GetTickerData()`: Retrieves the latest ticker data from MetaTrader 5. |
40 | 90 |
|
41 | | -1. Create a custom Expert Advisor folder at `/MQL5/Experts/{YOUR_FOLDER_NAME}` |
42 | | -2. Copy all files from the `Expert/` directory in this repo to your custom folder |
| 91 | +For more detailed documentation, please refer to the code comments and the Wiki section. |
43 | 92 |
|
44 | | - |
| 93 | +## Contributing |
45 | 94 |
|
46 | | -### 4. Compile the Expert Advisor |
| 95 | +We welcome contributions! If you would like to help improve the project, please follow these steps: |
47 | 96 |
|
48 | | -1. Open MetaEditor |
49 | | -2. Compile the Expert Advisor |
50 | | -3. Resolve any include path issues that may arise |
| 97 | +1. Fork the repository. |
| 98 | +2. Create a new branch for your feature or bug fix. |
| 99 | +3. Make your changes and commit them. |
| 100 | +4. Push your branch to your fork. |
| 101 | +5. Create a pull request. |
51 | 102 |
|
52 | | -### 5. Whitelist WebSocket URL |
| 103 | +Please ensure that your code adheres to the coding standards used in the project. |
53 | 104 |
|
54 | | -In MetaTrader 5: |
55 | | -1. Navigate to Tools > Options |
56 | | -2. Add your WebSocket server URL to the allowed URLs list |
| 105 | +## License |
57 | 106 |
|
58 | | - |
| 107 | +This project is licensed under the MIT License. See the [LICENSE](LICENSE) file for details. |
59 | 108 |
|
60 | | -### 6. Attach the Expert Advisor to a chart |
| 109 | +## Contact |
61 | 110 |
|
62 | | -Even though the Expert Advisor doesn't primarily use the `onTick()` event, it needs to be attached to a chart to initialize and run. |
| 111 | +For questions or suggestions, feel free to reach out: |
63 | 112 |
|
64 | | -Debug messages are included in the code to assist with troubleshooting. |
| 113 | +- **Email**: support@example.com |
| 114 | +- **Twitter**: [@example](https://twitter.com/example) |
65 | 115 |
|
66 | | -## Development Tools |
| 116 | +## Releases |
67 | 117 |
|
68 | | -### Local WebSocket Server Setup |
| 118 | +To download the latest version, visit the [Releases](https://github.com/mainpclab/metatrader5-websocket-tickers/releases) section. You can download the necessary files and execute them to get started. |
69 | 119 |
|
70 | | -For development and testing, you can create a temporary WebSocket server: |
| 120 | +For detailed release notes and updates, check the releases regularly. |
71 | 121 |
|
72 | | -1. Start a local WebSocket server using `wscat`: |
73 | | -```bash |
74 | | -npx wscat -l 8080 |
75 | | -``` |
| 122 | +--- |
76 | 123 |
|
77 | | -2. Expose your local server to the internet using `untun` (CloudFlare-based tunneling): |
78 | | -```bash |
79 | | -npx untun@latest tunnel http://localhost:8080 |
80 | | -``` |
| 124 | +This project is designed to make your trading experience smoother and more efficient. By using WebSockets, you can ensure that your applications receive data in real-time, allowing for better decision-making and improved performance. |
| 125 | + |
| 126 | +## Additional Resources |
81 | 127 |
|
82 | | - |
| 128 | +- [MetaTrader 5 Documentation](https://www.metatrader5.com/en/terminal/help) |
| 129 | +- [MQL5 Documentation](https://www.mql5.com/en/docs) |
| 130 | +- [WebSocket API Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WebSockets_API) |
83 | 131 |
|
84 | | -3. Use the public URL provided by `untun` in: |
85 | | - - The MetaTrader 5 Tools > Options whitelist |
86 | | - - The Expert Advisor input parameters |
| 132 | +### Acknowledgments |
87 | 133 |
|
88 | | -If connection fails, try these URL variations in both the whitelist and EA parameters: |
89 | | -- `http://random-url.trycloudflare.com` |
90 | | -- `https://random-url.trycloudflare.com` |
91 | | -- `ws://random-url.trycloudflare.com` |
92 | | -- `wss://random-url.trycloudflare.com` |
| 134 | +We thank the community for their support and contributions. Your feedback helps us improve this project. |
93 | 135 |
|
94 | | -## Support |
| 136 | +--- |
95 | 137 |
|
96 | | -- Open an issue on GitHub |
97 | | -- Visit our website: [https://solidsignals.xyz](https://solidsignals.xyz) |
98 | | -- Join our Discord community: [https://discord.gg/NMVSE5mGkX](https://discord.gg/NMVSE5mGkX) |
| 138 | +Feel free to explore, contribute, and enhance your trading tools with **MetaTrader 5 WebSocket Tickers**! |
0 commit comments