algorembrant commited on
Commit
cbe113f
·
verified ·
1 Parent(s): a7c4257

Upload 68 files

Browse files
This view is limited to 50 files because it contains too many changes.   See raw diff
Files changed (50) hide show
  1. .gitattributes +31 -0
  2. 2026-01-20 20-32-35.mp4 +3 -0
  3. 2026-01-21 10-45-20.mp4 +3 -0
  4. 2026-01-21 14-03-26.mp4 +3 -0
  5. 2026-01-22 08-42-06.mp4 +3 -0
  6. 2026-01-22 10-09-23.mp4 +3 -0
  7. Install VisualStudio C++ Build Tools.png +3 -0
  8. LICENSE +21 -0
  9. MQL5/Experts/ZmqPublisher.mq5 +77 -0
  10. MQL5/Include/Zmq/Zmq.mqh +112 -0
  11. README.md +324 -0
  12. STRUCTURE.md +85 -0
  13. TECHSTACK.md +17 -0
  14. funny replies/funny1.png +0 -0
  15. funny replies/funny2.png +0 -0
  16. funny replies/funny3.png +3 -0
  17. funny replies/funny4.png +0 -0
  18. mt5-chart/Cargo.lock +0 -0
  19. mt5-chart/Cargo.toml +14 -0
  20. mt5-chart/src/main.rs +127 -0
  21. search/arxiv/arxiv1.png +3 -0
  22. search/arxiv/arxiv2.png +3 -0
  23. search/arxiv/arxiv3.png +3 -0
  24. search/arxiv/arxiv4.png +3 -0
  25. search/arxiv/arxiv5.png +3 -0
  26. search/arxiv/arxiv6.png +3 -0
  27. search/arxiv/arxiv7.png +3 -0
  28. search/arxiv/arxiv8.png +3 -0
  29. search/arxiv/arxiv9.png +3 -0
  30. search/baiduscholarly/baiduscholarly1.png +0 -0
  31. search/baiduscholarly/baiduscholarly2.png +3 -0
  32. search/baiduscholarly/baiduscholarly3.png +3 -0
  33. search/baiduscholarly/baiduscholarly4.png +3 -0
  34. search/baiduscholarly/baiduscholarly5.png +3 -0
  35. search/baiduscholarly/baiduscholarly6.png +3 -0
  36. search/baiduscholarly/baiduscholarly7.png +3 -0
  37. search/baiduscholarly/baiduscholarly8.png +3 -0
  38. search/baiduscholarly/baiduscholarly9.png +3 -0
  39. search/googlescholar/gscholar1.png +0 -0
  40. search/googlescholar/gscholar2.png +0 -0
  41. search/googlescholar/gscholar3.png +0 -0
  42. search/googlescholar/gscholar4.png +0 -0
  43. search/googlescholar/gscholar5.png +0 -0
  44. search/googlescholar/gscholar6.png +0 -0
  45. search/googlescholar/gscholar7.png +0 -0
  46. search/googlescholar/gscholar8.png +0 -0
  47. search/googlescholar/gscholar9.png +0 -0
  48. search/scholar.md +66 -0
  49. search/search.txt +1 -0
  50. search/ssrn/ssrn1.png +0 -0
.gitattributes CHANGED
@@ -33,3 +33,34 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
33
  *.zip filter=lfs diff=lfs merge=lfs -text
34
  *.zst filter=lfs diff=lfs merge=lfs -text
35
  *tfevents* filter=lfs diff=lfs merge=lfs -text
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
33
  *.zip filter=lfs diff=lfs merge=lfs -text
34
  *.zst filter=lfs diff=lfs merge=lfs -text
35
  *tfevents* filter=lfs diff=lfs merge=lfs -text
36
+ 2026-01-20[[:space:]]20-32-35.mp4 filter=lfs diff=lfs merge=lfs -text
37
+ 2026-01-21[[:space:]]10-45-20.mp4 filter=lfs diff=lfs merge=lfs -text
38
+ 2026-01-21[[:space:]]14-03-26.mp4 filter=lfs diff=lfs merge=lfs -text
39
+ 2026-01-22[[:space:]]08-42-06.mp4 filter=lfs diff=lfs merge=lfs -text
40
+ 2026-01-22[[:space:]]10-09-23.mp4 filter=lfs diff=lfs merge=lfs -text
41
+ funny[[:space:]]replies/funny3.png filter=lfs diff=lfs merge=lfs -text
42
+ Install[[:space:]]VisualStudio[[:space:]]C++[[:space:]]Build[[:space:]]Tools.png filter=lfs diff=lfs merge=lfs -text
43
+ search/arxiv/arxiv1.png filter=lfs diff=lfs merge=lfs -text
44
+ search/arxiv/arxiv2.png filter=lfs diff=lfs merge=lfs -text
45
+ search/arxiv/arxiv3.png filter=lfs diff=lfs merge=lfs -text
46
+ search/arxiv/arxiv4.png filter=lfs diff=lfs merge=lfs -text
47
+ search/arxiv/arxiv5.png filter=lfs diff=lfs merge=lfs -text
48
+ search/arxiv/arxiv6.png filter=lfs diff=lfs merge=lfs -text
49
+ search/arxiv/arxiv7.png filter=lfs diff=lfs merge=lfs -text
50
+ search/arxiv/arxiv8.png filter=lfs diff=lfs merge=lfs -text
51
+ search/arxiv/arxiv9.png filter=lfs diff=lfs merge=lfs -text
52
+ search/baiduscholarly/baiduscholarly2.png filter=lfs diff=lfs merge=lfs -text
53
+ search/baiduscholarly/baiduscholarly3.png filter=lfs diff=lfs merge=lfs -text
54
+ search/baiduscholarly/baiduscholarly4.png filter=lfs diff=lfs merge=lfs -text
55
+ search/baiduscholarly/baiduscholarly5.png filter=lfs diff=lfs merge=lfs -text
56
+ search/baiduscholarly/baiduscholarly6.png filter=lfs diff=lfs merge=lfs -text
57
+ search/baiduscholarly/baiduscholarly7.png filter=lfs diff=lfs merge=lfs -text
58
+ search/baiduscholarly/baiduscholarly8.png filter=lfs diff=lfs merge=lfs -text
59
+ search/baiduscholarly/baiduscholarly9.png filter=lfs diff=lfs merge=lfs -text
60
+ search/ssrn/ssrn3.png filter=lfs diff=lfs merge=lfs -text
61
+ search/ssrn/ssrn4.png filter=lfs diff=lfs merge=lfs -text
62
+ search/ssrn/ssrn5.png filter=lfs diff=lfs merge=lfs -text
63
+ survey/ans1.png filter=lfs diff=lfs merge=lfs -text
64
+ survey/ans5.png filter=lfs diff=lfs merge=lfs -text
65
+ survey/ans6.png filter=lfs diff=lfs merge=lfs -text
66
+ survey/grok's[[:space:]]validation[[:space:]]to[[:space:]]my[[:space:]]proof-of-work.png filter=lfs diff=lfs merge=lfs -text
2026-01-20 20-32-35.mp4 ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:051d78448902b28a2dc924c0e39d97b9e9cc824725199534ed0b469120639407
3
+ size 1805330
2026-01-21 10-45-20.mp4 ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:593723d5b2e5c2ec2d89c8e2e42b286a0da940e93314109ec23bbc1c2bfb2337
3
+ size 3690040
2026-01-21 14-03-26.mp4 ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:8aee69e82d76a2e3c606030fd402d7ec46c815de6cdb4557ca6727caca1aa99e
3
+ size 1761437
2026-01-22 08-42-06.mp4 ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:655c73933a338d1637fd6c37238da565df3267771c2673081890d0e17e7faf48
3
+ size 13171932
2026-01-22 10-09-23.mp4 ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:67735df868c427e75eaf564b544fbc69c589ce38f094efe3d1fe3a56ba44abe7
3
+ size 3233734
Install VisualStudio C++ Build Tools.png ADDED

Git LFS Details

  • SHA256: bc0ffd7a10ba6e128f4b164ffc633a7dc9ea26182710fd7c2511fb32c08e29fa
  • Pointer size: 131 Bytes
  • Size of remote file: 109 kB
LICENSE ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Rembrant Oyangoren Albeos
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
MQL5/Experts/ZmqPublisher.mq5 ADDED
@@ -0,0 +1,77 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ //+------------------------------------------------------------------+
2
+ //| ZmqPublisher.mq5 |
3
+ //| Copyright 2024, Antigravity |
4
+ //| |
5
+ //+------------------------------------------------------------------+
6
+ #property copyright "Antigravity"
7
+ #property link ""
8
+ #property version "1.00"
9
+
10
+ // Include our ZMQ wrapper
11
+ #include <Zmq/Zmq.mqh>
12
+
13
+ // Input parameters
14
+ input string InpBindAddress = "tcp://0.0.0.0:5555"; // Bind Address
15
+
16
+ CZmq *g_publisher;
17
+
18
+ //+------------------------------------------------------------------+
19
+ //| Expert initialization function |
20
+ //+------------------------------------------------------------------+
21
+ int OnInit()
22
+ {
23
+ Print("Initializing ZmqPublisher...");
24
+
25
+ g_publisher = new CZmq();
26
+
27
+ if(!g_publisher.Init(ZMQ_PUB)) {
28
+ Print("Failed to initialize ZMQ Publisher");
29
+ return(INIT_FAILED);
30
+ }
31
+
32
+ if(!g_publisher.Bind(InpBindAddress)) {
33
+ Print("Failed to bind to ", InpBindAddress);
34
+ return(INIT_FAILED);
35
+ }
36
+
37
+ Print("ZmqPublisher bound to ", InpBindAddress);
38
+ return(INIT_SUCCEEDED);
39
+ }
40
+
41
+ //+------------------------------------------------------------------+
42
+ //| Expert deinitialization function |
43
+ //+------------------------------------------------------------------+
44
+ void OnDeinit(const int reason)
45
+ {
46
+ Print("Deinitializing ZmqPublisher...");
47
+ if(g_publisher != NULL) {
48
+ g_publisher.Shutdown();
49
+ delete g_publisher;
50
+ g_publisher = NULL;
51
+ }
52
+ }
53
+
54
+ //+------------------------------------------------------------------+
55
+ //| Expert tick function |
56
+ //+------------------------------------------------------------------+
57
+ void OnTick()
58
+ {
59
+ if(g_publisher == NULL) return;
60
+
61
+ MqlTick tick;
62
+ if(SymbolInfoTick(_Symbol, tick)) {
63
+ // Create JSON string manually to avoid complex dependencies
64
+ // Format: {"symbol": "XAUUSD", "bid": 2000.5, "ask": 2000.8, "time": 123456789}
65
+
66
+ string json;
67
+ StringConcatenate(json, "{\"symbol\":\"", _Symbol,
68
+ "\",\"bid\":", DoubleToString(tick.bid, _Digits),
69
+ ",\"ask\":", DoubleToString(tick.ask, _Digits),
70
+ ",\"time\":", IntegerToString(tick.time),
71
+ "}");
72
+
73
+ g_publisher.Send(json);
74
+ // Print("Published: ", json); // Uncomment for debugging (spammy)
75
+ }
76
+ }
77
+ //+------------------------------------------------------------------+
MQL5/Include/Zmq/Zmq.mqh ADDED
@@ -0,0 +1,112 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ //+------------------------------------------------------------------+
2
+ //| Zmq.mqh |
3
+ //| Copyright 2024, Antigravity |
4
+ //| |
5
+ //+------------------------------------------------------------------+
6
+ #property copyright "Antigravity"
7
+ #property link ""
8
+ #property strict
9
+
10
+ // Define ZMQ constants
11
+ #define ZMQ_PUB 1
12
+ #define ZMQ_SUB 2
13
+ #define ZMQ_REQ 3
14
+ #define ZMQ_REP 4
15
+
16
+ #define ZMQ_NOBLOCK 1
17
+
18
+ // Import functions from libzmq.dll
19
+ // NOTE: Make sure libzmq.dll is in your MQL5/Libraries folder
20
+ // Handles are void* (64-bit on x64), so using 'long' works for both 32 (too big but safe) and 64 bit
21
+ #import "libzmq.dll"
22
+ long zmq_ctx_new();
23
+ int zmq_ctx_term(long context);
24
+ long zmq_socket(long context, int type);
25
+ int zmq_close(long socket);
26
+ int zmq_bind(long socket, uchar &endpoint[]);
27
+ int zmq_connect(long socket, uchar &endpoint[]);
28
+ int zmq_send(long socket, uchar &buf[], int len, int flags);
29
+ int zmq_recv(long socket, uchar &buf[], int len, int flags);
30
+ int zmq_errno();
31
+ #import
32
+
33
+ class CZmq {
34
+ private:
35
+ long m_context;
36
+ long m_socket;
37
+ bool m_initialized;
38
+
39
+ public:
40
+ CZmq() {
41
+ m_context = 0;
42
+ m_socket = 0;
43
+ m_initialized = false;
44
+ }
45
+
46
+ ~CZmq() {
47
+ Shutdown();
48
+ }
49
+
50
+ bool Init(int type) {
51
+ if(m_initialized) return true;
52
+
53
+ m_context = zmq_ctx_new();
54
+ if(m_context == 0) {
55
+ Print("ZMQ Init failed: Context creation error");
56
+ return false;
57
+ }
58
+
59
+ m_socket = zmq_socket(m_context, type);
60
+ if(m_socket == 0) {
61
+ Print("ZMQ Init failed: Socket creation error");
62
+ return false;
63
+ }
64
+
65
+ m_initialized = true;
66
+ return true;
67
+ }
68
+
69
+ bool Bind(string endpoint) {
70
+ if(!m_initialized) return false;
71
+
72
+ uchar data[];
73
+ StringToCharArray(endpoint, data, 0, WHOLE_ARRAY, CP_UTF8);
74
+
75
+ int rc = zmq_bind(m_socket, data);
76
+ if(rc != 0) {
77
+ Print("ZMQ Bind failed. Error: ", zmq_errno());
78
+ return false;
79
+ }
80
+ return true;
81
+ }
82
+
83
+ int Send(string message, bool nonBlocking = true) {
84
+ if(!m_initialized) return -1;
85
+
86
+ uchar data[];
87
+ StringToCharArray(message, data, 0, WHOLE_ARRAY, CP_UTF8);
88
+ // StringToCharArray includes null terminator, we might not want to send it
89
+ // ZMQ messages are just bytes.
90
+ // -1 because array size includes null char, usually we check ArraySize(data)
91
+ int len = ArraySize(data) - 1;
92
+ if (len < 0) len = 0;
93
+
94
+ int flags = 0;
95
+ if(nonBlocking) flags = ZMQ_NOBLOCK;
96
+
97
+ int bytesSent = zmq_send(m_socket, data, len, flags);
98
+ return bytesSent;
99
+ }
100
+
101
+ void Shutdown() {
102
+ if(m_socket != 0) {
103
+ zmq_close(m_socket);
104
+ m_socket = 0;
105
+ }
106
+ if(m_context != 0) {
107
+ zmq_ctx_term(m_context);
108
+ m_context = 0;
109
+ }
110
+ m_initialized = false;
111
+ }
112
+ };
README.md ADDED
@@ -0,0 +1,324 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ## Rust + ZMQ + MT5's MQL5: Exploiting Micro-Second BID/ASK Live Trading Data
2
+
3
+ The system operates on a publisher-subscriber model using ZeroMQ (ZMQ) to bridge MetaTrader 5 (via MQL5) and the external Rust application. To exploit micro-second BID/ASK live trading data to create a simple orderflow charting tool.
4
+
5
+ ![Rust](https://img.shields.io/badge/Rust-000000?style=for-the-badge&logo=rust&logoColor=white)
6
+ ![MetaTrader 5](https://img.shields.io/badge/MetaTrader_5-0075FF?style=for-the-badge&logo=metatraderfive&logoColor=white)
7
+ ![ZeroMQ](https://img.shields.io/badge/ZeroMQ-DF0000?style=for-the-badge&logo=zeromq&logoColor=white)
8
+ ![MQL5](https://img.shields.io/badge/MQL5-F5A623?style=for-the-badge&logo=metatraderfive&logoColor=white)
9
+ ![License](https://img.shields.io/badge/License-MIT-green?style=for-the-badge)
10
+
11
+ ## Software Demonstration
12
+
13
+ https://github.com/user-attachments/assets/71c51bb2-324b-4c97-ab0d-807a2c0d0d7c
14
+
15
+ ### Mechanics
16
+ 1. **Publisher (MQL5)**:
17
+ - The `ZmqPublisher.mq5` Expert Advisor initializes a ZMQ **PUB** socket and binds it to `tcp://*:5555`.
18
+ - On every market tick (`OnTick()`), it retrieves the current Bid/Ask prices.
19
+ - It constructs a JSON object (e.g., `{"symbol": "XAUUSD", "bid": 2025.50, ...}`) and publishes it as a message.
20
+
21
+ 2. **Subscriber (Rust)**:
22
+ - The `mt5-chart` application initializes a ZMQ **SUB** socket and connects to `tcp://127.0.0.1:5555`.
23
+ - It runs an asynchronous Tokio task that listens for incoming ZMQ messages.
24
+ - Upon receiving a message, it deserializes the JSON data into a Rust struct (`TickData`).
25
+ - The data is sent via an internal channel (`mpsc`) to the GUI thread.
26
+ - The `eframe`/`egui` interface updates the chart and labels in real-time.
27
+
28
+ ### Workflow Algorithm
29
+
30
+ ```mermaid
31
+ sequenceDiagram
32
+ participant MT5 as MetaTrader 5 (MQL5)
33
+ participant ZMQ as ZeroMQ (PUB/SUB)
34
+ participant Rust as Rust Client (mt5-chart)
35
+ participant GUI as GUI (egui)
36
+
37
+ Note over MT5, Rust: Initialization
38
+ Rust->>ZMQ: Connect (SUB) to tcp://127.0.0.1:5555
39
+ MT5->>ZMQ: Bind (PUB) to tcp://0.0.0.0:5555
40
+
41
+ Note over MT5, GUI: Real-time Tick Loop
42
+ loop Every Tick
43
+ MT5->>MT5: Get SymbolInfoTick
44
+ MT5->>ZMQ: Publish JSON {"symbol":..., "bid":...}
45
+ ZMQ->>Rust: Receive Message
46
+ Rust->>Rust: Parse JSON to TickData
47
+ Rust->>GUI: Send Data via Channel
48
+ GUI->>GUI: Update Plot & Request Repaint
49
+ end
50
+ ```
51
+
52
+
53
+ ---
54
+
55
+ ## Trivia
56
+
57
+ [<img width="911" height="214" alt="image" src="https://github.com/user-attachments/assets/67fb1c13-53db-4056-b022-e8a64db493e4" />](https://x.com/qsrsunstoic/status/2014165161381363739)
58
+ > **The very First**: Exploiting micro-second BID/ASK live trading data from **MetaTrader 5 (MT5)** using the specific combination of **Rust + ZeroMQ (ZMQ) + MetaQuotes Language (MQL5)**.
59
+
60
+ I was trying to make a trading orderflows platform, and I came up with an idea: why not use MT5 as datafeed for it? Unfortunately, there are no existing ideal projects I could use as a benchmark, hence I created my own. <br><br>
61
+ I've worked on and made ~100+ Python trading projects, and I always use MT5 as datafeed, but I want faster; that is why I came up with using Rust as a solution, and ZMQ binding for MT5 is a common practice. In worse case sscenario, there are no _Rust + ZMQ + MT5_ combination projects existed in the world, which is pretty nuts. I didn't know it only existed in my head, Lmao. So I created it with the help of Google Antigravity.
62
+
63
+ This simple orderflow tool will serve as a benchmark for future projects.
64
+
65
+ ## A survey for AI leading platforms
66
+
67
+ Extensive research across GitHub, Hugging Face, and consultation with 9 leading AI models confirmed that no prior public projects utilizing this exact high-performance stack existed before this implementation.
68
+
69
+ **AI Survey Results**
70
+ > "no public projects combination of Rust, ZeroMQ (ZMQ), and MetaTrader 5 (MT5)."
71
+
72
+ **Proof**
73
+
74
+
75
+ <table align="center">
76
+ <tr>
77
+ <td align="center">
78
+ <video
79
+ src="https://github.com/user-attachments/assets/18f9865c-39b8-40cd-a969-733c435621db"
80
+ controls
81
+ muted
82
+ loop
83
+ ></video>
84
+ </td>
85
+ <td align="center">
86
+ <video
87
+ src="https://github.com/user-attachments/assets/ccff1713-6c14-46cc-94b0-a1831f4a8b0d"
88
+ controls
89
+ muted
90
+ loop
91
+ ></video>
92
+ </td>
93
+ </tr>
94
+ <tr>
95
+ <td align="center">
96
+ <video
97
+ src="https://github.com/user-attachments/assets/e9631b52-e548-4224-8684-72aa282c70f0"
98
+ controls
99
+ muted
100
+ loop
101
+ ></video>
102
+ </td>
103
+ <td align="center">
104
+ <video
105
+ src="https://github.com/user-attachments/assets/fe251361-1103-4c6b-b198-88134820a074"
106
+ controls
107
+ muted
108
+ loop
109
+ ></video>
110
+ </td>
111
+ </tr>
112
+ </table>
113
+
114
+
115
+
116
+ **Additional Validation**:
117
+ <table cellspacing="0" cellpadding="0">
118
+ <tr>
119
+ <td><img src="survey/ans1.png" alt=""></td>
120
+ <td><img src="survey/ans2.png" alt=""></td>
121
+ <td><img src="survey/ans3.png" alt=""></td>
122
+ </tr>
123
+ <tr>
124
+ <td><img src="survey/ans4.png" alt=""></td>
125
+ <td><img src="survey/ans5.png" alt=""></td>
126
+ <td><img src="survey/ans6.png" alt=""></td>
127
+ </tr>
128
+ <tr>
129
+ <td><img src="survey/ans7.png" alt=""></td>
130
+ <td><img src="survey/ans8.png" alt=""></td>
131
+ <td><img src="survey/ans9.png" alt=""></td>
132
+ </tr>
133
+ </table>
134
+
135
+
136
+ I used leading AI platforms (Grok, Gemini, Claude, ChatGPT, MSCopilot, Perplexity, Baidu (Ernie Bot), DeepSeek, Qwen) to validate my claim for _"**The very First**: Exploiting micro-second BID/ASK live trading data from **MetaTrader 5 (MT5)** using the specific combination of **Rust + ZeroMQ (ZMQ) + MetaQuotes Language (MQL5).**"_
137
+
138
+ In addition, I ran nine different search combinations on each of four scholarly platforms: Arxiv, Google Scholar, SSRN, and Baidu Scholar. The detailed results are documented in [*scholar.md*](search/scholar.md).
139
+
140
+ *Visit my previous app to explore 284 AI platforms in one place, [AiQG](https://aiqg.vercel.app/)*
141
+ <br>
142
+
143
+ During this process, some AI models produced hallucinated results. They suggested projects that only used partial pairs, such as Python with ZMQ or C++ with ZMQ, but never the full combination of all three components that I specified, namely Rust + ZMQ + MT5.
144
+
145
+ To correct this, I provided an explicit follow-up instruction stating ***"strictly those 3 combination"***. I then repeated the same query: ***"Show me GitHub or Hugging projects or any link that has 'Rust + ZMQ + MT5 combination' (strictly those 3), never miss a single link"***.
146
+
147
+ MetaTrader 5 uses MQL5 as its native language, which is built on C++. My objective was to extract live trading data from MT5 via ZMQ and process and visualize it in Rust to enable fast development of a high performance charting tool. After this clarification and repeated querying, all platforms returned the same conclusion.
148
+
149
+
150
+ > "no public projects combination of Rust, ZeroMQ (ZMQ), and MetaTrader 5 (MT5)."
151
+
152
+ Since no one did that combination, at least at the time of developing/writing *(Jan 20-21, 2026)*, I've decided to create one.
153
+
154
+ ---
155
+
156
+ ## Project Structure
157
+ These are the only necessary files that you need to have.
158
+
159
+ ```graphql
160
+ Rust-ZMQ-MQL5
161
+ ├── MQL5 # Relocate this (individual files) into MT5's literal path directory, located outside this repository
162
+ │ ├── Experts
163
+ │ │ └── ZmqPublisher.mq5 # The "Server": Publishes Tick Data via TCP
164
+ │ ├── Include
165
+ │ │ └── Zmq
166
+ │ │ └── Zmq.mqh # ZMQ Wrapper Library for MQL5 (64-bit compatible)
167
+ │ └── Libraries
168
+ │ ├── libzmq.dll # 64-bit ZeroMQ DLL (Required)
169
+ │ └── libsodium.dll # Dependency for libzmq (Required)
170
+ ├── mt5-chart # The "Client": Rust Desktop App
171
+ │ ├── src
172
+ │ │ └── main.rs # Main Application Logic (Subscribes & Plots)
173
+ │ └── Cargo.toml # Project Dependencies
174
+ └── README.md
175
+
176
+ ```
177
+
178
+ ---
179
+
180
+ ## Functionality
181
+
182
+ The system consists of two main components acting in a Publisher-Subscriber model data flow:
183
+
184
+ ### 1. The Publisher (MetaTrader 5 / MQL5)
185
+ * **Role**: The Data Source.
186
+ * **Implementation**: An Expert Advisor (`ZmqPublisher.mq5`) utilizing a custom ZMQ wrapper (`Zmq.mqh`).
187
+ * **Protocol**: Binds to a TCP HOST on port `5555`.
188
+ * **Operation**: On every incoming tick (`OnTick` data event), it:
189
+ * Extracts Symbol, Bid price, Ask price, and Server Time.
190
+ * Serializes this data into a JSON string.
191
+ * Publishes it instantly to the ZMQ socket.
192
+
193
+ ### 2. The Subscriber (Rust)
194
+ * **Role**: The Data Consumer & Visualization.
195
+ * **Implementation**: A high-performance GUI application built with `eframe` (egui).
196
+ * **Protocol**: Connects to the TCP socket on `localhost:5555`.
197
+ * **Operation**:
198
+ * **Asynchronous Data Ingestion**: A background `tokio` task listens for incoming ZMQ messages.
199
+ * **Deserialization**: Parses the raw JSON bytes into Rust `TickData` structs.
200
+ * **Real-time Plotting**: Updates an `egui_plot` chart at 60fps (or higher) to visualize the Bid/Ask spread in real-time.
201
+
202
+ ---
203
+
204
+ ## Installation & Usage
205
+
206
+ ### Prerequisites
207
+ * **MetaTrader 5** Client [*link*](https://www.metatrader5.com/) and it must already be connected to a Broker (use whatever broker you like)
208
+ * **Rust** (via `rustup`) [*link*](https://rust-lang.org/tools/install/) and configure its file path [*Link*](https://www.youtube.com/watch?v=2PmPWWTmfiU) on your computer.
209
+ * **Visual Studio Build Tools (C++)** (Required for Rust Linker) [*link*](https://visualstudio.microsoft.com/visual-cpp-build-tools/) select the C++ Build tools (in my case I've downloaded 6gb)
210
+
211
+ ### Step 1: MT5 Setup
212
+ 1. Copy `MQL5/Experts/ZmqPublisher.mq5` to your MT5 Data Folder's `MQL5/Experts/`. *(relocate outside this repository, into your MT5 literal path directory)*<br>
213
+ 2. Copy `MQL5/Include/Zmq/Zmq.mqh` to `MQL5/Include/Zmq/`. *(do the same for this)*<br>
214
+ 3. **Crucial**: Download `libzmq.dll` and `libsodium.dll` (64-bit versions) and place them in `MQL5/Libraries`.<br>
215
+ 4. Open the MT5 platform, look at the top of the screen. Go to **Tools -> Options -> Expert Advisors** and check **"Allow DLL imports"**.<br>
216
+ 5. Open the MetaEditor5. Go to **Navigator (Ctrl+d) -> Experts -> and find ZmqPublisher.mq5**. Select and compile 'ZmqPublisher.mq5' once.<br>
217
+ 6. Go back to the MT5 platform. Drag and drop `ZmqPublisher` onto any chart.<br>
218
+ 7. Check. Go to **Toolbox (ctrl+t) -> Journal** section, check if it says *Success Message*: `ZmqPublisher bound to tcp://0.0.0.0:5555`
219
+
220
+ ### Step 2: Rust Client Setup
221
+ 1. Open a terminal (for instance: Windows PowerShell, not a code editor like VS Code) in the `mt5-chart` folder. Or simply copy the file path
222
+ ```bash
223
+ cd mt5-chart
224
+
225
+ # In my case, I will bash
226
+ cd C:\Users\User\Desktop\VSCode\Rust-ZMQ-MT5\mt5-chart
227
+ ```
228
+ 3. Then run the application using another bash:
229
+ ```bash
230
+ cargo run --release
231
+ ```
232
+
233
+ ---
234
+
235
+ ## Common Errors & Troubleshooting
236
+
237
+ This project combines three distinct technologies (Rust, MQL5, ZeroMQ) across two different runtime environments (MetaTrader 5 and Windows Desktop). This complexity can lead to specific errors. Below is a comprehensive guide to resolving every known issue.
238
+
239
+ ### 1. Critical: Antivirus & Terminal Permissions
240
+ **Symptom**: `Access Denied`, `Terminated`, or the Rust window appears and immediately closes.
241
+ * **Cause**: Many Antivirus software (including Windows Defender) and built-in IDE terminals (like VS Code's integrated terminal) restrict programs from opening high-speed network sockets or interacting with other processes.
242
+ * **Fix**:
243
+ 1. **Do NOT use VS Code's Intergrated Terminal**. It often lacks the necessary permissions.
244
+ 2. Open a **standalone** Windows PowerShell instance as Administrator.
245
+ 3. Navigate to your project directory manually (`cd C:\Users\...\mt5-chart`).
246
+ 4. Run `cargo run --release` from there.
247
+
248
+ ### 2. MQL5: "Access Violation" / Crash on Load
249
+ **Symptom**: MetaTrader 5 crashes instantly when you drag the EA onto a chart, or the EA simply disappears from the chart "smiling face" icon.
250
+ * **Cause**: **64-bit Pointer Truncation**. The original MQL5 language was often used on 32-bit systems where an `int` (4 bytes) was the same size as a pointer. On modern 64-bit MT5, pointers are 8 bytes (`long`). If you cast a pointer to an `int`, you lose half the memory address, causing an immediate crash when the program tries to access that invalid location.
251
+ * **Fix**:
252
+ * Never use `int` for handles. Use `long` or `intptr_t`.
253
+ * Our provided `Zmq.mqh` has been patched to use `long` for all socket context and socket handles. Ensure you are completely replacing your old `Zmq.mqh` with the one from this repository.
254
+
255
+ ### 3. MQL5: "Error 126" (Cannot Load Library)
256
+ **Symptom**: The Expert Advisor log shows `Cannot load 'libzmq.dll' [126]`.
257
+ * **Cause**: This error means "Module Not Found". It happens for one of three reasons:
258
+ 1. **Missing DLL**: You didn't put `libzmq.dll` in the `MQL5/Libraries` folder.
259
+ 2. **Missing Dependency**: `libzmq.dll` itself depends on `libsodium.dll` and the **Visual C++ Redistributable**. If *those* are missing, `libzmq.dll` will fail to load, triggering the same header error.
260
+ 3. **Architecture Mismatch**: You downloaded a 32-bit DLL for a 64-bit MT5 terminal (or vice versa).
261
+ * **Fix**:
262
+ * Ensure both `libzmq.dll` AND `libsodium.dll` are in `MQL5/Libraries`.
263
+ * Ensure you downloaded the **x64 (64-bit)** versions of these DLLs.
264
+ * Install the latest **Microsoft Visual C++ Redistributable** (x64).
265
+
266
+ ### 4. MQL5: "Error 22" (Invalid Argument) during Bind
267
+ **Symptom**: The EA loads, but the Journal says `ZmqPublisher: Bind failed with error 22`.
268
+ * **Cause 1**: **Binding to Wildcard**. Defaulting to `tcp://*:5555` works on Linux but can fail on specific Windows network configurations or Firewall setups.
269
+ * **Fix**: Change the bind address in your code (or input settings) to `tcp://0.0.0.0:5555` to explicitly bind to all interfaces, or `tcp://127.0.0.1:5555` for local-only.
270
+ * **Cause 2**: **String Encoding**. MQL5 uses `wchar_t` (Unicode) for strings internally. ZeroMQ demands C-style standard ASCII/UTF-8 strings. Passing a raw MQL string to the DLL sends garbage bytes.
271
+ * **Fix**: The `Zmq.mqh` wrapper must use `StringToCharArray` to convert the string to a byte array before passing it to `zmq_bind`.
272
+
273
+ ### 5. MQL5: "DLL Imports Not Allowed"
274
+ **Symptom**: `Expert 'ZmqPublisher' cannot be loaded because DLL imports are not allowed`.
275
+ * **Cause**: Security setting in MT5.
276
+ * **Fix**: Go to **Tools -> Options -> Expert Advisors** and check the box **"Allow DLL imports"**. This is mandatory.
277
+
278
+ ### 6. Rust: "Linker 'link.exe' not found"
279
+ **Symptom**: `cargo run` fails with a massive wall of red text mentioning `link.exe` or `msvc`.
280
+ * **Cause**: Rust on Windows (MSVC version) relies on the Microsoft C++ Linker, which is not installed by default with Windows.
281
+ * **Fix**:
282
+ 1. Download the **Visual Studio Build Tools**.
283
+ 2. In the installer, select **"Desktop development with C++"**.
284
+ 3. Ensure the "MSVC ... -C++ x64/x86 build tools" component is checked on the right side.
285
+ 4. Install (approx. 5-6GB).
286
+
287
+ ### 7. Rust: "OS Error 32" (File used by another process)
288
+ **Symptom**: `error: linking with link.exe failed` or `Access is denied` when trying to run/build.
289
+ * **Cause**: The compiled executable (`mt5-chart.exe`) is currently running, or is locked by:
290
+ * A previous instance that didn't close properly.
291
+ * The VS Code underlying process.
292
+ * Your Antivirus scanning the new `.exe`.
293
+ * **Fix**:
294
+ 1. **Close the GUI window** fully.
295
+ 2. If it persists, open Task Manager and kill `mt5-chart.exe`.
296
+ 3. Run `cargo clean` to wipe the locked artifact, then `cargo run --release` again.
297
+
298
+ ### 8. Generic: ZeroMQ Message Format Mismatches
299
+ **Symptom**: Rust client connects but panics with `Error parsing JSON` or prints weird symbols.
300
+ * **Cause**: The MQL5 Publisher and Rust Subscriber must agree *exactly* on the data format. If MQL5 sends `{"bid": ...}` but Rust expects `{"Bid": ...}` (case sensitivity) or if MQL5 sends a trailing null byte `\0` that JSON parsers hate.
301
+ * **Fix**:
302
+ * Ensure the JSON structure key names match exactly.
303
+ * In Rust, strip the trailing null character if necessary: `msg.trim_matches(char::from(0))`.
304
+
305
+ ### 9. Generic: "Address in Use" (EADDRINUSE)
306
+ **Symptom**: You restart the EA and it says `Bind failed`.
307
+ * **Cause**: You cannot bind to port 5555 if something is already bound to it. Often, when you remove an EA, MT5 might not release the DLL handle instantly, keeping the socket open.
308
+ * **Fix**: Restart the MetaTrader 5 terminal completely to force-close all DLL handles.
309
+
310
+ ---
311
+
312
+ ## Citation
313
+
314
+ If you use this project in your research or application, please cite it as follows:
315
+
316
+ ```bibtex
317
+ @software{RustZmqMt5,
318
+ author = {Albeos, Rembrant Oyangoren},
319
+ title = {Rust + ZMQ + MT5's MQL5: Exploiting Micro-Second BID/ASK Live Trading Data},
320
+ year = {2026},
321
+ url = {https://github.com/unban-algorembrant/Rust-ZMQ-MQL5},
322
+ note = {First known implementation for exploiting micro-second live BID/ASK trading data using Rust + ZMQ + MT5's MQL5}
323
+ }
324
+ ```
STRUCTURE.md ADDED
@@ -0,0 +1,85 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ## Project Structure
2
+
3
+ ```text
4
+ Rust-ZMQ-MQL5/
5
+ ├── funny replies/
6
+ │ ├── funny1.png
7
+ │ ├── funny2.png
8
+ │ ├── funny3.png
9
+ │ └── funny4.png
10
+ ├── MQL5/
11
+ │ ├── Experts/
12
+ │ │ └── ZmqPublisher.mq5
13
+ │ └── Include/
14
+ │ └── Zmq/
15
+ │ └── Zmq.mqh
16
+ ├── mt5-chart/
17
+ │ ├── src/
18
+ │ │ └── main.rs
19
+ │ ├── Cargo.lock
20
+ │ └── Cargo.toml
21
+ ├── search/
22
+ │ ├── arxiv/
23
+ │ │ ├── arxiv1.png
24
+ │ │ ├── arxiv2.png
25
+ │ │ ├── arxiv3.png
26
+ │ │ ├── arxiv4.png
27
+ │ │ ├── arxiv5.png
28
+ │ │ ├── arxiv6.png
29
+ │ │ ├── arxiv7.png
30
+ │ │ ├── arxiv8.png
31
+ │ │ └── arxiv9.png
32
+ │ ├── baiduscholarly/
33
+ │ │ ├── baiduscholarly1.png
34
+ │ │ ├── baiduscholarly2.png
35
+ │ │ ├── baiduscholarly3.png
36
+ │ │ ├── baiduscholarly4.png
37
+ │ │ ├── baiduscholarly5.png
38
+ │ │ ├── baiduscholarly6.png
39
+ │ │ ├── baiduscholarly7.png
40
+ │ │ ├── baiduscholarly8.png
41
+ │ │ └── baiduscholarly9.png
42
+ │ ├── googlescholar/
43
+ │ │ ├── gscholar1.png
44
+ │ │ ├── gscholar2.png
45
+ │ │ ├── gscholar3.png
46
+ │ │ ├── gscholar4.png
47
+ │ │ ├── gscholar5.png
48
+ │ │ ├── gscholar6.png
49
+ │ │ ├── gscholar7.png
50
+ │ │ ├── gscholar8.png
51
+ │ │ └── gscholar9.png
52
+ │ ├── ssrn/
53
+ │ │ ├── ssrn1.png
54
+ │ │ ├── ssrn2.png
55
+ │ │ ├── ssrn3.png
56
+ │ │ ├── ssrn4.png
57
+ │ │ ├── ssrn5.png
58
+ │ │ ├── ssrn6.png
59
+ │ │ ├── ssrn7.png
60
+ │ │ ├── ssrn8.png
61
+ │ │ └── ssrn9.png
62
+ │ ├── scholar.md
63
+ │ └── search.txt
64
+ ├── survey/
65
+ │ ├── ans1.png
66
+ │ ├── ans2.png
67
+ │ ├── ans3.png
68
+ │ ├── ans4.png
69
+ │ ├── ans5.png
70
+ │ ├── ans6.png
71
+ │ ├── ans7.png
72
+ │ ├── ans8.png
73
+ │ ├── ans9.png
74
+ │ └── grok's validation to my proof-of-work.png
75
+ ├── 2026-01-20 20-32-35.mp4
76
+ ├── 2026-01-21 10-45-20.mp4
77
+ ├── 2026-01-21 14-03-26.mp4
78
+ ├── 2026-01-22 08-42-06.mp4
79
+ ├── 2026-01-22 10-09-23.mp4
80
+ ├── Install VisualStudio C++ Build Tools.png
81
+ ├── LICENSE
82
+ ├── README.md
83
+ ├── summary.md
84
+ └── TECHSTACK.md
85
+ ```
TECHSTACK.md ADDED
@@ -0,0 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ## Techstack
2
+
3
+ Audit of **Rust-ZMQ-MQL5** project files (excluding environment and cache):
4
+
5
+ | File Type | Count | Size (KB) |
6
+ | :--- | :--- | :--- |
7
+ | PNG Image (.png) | 51 | 5,126.5 |
8
+ | MP4 Video (.mp4) | 5 | 23,107.9 |
9
+ | Markdown (.md) | 3 | 23.4 |
10
+ | (no extension) | 1 | 1.1 |
11
+ | Lock File (.lock) | 1 | 112.6 |
12
+ | MQL Header (.mqh) | 1 | 3.1 |
13
+ | MQL5 Source (.mq5) | 1 | 2.7 |
14
+ | Plain Text (.txt) | 1 | 0.1 |
15
+ | Rust (.rs) | 1 | 4.5 |
16
+ | TOML (.toml) | 1 | 0.3 |
17
+ | **Total** | **66** | **28,382.1** |
funny replies/funny1.png ADDED
funny replies/funny2.png ADDED
funny replies/funny3.png ADDED

Git LFS Details

  • SHA256: 6ec44831b92449197dd5eb066f6e957d2826f354565d30b4206791b64823ce9a
  • Pointer size: 131 Bytes
  • Size of remote file: 128 kB
funny replies/funny4.png ADDED
mt5-chart/Cargo.lock ADDED
The diff for this file is too large to render. See raw diff
 
mt5-chart/Cargo.toml ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ [package]
2
+ name = "mt5-chart"
3
+ version = "0.1.0"
4
+ edition = "2021"
5
+
6
+ [dependencies]
7
+ eframe = "0.27.1"
8
+ egui = "0.27.1"
9
+ egui_plot = "0.27.1"
10
+ zeromq = "0.5.0-pre"
11
+ serde = { version = "1.0.197", features = ["derive"] }
12
+ serde_json = "1.0.114"
13
+ tokio = { version = "1.36.0", features = ["full"] }
14
+ futures = "0.3.30"
mt5-chart/src/main.rs ADDED
@@ -0,0 +1,127 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ use eframe::egui;
2
+ use egui_plot::{Line, Plot, PlotPoints};
3
+ use serde::Deserialize;
4
+ use std::sync::Arc;
5
+ use tokio::sync::mpsc;
6
+ use zeromq::{Socket, SocketRecv};
7
+
8
+ #[derive(Clone, Debug, Deserialize)]
9
+ struct TickData {
10
+ symbol: String,
11
+ bid: f64,
12
+ ask: f64,
13
+ time: i64,
14
+ }
15
+
16
+ struct Mt5ChartApp {
17
+ receiver: mpsc::Receiver<TickData>,
18
+ data: Vec<TickData>,
19
+ symbol: String,
20
+ }
21
+
22
+ impl Mt5ChartApp {
23
+ fn new(receiver: mpsc::Receiver<TickData>) -> Self {
24
+ Self {
25
+ receiver,
26
+ data: Vec::new(),
27
+ symbol: "Waiting for data...".to_string(),
28
+ }
29
+ }
30
+ }
31
+
32
+ impl eframe::App for Mt5ChartApp {
33
+ fn update(&mut self, ctx: &egui::Context, _frame: &mut eframe::Frame) {
34
+ // Receive all available data from the channel without blocking
35
+ while let Ok(tick) = self.receiver.try_recv() {
36
+ self.symbol = tick.symbol.clone();
37
+ self.data.push(tick);
38
+ // Keep only last 1000 points to avoid memory issues for this demo
39
+ if self.data.len() > 1000 {
40
+ self.data.remove(0);
41
+ }
42
+ }
43
+
44
+ egui::CentralPanel::default().show(ctx, |ui| {
45
+ ui.heading(format!("MT5 Live Chart: {}", self.symbol));
46
+ if let Some(last_tick) = self.data.last() {
47
+ ui.label(format!("Bid: {:.5} | Ask: {:.5}", last_tick.bid, last_tick.ask));
48
+ }
49
+
50
+ let plot = Plot::new("mt5_plot")
51
+ .view_aspect(2.0)
52
+ .legend(egui_plot::Legend::default());
53
+
54
+ plot.show(ui, |plot_ui| {
55
+ let bid_points: PlotPoints = self.data
56
+ .iter()
57
+ .enumerate()
58
+ .map(|(i, t)| [i as f64, t.bid])
59
+ .collect();
60
+
61
+ let ask_points: PlotPoints = self.data
62
+ .iter()
63
+ .enumerate()
64
+ .map(|(i, t)| [i as f64, t.ask])
65
+ .collect();
66
+
67
+ plot_ui.line(Line::new(bid_points).name("Bid").color(egui::Color32::from_rgb(100, 200, 100)));
68
+ plot_ui.line(Line::new(ask_points).name("Ask").color(egui::Color32::from_rgb(200, 100, 100)));
69
+ });
70
+ });
71
+
72
+ // Request a repaint to update the chart continuously
73
+ ctx.request_repaint();
74
+ }
75
+ }
76
+
77
+ #[tokio::main]
78
+ async fn main() -> Result<(), Box<dyn std::error::Error>> {
79
+ let (tx, rx) = mpsc::channel(100);
80
+
81
+ // Spawn ZMQ Subscriber task
82
+ tokio::spawn(async move {
83
+ // ZMQ Context and Socket
84
+ let mut socket = zeromq::SubSocket::new();
85
+ match socket.connect("tcp://127.0.0.1:5555").await {
86
+ Ok(_) => println!("Connected to ZMQ Publisher"),
87
+ Err(e) => eprintln!("Failed to connect to ZMQ: {}", e),
88
+ }
89
+
90
+ let _ = socket.subscribe("").await;
91
+
92
+ loop {
93
+ match socket.recv().await {
94
+ Ok(msg) => {
95
+ // msg is a MultiPart message, usually the first part depends on subscription
96
+ // In our simple case, payload is likely in the first frame or the whole string
97
+ if let Some(payload_bytes) = msg.get(0) {
98
+ if let Ok(json_str) = std::str::from_utf8(payload_bytes) {
99
+ // Attempt to parse JSON
100
+ // The MT5 EA sends: {"symbol":..., "bid":..., ...}
101
+ match serde_json::from_str::<TickData>(json_str) {
102
+ Ok(tick) => {
103
+ if let Err(e) = tx.send(tick).await {
104
+ eprintln!("Channel error: {}", e);
105
+ break;
106
+ }
107
+ }
108
+ Err(e) => eprintln!("JSON Parse Error: {}. Msg: {}", e, json_str),
109
+ }
110
+ }
111
+ }
112
+ }
113
+ Err(e) => {
114
+ eprintln!("ZMQ Recv Error: {}", e);
115
+ tokio::time::sleep(tokio::time::Duration::from_millis(1000)).await;
116
+ }
117
+ }
118
+ }
119
+ });
120
+
121
+ let options = eframe::NativeOptions::default();
122
+ eframe::run_native(
123
+ "Rust + ZMQ + MT5's MQL5 Chart",
124
+ options,
125
+ Box::new(|_cc| Box::new(Mt5ChartApp::new(rx))),
126
+ ).map_err(|e| e.into())
127
+ }
search/arxiv/arxiv1.png ADDED

Git LFS Details

  • SHA256: 20c0c019b0633ce2c7d4a4bb644f7f0793c5c617e143e4cd485d02be506636d4
  • Pointer size: 131 Bytes
  • Size of remote file: 123 kB
search/arxiv/arxiv2.png ADDED

Git LFS Details

  • SHA256: 61fb247cad0d79448832e95a5ea2a08d67e6d1b4ee2aef4b0c66ab57fc82b5e6
  • Pointer size: 131 Bytes
  • Size of remote file: 123 kB
search/arxiv/arxiv3.png ADDED

Git LFS Details

  • SHA256: 54318344463dab026e18350a3ab18047d39179e67296c108eb9113fec50d0cd0
  • Pointer size: 131 Bytes
  • Size of remote file: 118 kB
search/arxiv/arxiv4.png ADDED

Git LFS Details

  • SHA256: f2411da10bd3dd5471d4282e47a2c6d286b0607f40607bcc6bdc63f1ab632d35
  • Pointer size: 131 Bytes
  • Size of remote file: 115 kB
search/arxiv/arxiv5.png ADDED

Git LFS Details

  • SHA256: 60c06af14d982eaa6b3f241fcec032640f5ad6547b046fb67b74bbf4db344b26
  • Pointer size: 131 Bytes
  • Size of remote file: 118 kB
search/arxiv/arxiv6.png ADDED

Git LFS Details

  • SHA256: f55edfc7d1f144d07706a76939589b723a70f670b7ef9924cefb3360105b534f
  • Pointer size: 131 Bytes
  • Size of remote file: 118 kB
search/arxiv/arxiv7.png ADDED

Git LFS Details

  • SHA256: 4d01fdec732c1930349e626f79fc3607a91c42dbece42f276fd54de81a455694
  • Pointer size: 131 Bytes
  • Size of remote file: 134 kB
search/arxiv/arxiv8.png ADDED

Git LFS Details

  • SHA256: b4784bfd948b1df4ae62dd95500cc45fc40eba675fcde23e2576dd3d79d96dd9
  • Pointer size: 131 Bytes
  • Size of remote file: 134 kB
search/arxiv/arxiv9.png ADDED

Git LFS Details

  • SHA256: c9a58acb93c996ac8e82b2ca93aa0f20fa6920acb647518897fdaf20fd1c9446
  • Pointer size: 131 Bytes
  • Size of remote file: 132 kB
search/baiduscholarly/baiduscholarly1.png ADDED
search/baiduscholarly/baiduscholarly2.png ADDED

Git LFS Details

  • SHA256: a2888b76d04eb82fd0809e55fa784347a11097283a84c256f413608d20b02462
  • Pointer size: 131 Bytes
  • Size of remote file: 149 kB
search/baiduscholarly/baiduscholarly3.png ADDED

Git LFS Details

  • SHA256: 013332d505627ae2bf68ce28207e64c6fa3b07aed394bb002d32fd6f4a3d2642
  • Pointer size: 131 Bytes
  • Size of remote file: 174 kB
search/baiduscholarly/baiduscholarly4.png ADDED

Git LFS Details

  • SHA256: 4498263a309b8ff71489c36683f7acbdf9596626bba489bd1454796a191103ab
  • Pointer size: 131 Bytes
  • Size of remote file: 149 kB
search/baiduscholarly/baiduscholarly5.png ADDED

Git LFS Details

  • SHA256: 1cf351ced825afcfa50a9289a3c09c1e0407ba37c2444874bcb3a59588ae7962
  • Pointer size: 131 Bytes
  • Size of remote file: 149 kB
search/baiduscholarly/baiduscholarly6.png ADDED

Git LFS Details

  • SHA256: 714463c7d1c7f8d2bc4327b3c09fe7b3c3a42e87834c7ffdcbe7c74cc1f26449
  • Pointer size: 131 Bytes
  • Size of remote file: 169 kB
search/baiduscholarly/baiduscholarly7.png ADDED

Git LFS Details

  • SHA256: 03da834bcd94fa08599d29379428aa396758c7a44d1f029fdfe06bd654fab9b1
  • Pointer size: 131 Bytes
  • Size of remote file: 108 kB
search/baiduscholarly/baiduscholarly8.png ADDED

Git LFS Details

  • SHA256: 5ab7dc4d1ece3a19aabe5c159531cd6953275b2da9c7611fe7b532dbf7621b32
  • Pointer size: 131 Bytes
  • Size of remote file: 107 kB
search/baiduscholarly/baiduscholarly9.png ADDED

Git LFS Details

  • SHA256: 9b6180f880d743190df95c4bee135b6b77981e13df5aace471ef6b771cf0627e
  • Pointer size: 131 Bytes
  • Size of remote file: 152 kB
search/googlescholar/gscholar1.png ADDED
search/googlescholar/gscholar2.png ADDED
search/googlescholar/gscholar3.png ADDED
search/googlescholar/gscholar4.png ADDED
search/googlescholar/gscholar5.png ADDED
search/googlescholar/gscholar6.png ADDED
search/googlescholar/gscholar7.png ADDED
search/googlescholar/gscholar8.png ADDED
search/googlescholar/gscholar9.png ADDED
search/scholar.md ADDED
@@ -0,0 +1,66 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <b>Scholarly Validation</b>:
2
+ <table cellspacing="0" cellpadding="0">
3
+ <tr>
4
+ <td><img src="arxiv/arxiv1.png" alt=""></td>
5
+ <td><img src="arxiv/arxiv2.png" alt=""></td>
6
+ <td><img src="arxiv/arxiv3.png" alt=""></td>
7
+ </tr>
8
+ <tr>
9
+ <td><img src="arxiv/arxiv4.png" alt=""></td>
10
+ <td><img src="arxiv/arxiv5.png" alt=""></td>
11
+ <td><img src="arxiv/arxiv6.png" alt=""></td>
12
+ </tr>
13
+ <tr>
14
+ <td><img src="arxiv/arxiv7.png" alt=""></td>
15
+ <td><img src="arxiv/arxiv8.png" alt=""></td>
16
+ <td><img src="arxiv/arxiv9.png" alt=""></td>
17
+ </tr>
18
+
19
+ <tr>
20
+ <td><img src="baiduscholarly/baiduscholarly1.png" alt=""></td>
21
+ <td><img src="baiduscholarly/baiduscholarly2.png" alt=""></td>
22
+ <td><img src="baiduscholarly/baiduscholarly3.png" alt=""></td>
23
+ </tr>
24
+ <tr>
25
+ <td><img src="baiduscholarly/baiduscholarly4.png" alt=""></td>
26
+ <td><img src="baiduscholarly/baiduscholarly5.png" alt=""></td>
27
+ <td><img src="baiduscholarly/baiduscholarly6.png" alt=""></td>
28
+ </tr>
29
+ <tr>
30
+ <td><img src="baiduscholarly/baiduscholarly7.png" alt=""></td>
31
+ <td><img src="baiduscholarly/baiduscholarly8.png" alt=""></td>
32
+ <td><img src="baiduscholarly/baiduscholarly9.png" alt=""></td>
33
+ </tr>
34
+
35
+ <tr>
36
+ <td><img src="googlescholar/gscholar1.png" alt=""></td>
37
+ <td><img src="googlescholar/gscholar2.png" alt=""></td>
38
+ <td><img src="googlescholar/gscholar3.png" alt=""></td>
39
+ </tr>
40
+ <tr>
41
+ <td><img src="googlescholar/gscholar4.png" alt=""></td>
42
+ <td><img src="googlescholar/gscholar5.png" alt=""></td>
43
+ <td><img src="googlescholar/gscholar6.png" alt=""></td>
44
+ </tr>
45
+ <tr>
46
+ <td><img src="googlescholar/gscholar7.png" alt=""></td>
47
+ <td><img src="googlescholar/gscholar8.png" alt=""></td>
48
+ <td><img src="googlescholar/gscholar9.png" alt=""></td>
49
+ </tr>
50
+
51
+ <tr>
52
+ <td><img src="ssrn/ssrn1.png" alt=""></td>
53
+ <td><img src="ssrn/ssrn2.png" alt=""></td>
54
+ <td><img src="ssrn/ssrn3.png" alt=""></td>
55
+ </tr>
56
+ <tr>
57
+ <td><img src="ssrn/ssrn4.png" alt=""></td>
58
+ <td><img src="ssrn/ssrn5.png" alt=""></td>
59
+ <td><img src="ssrn/ssrn6.png" alt=""></td>
60
+ </tr>
61
+ <tr>
62
+ <td><img src="ssrn/ssrn7.png" alt=""></td>
63
+ <td><img src="ssrn/ssrn8.png" alt=""></td>
64
+ <td><img src="ssrn/ssrn9.png" alt=""></td>
65
+ </tr>
66
+ </table>
search/search.txt ADDED
@@ -0,0 +1 @@
 
 
1
+ combination of Rust, ZeroMQ (ZMQ), and MT5's MQL5 to get live bid/ask orderflow data from MetaTrader5 (MT5)
search/ssrn/ssrn1.png ADDED