├── Example ├── .DS_Store ├── C-Sharp │ ├── .gitignore │ ├── ConsoleCopyTrade.sln │ └── ConsoleCopyTrade │ │ ├── ConsoleCopyTrade.csproj │ │ ├── MT4 │ │ └── Response.cs │ │ └── Program.cs ├── Java │ ├── build.xml │ ├── maven-build.properties │ ├── maven-build.xml │ ├── pom.xml │ ├── src │ │ ├── main │ │ │ └── java │ │ │ │ └── test │ │ │ │ └── App.java │ │ └── test │ │ │ └── java │ │ │ └── test │ │ │ └── AppTest.java │ └── target │ │ ├── classes │ │ └── test │ │ │ └── App.class │ │ ├── maven-archiver │ │ └── pom.properties │ │ ├── maven-status │ │ └── maven-compiler-plugin │ │ │ ├── compile │ │ │ └── default-compile │ │ │ │ └── inputFiles.lst │ │ │ └── testCompile │ │ │ └── default-testCompile │ │ │ └── inputFiles.lst │ │ ├── surefire-reports │ │ ├── TEST-test.AppTest.xml │ │ └── test.AppTest.txt │ │ ├── test-1.0-SNAPSHOT.jar │ │ └── test-classes │ │ └── test │ │ └── AppTest.class ├── PHP │ └── Subscribe.php └── Python │ ├── .gitignore │ └── Subscribe.py ├── LICENSE ├── MQL ├── .DS_Store └── MQL4 │ ├── .DS_Store │ └── Experts │ ├── Client.mq4 │ └── Server.mq4 └── README.md /Example/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ejtraderLabs/ejtraderCP/14661fb51c0a57356b0f83177c4e4a62d4656058/Example/.DS_Store -------------------------------------------------------------------------------- /Example/C-Sharp/.gitignore: -------------------------------------------------------------------------------- 1 | # Created by https://www.gitignore.io/api/visualstudio 2 | # Edit at https://www.gitignore.io/?templates=visualstudio 3 | 4 | ### VisualStudio ### 5 | ## Ignore Visual Studio temporary files, build results, and 6 | ## files generated by popular Visual Studio add-ons. 7 | ## 8 | ## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore 9 | 10 | # User-specific files 11 | *.rsuser 12 | *.suo 13 | *.user 14 | *.userosscache 15 | *.sln.docstates 16 | 17 | # User-specific files (MonoDevelop/Xamarin Studio) 18 | *.userprefs 19 | 20 | # Mono auto generated files 21 | mono_crash.* 22 | 23 | # Build results 24 | [Dd]ebug/ 25 | [Dd]ebugPublic/ 26 | [Rr]elease/ 27 | [Rr]eleases/ 28 | x64/ 29 | x86/ 30 | [Aa][Rr][Mm]/ 31 | [Aa][Rr][Mm]64/ 32 | bld/ 33 | [Bb]in/ 34 | [Oo]bj/ 35 | [Ll]og/ 36 | 37 | # Visual Studio 2015/2017 cache/options directory 38 | .vs/ 39 | # Uncomment if you have tasks that create the project's static files in wwwroot 40 | #wwwroot/ 41 | 42 | # Visual Studio 2017 auto generated files 43 | Generated\ Files/ 44 | 45 | # MSTest test Results 46 | [Tt]est[Rr]esult*/ 47 | [Bb]uild[Ll]og.* 48 | 49 | # NUNIT 50 | *.VisualState.xml 51 | TestResult.xml 52 | 53 | # Build Results of an ATL Project 54 | [Dd]ebugPS/ 55 | [Rr]eleasePS/ 56 | dlldata.c 57 | 58 | # Benchmark Results 59 | BenchmarkDotNet.Artifacts/ 60 | 61 | # .NET Core 62 | project.lock.json 63 | project.fragment.lock.json 64 | artifacts/ 65 | 66 | # StyleCop 67 | StyleCopReport.xml 68 | 69 | # Files built by Visual Studio 70 | *_i.c 71 | *_p.c 72 | *_h.h 73 | *.ilk 74 | *.meta 75 | *.obj 76 | *.iobj 77 | *.pch 78 | *.pdb 79 | *.ipdb 80 | *.pgc 81 | *.pgd 82 | *.rsp 83 | *.sbr 84 | *.tlb 85 | *.tli 86 | *.tlh 87 | *.tmp 88 | *.tmp_proj 89 | *_wpftmp.csproj 90 | *.log 91 | *.vspscc 92 | *.vssscc 93 | .builds 94 | *.pidb 95 | *.svclog 96 | *.scc 97 | 98 | # Chutzpah Test files 99 | _Chutzpah* 100 | 101 | # Visual C++ cache files 102 | ipch/ 103 | *.aps 104 | *.ncb 105 | *.opendb 106 | *.opensdf 107 | *.sdf 108 | *.cachefile 109 | *.VC.db 110 | *.VC.VC.opendb 111 | 112 | # Visual Studio profiler 113 | *.psess 114 | *.vsp 115 | *.vspx 116 | *.sap 117 | 118 | # Visual Studio Trace Files 119 | *.e2e 120 | 121 | # TFS 2012 Local Workspace 122 | $tf/ 123 | 124 | # Guidance Automation Toolkit 125 | *.gpState 126 | 127 | # ReSharper is a .NET coding add-in 128 | _ReSharper*/ 129 | *.[Rr]e[Ss]harper 130 | *.DotSettings.user 131 | 132 | # JustCode is a .NET coding add-in 133 | .JustCode 134 | 135 | # TeamCity is a build add-in 136 | _TeamCity* 137 | 138 | # DotCover is a Code Coverage Tool 139 | *.dotCover 140 | 141 | # AxoCover is a Code Coverage Tool 142 | .axoCover/* 143 | !.axoCover/settings.json 144 | 145 | # Visual Studio code coverage results 146 | *.coverage 147 | *.coveragexml 148 | 149 | # NCrunch 150 | _NCrunch_* 151 | .*crunch*.local.xml 152 | nCrunchTemp_* 153 | 154 | # MightyMoose 155 | *.mm.* 156 | AutoTest.Net/ 157 | 158 | # Web workbench (sass) 159 | .sass-cache/ 160 | 161 | # Installshield output folder 162 | [Ee]xpress/ 163 | 164 | # DocProject is a documentation generator add-in 165 | DocProject/buildhelp/ 166 | DocProject/Help/*.HxT 167 | DocProject/Help/*.HxC 168 | DocProject/Help/*.hhc 169 | DocProject/Help/*.hhk 170 | DocProject/Help/*.hhp 171 | DocProject/Help/Html2 172 | DocProject/Help/html 173 | 174 | # Click-Once directory 175 | publish/ 176 | 177 | # Publish Web Output 178 | *.[Pp]ublish.xml 179 | *.azurePubxml 180 | # Note: Comment the next line if you want to checkin your web deploy settings, 181 | # but database connection strings (with potential passwords) will be unencrypted 182 | *.pubxml 183 | *.publishproj 184 | 185 | # Microsoft Azure Web App publish settings. Comment the next line if you want to 186 | # checkin your Azure Web App publish settings, but sensitive information contained 187 | # in these scripts will be unencrypted 188 | PublishScripts/ 189 | 190 | # NuGet Packages 191 | *.nupkg 192 | # The packages folder can be ignored because of Package Restore 193 | **/[Pp]ackages/* 194 | # except build/, which is used as an MSBuild target. 195 | !**/[Pp]ackages/build/ 196 | # Uncomment if necessary however generally it will be regenerated when needed 197 | #!**/[Pp]ackages/repositories.config 198 | # NuGet v3's project.json files produces more ignorable files 199 | *.nuget.props 200 | *.nuget.targets 201 | 202 | # Microsoft Azure Build Output 203 | csx/ 204 | *.build.csdef 205 | 206 | # Microsoft Azure Emulator 207 | ecf/ 208 | rcf/ 209 | 210 | # Windows Store app package directories and files 211 | AppPackages/ 212 | BundleArtifacts/ 213 | Package.StoreAssociation.xml 214 | _pkginfo.txt 215 | *.appx 216 | *.appxbundle 217 | *.appxupload 218 | 219 | # Visual Studio cache files 220 | # files ending in .cache can be ignored 221 | *.[Cc]ache 222 | # but keep track of directories ending in .cache 223 | !?*.[Cc]ache/ 224 | 225 | # Others 226 | ClientBin/ 227 | ~$* 228 | *~ 229 | *.dbmdl 230 | *.dbproj.schemaview 231 | *.jfm 232 | *.pfx 233 | *.publishsettings 234 | orleans.codegen.cs 235 | 236 | # Including strong name files can present a security risk 237 | # (https://github.com/github/gitignore/pull/2483#issue-259490424) 238 | #*.snk 239 | 240 | # Since there are multiple workflows, uncomment next line to ignore bower_components 241 | # (https://github.com/github/gitignore/pull/1529#issuecomment-104372622) 242 | #bower_components/ 243 | 244 | # RIA/Silverlight projects 245 | Generated_Code/ 246 | 247 | # Backup & report files from converting an old project file 248 | # to a newer Visual Studio version. Backup files are not needed, 249 | # because we have git ;-) 250 | _UpgradeReport_Files/ 251 | Backup*/ 252 | UpgradeLog*.XML 253 | UpgradeLog*.htm 254 | ServiceFabricBackup/ 255 | *.rptproj.bak 256 | 257 | # SQL Server files 258 | *.mdf 259 | *.ldf 260 | *.ndf 261 | 262 | # Business Intelligence projects 263 | *.rdl.data 264 | *.bim.layout 265 | *.bim_*.settings 266 | *.rptproj.rsuser 267 | *- Backup*.rdl 268 | 269 | # Microsoft Fakes 270 | FakesAssemblies/ 271 | 272 | # GhostDoc plugin setting file 273 | *.GhostDoc.xml 274 | 275 | # Node.js Tools for Visual Studio 276 | .ntvs_analysis.dat 277 | node_modules/ 278 | 279 | # Visual Studio 6 build log 280 | *.plg 281 | 282 | # Visual Studio 6 workspace options file 283 | *.opt 284 | 285 | # Visual Studio 6 auto-generated workspace file (contains which files were open etc.) 286 | *.vbw 287 | 288 | # Visual Studio LightSwitch build output 289 | **/*.HTMLClient/GeneratedArtifacts 290 | **/*.DesktopClient/GeneratedArtifacts 291 | **/*.DesktopClient/ModelManifest.xml 292 | **/*.Server/GeneratedArtifacts 293 | **/*.Server/ModelManifest.xml 294 | _Pvt_Extensions 295 | 296 | # Paket dependency manager 297 | .paket/paket.exe 298 | paket-files/ 299 | 300 | # FAKE - F# Make 301 | .fake/ 302 | 303 | # CodeRush personal settings 304 | .cr/personal 305 | 306 | # Python Tools for Visual Studio (PTVS) 307 | __pycache__/ 308 | *.pyc 309 | 310 | # Cake - Uncomment if you are using it 311 | # tools/** 312 | # !tools/packages.config 313 | 314 | # Tabs Studio 315 | *.tss 316 | 317 | # Telerik's JustMock configuration file 318 | *.jmconfig 319 | 320 | # BizTalk build output 321 | *.btp.cs 322 | *.btm.cs 323 | *.odx.cs 324 | *.xsd.cs 325 | 326 | # OpenCover UI analysis results 327 | OpenCover/ 328 | 329 | # Azure Stream Analytics local run output 330 | ASALocalRun/ 331 | 332 | # MSBuild Binary and Structured Log 333 | *.binlog 334 | 335 | # NVidia Nsight GPU debugger configuration file 336 | *.nvuser 337 | 338 | # MFractors (Xamarin productivity tool) working folder 339 | .mfractor/ 340 | 341 | # Local History for Visual Studio 342 | .localhistory/ 343 | 344 | # BeatPulse healthcheck temp database 345 | healthchecksdb 346 | 347 | # Backup folder for Package Reference Convert tool in Visual Studio 2017 348 | MigrationBackup/ 349 | 350 | # End of https://www.gitignore.io/api/visualstudio -------------------------------------------------------------------------------- /Example/C-Sharp/ConsoleCopyTrade.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio Version 16 4 | VisualStudioVersion = 16.0.28803.156 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ConsoleCopyTrade", "ConsoleCopyTrade\ConsoleCopyTrade.csproj", "{286FB73E-7991-4B6B-8182-302A915F542F}" 7 | EndProject 8 | Global 9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 10 | Debug|Any CPU = Debug|Any CPU 11 | Release|Any CPU = Release|Any CPU 12 | EndGlobalSection 13 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 14 | {286FB73E-7991-4B6B-8182-302A915F542F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 15 | {286FB73E-7991-4B6B-8182-302A915F542F}.Debug|Any CPU.Build.0 = Debug|Any CPU 16 | {286FB73E-7991-4B6B-8182-302A915F542F}.Release|Any CPU.ActiveCfg = Release|Any CPU 17 | {286FB73E-7991-4B6B-8182-302A915F542F}.Release|Any CPU.Build.0 = Release|Any CPU 18 | EndGlobalSection 19 | GlobalSection(SolutionProperties) = preSolution 20 | HideSolutionNode = FALSE 21 | EndGlobalSection 22 | GlobalSection(ExtensibilityGlobals) = postSolution 23 | SolutionGuid = {9B803A65-BA74-44AB-92F4-2D0925256D14} 24 | EndGlobalSection 25 | EndGlobal 26 | -------------------------------------------------------------------------------- /Example/C-Sharp/ConsoleCopyTrade/ConsoleCopyTrade.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Exe 5 | netcoreapp2.1 6 | Ji-Feng Tsai 7 | 8 | Copyright Ejtrader 2023 9 | Demo application for MQL CopyTrade 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | System 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /Example/C-Sharp/ConsoleCopyTrade/MT4/Response.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace ConsoleCopyTrade.MT4 6 | { 7 | /// 8 | /// Response 9 | /// 10 | 11 | public class Response 12 | { 13 | /// 14 | /// Login 15 | /// 16 | public int Login { get; set; } 17 | 18 | /// 19 | /// Action 20 | /// 21 | public string Action { get; set; } 22 | 23 | /// 24 | /// Symbol 25 | /// 26 | public string Symbol { get; set; } 27 | 28 | /// 29 | /// Order Ticket 30 | /// 31 | public int Ticket { get; set; } 32 | 33 | /// 34 | /// Order Type 35 | /// 36 | public int Type { get; set; } 37 | 38 | /// 39 | /// Open price 40 | /// 41 | public double OpenPrice { get; set; } 42 | 43 | /// 44 | /// Close price 45 | /// 46 | public double ClosePrice { get; set; } 47 | 48 | /// 49 | /// Lots 50 | /// 51 | public double Lots { get; set; } 52 | 53 | /// 54 | /// SL 55 | /// 56 | public double SL { get; set; } 57 | 58 | /// 59 | /// TP 60 | /// 61 | 62 | public double TP { get; set; } 63 | } 64 | } 65 | -------------------------------------------------------------------------------- /Example/C-Sharp/ConsoleCopyTrade/Program.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using NetMQ; 3 | using NetMQ.Sockets; 4 | using ConsoleCopyTrade.MT4; 5 | 6 | namespace ConsoleCopyTrade 7 | { 8 | public class Program 9 | { 10 | /// 11 | /// Main 12 | /// 13 | public static void Main(string[] args) 14 | { 15 | using (SubscriberSocket subSocket = new SubscriberSocket()) 16 | { 17 | subSocket.Options.ReceiveHighWatermark = 1000; 18 | 19 | subSocket.Connect("tcp://localhost:5559"); 20 | subSocket.Subscribe(""); 21 | 22 | while (true) 23 | { 24 | string messageReceived = subSocket.ReceiveFrameString(); 25 | string[] messageData = messageReceived.Split(' '); 26 | 27 | if (messageData.Length != 2) 28 | continue; 29 | 30 | string[] orderData = messageData[1].Split('|'); 31 | 32 | if (orderData.Length != 9) 33 | continue; 34 | 35 | Response response = new Response 36 | { 37 | Login = int.Parse(messageData[0]), 38 | Action = orderData[0], 39 | Symbol = orderData[1], 40 | Ticket = int.Parse(orderData[2]), 41 | Type = int.Parse(orderData[3]), 42 | OpenPrice = double.Parse(orderData[4]), 43 | ClosePrice = double.Parse(orderData[5]), 44 | Lots = double.Parse(orderData[6]), 45 | SL = double.Parse(orderData[7]), 46 | TP = double.Parse(orderData[8]) 47 | }; 48 | 49 | Console.WriteLine("Login: " + response.Login + ", Action: " + response.Action + ", Symbol: " + response.Symbol); 50 | } 51 | } 52 | } 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /Example/Java/build.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | -------------------------------------------------------------------------------- /Example/Java/maven-build.properties: -------------------------------------------------------------------------------- 1 | #Generated by Maven Ant Plugin - DO NOT EDIT THIS FILE! 2 | #Tue May 07 15:30:42 CST 2019 3 | maven.settings.offline=false 4 | maven.build.finalName=test-1.0-SNAPSHOT 5 | maven.build.resourceDir.0=src/main/resources 6 | maven.build.testOutputDir=${maven.build.dir}/test-classes 7 | maven.build.testResourceDir.0=src/test/resources 8 | maven.reporting.outputDirectory=${maven.build.dir}/site 9 | project.build.sourceEncoding=UTF-8 10 | maven.compiler.source=1.8 11 | maven.build.srcDir.0=src/main/java 12 | project.build.directory=${maven.build.dir} 13 | maven.test.reports=${maven.build.dir}/test-reports 14 | maven.build.dir=target 15 | project.build.outputDirectory=${maven.build.outputDir} 16 | maven.compiler.target=1.8 17 | maven.build.testDir.0=src/test/java 18 | maven.settings.interactiveMode=true 19 | maven.repo.local=${user.home}/.m2/repository 20 | maven.build.outputDir=${maven.build.dir}/classes 21 | -------------------------------------------------------------------------------- /Example/Java/maven-build.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 95 | 96 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | 130 | 131 | 132 | 133 | 134 | 135 | 136 | 137 | 138 | 139 | 140 | 141 | 142 | 143 | 144 | 145 | 146 | 147 | 148 | 149 | 150 | 151 | 152 | 153 | 154 | 156 | 157 | 158 | 159 | 160 | 161 | 162 | 163 | 164 | 165 | 166 | 167 | 168 | 169 | 170 | 173 | =================================== WARNING =================================== 174 | JUnit is not present in the test classpath or your $ANT_HOME/lib directory. Tests not executed. 175 | =============================================================================== 176 | 177 | 178 | 179 | 180 | 181 | 182 | 183 | 203 | 204 | 205 | 206 | 207 | 208 | 209 | 210 | 215 | 216 | 217 | 218 | 219 | 220 | 221 | 222 | 223 | 224 | 225 | 226 | 227 | 228 | 229 | 230 | 231 | 232 | 233 | 237 | 238 | 239 | 243 | 244 | 248 | 249 | 253 | 254 | 258 | 259 | 260 | 261 | -------------------------------------------------------------------------------- /Example/Java/pom.xml: -------------------------------------------------------------------------------- 1 | 3 | 4.0.0 4 | test 5 | test 6 | 1.0-SNAPSHOT 7 | 8 | 1.8 9 | 1.8 10 | UTF-8 11 | 12 | 13 | 14 | junit 15 | junit 16 | 4.13.1 17 | test 18 | 19 | 20 | org.zeromq 21 | jeromq 22 | 0.5.1 23 | 24 | 25 | 26 | 27 | 28 | 29 | org.apache.maven.plugins 30 | maven-checkstyle-plugin 31 | 3.0.0 32 | 33 | 34 | com.puppycrawl.tools 35 | checkstyle 36 | 8.29 37 | 38 | 39 | com.github.ngeor 40 | checkstyle-rules 41 | 1.1.0 42 | 43 | 44 | 45 | com/github/ngeor/checkstyle.xml 46 | true 47 | 48 | 49 | 50 | 51 | 52 | 53 | org.apache.maven.plugins 54 | maven-checkstyle-plugin 55 | 56 | 57 | 61 | 62 | org.jacoco 63 | jacoco-maven-plugin 64 | 0.8.1 65 | 66 | 67 | 68 | 69 | 70 | 71 | org.apache.maven.plugins 72 | maven-javadoc-plugin 73 | 3.0.0 74 | 75 | 76 | org.apache.maven.plugins 77 | maven-checkstyle-plugin 78 | 79 | com/github/ngeor/checkstyle.xml 80 | true 81 | 82 | 83 | 84 | 85 | 86 | 87 | 92 | 93 | jacoco 94 | 95 | 96 | env.TRAVIS 97 | 98 | 99 | 100 | 101 | 102 | org.jacoco 103 | jacoco-maven-plugin 104 | 105 | 106 | prepare-agent 107 | validate 108 | 109 | prepare-agent 110 | 111 | 112 | 113 | report 114 | test 115 | 116 | report 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 130 | 131 | travis 132 | 133 | 134 | env.TRAVIS 135 | 136 | 137 | 138 | 139 | 140 | org.apache.maven.plugins 141 | maven-checkstyle-plugin 142 | 143 | 144 | checkstyle 145 | test 146 | 147 | check 148 | 149 | 150 | 151 | 152 | 153 | org.eluder.coveralls 154 | coveralls-maven-plugin 155 | 4.3.0 156 | 157 | 158 | 159 | 160 | 161 | 162 | -------------------------------------------------------------------------------- /Example/Java/src/main/java/test/App.java: -------------------------------------------------------------------------------- 1 | package test; 2 | 3 | import org.zeromq.SocketType; 4 | import org.zeromq.ZMQ; 5 | import org.zeromq.ZContext; 6 | 7 | /** 8 | * Test 9 | */ 10 | public final class App { 11 | private App() { 12 | 13 | } 14 | 15 | /** 16 | * Main. 17 | * @param args The arguments of the program. 18 | */ 19 | public static void main(String[] args) { 20 | ZContext context = new ZContext(); 21 | ZMQ.Socket subscriber = context.createSocket(SocketType.SUB); 22 | 23 | Boolean enabled = true; 24 | String serverAddr = "tcp://localhost:5559"; 25 | 26 | subscriber.connect(serverAddr); 27 | subscriber.subscribe(""); 28 | 29 | while (enabled) { 30 | String messageReceived = subscriber.recvStr(0).trim(); 31 | String[] messageData = messageReceived.split(" "); 32 | 33 | if (messageData.length != 2) 34 | continue; 35 | 36 | String[] orderData = messageData[1].toString().split("\\|"); 37 | 38 | if (orderData.length != 9) 39 | continue; 40 | 41 | System.out.println("Login: " + messageData[0] + ", Action: " + orderData[0] + ", Symbol: " + orderData[1]); 42 | } 43 | 44 | subscriber.disconnect(serverAddr); 45 | subscriber.close(); 46 | 47 | context.close(); 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /Example/Java/src/test/java/test/AppTest.java: -------------------------------------------------------------------------------- 1 | package test; 2 | 3 | import org.junit.Test; 4 | 5 | import static org.junit.Assert.*; 6 | 7 | /** 8 | * Unit test for simple App. 9 | */ 10 | public class AppTest { 11 | /** 12 | * Rigorous Test. 13 | */ 14 | @Test 15 | public void testApp() { 16 | assertTrue(true); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /Example/Java/target/classes/test/App.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ejtraderLabs/ejtraderCP/14661fb51c0a57356b0f83177c4e4a62d4656058/Example/Java/target/classes/test/App.class -------------------------------------------------------------------------------- /Example/Java/target/maven-archiver/pom.properties: -------------------------------------------------------------------------------- 1 | #Generated by Maven 2 | #Tue May 07 15:32:34 CST 2019 3 | version=1.0-SNAPSHOT 4 | groupId=test 5 | artifactId=test 6 | -------------------------------------------------------------------------------- /Example/Java/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst: -------------------------------------------------------------------------------- 1 | D:\Developer\Jiowcl\java\test\src\main\java\test\App.java 2 | -------------------------------------------------------------------------------- /Example/Java/target/maven-status/maven-compiler-plugin/testCompile/default-testCompile/inputFiles.lst: -------------------------------------------------------------------------------- 1 | D:\Developer\Jiowcl\java\test\src\test\java\test\AppTest.java 2 | -------------------------------------------------------------------------------- /Example/Java/target/surefire-reports/TEST-test.AppTest.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | -------------------------------------------------------------------------------- /Example/Java/target/surefire-reports/test.AppTest.txt: -------------------------------------------------------------------------------- 1 | ------------------------------------------------------------------------------- 2 | Test set: test.AppTest 3 | ------------------------------------------------------------------------------- 4 | Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.063 sec 5 | -------------------------------------------------------------------------------- /Example/Java/target/test-1.0-SNAPSHOT.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ejtraderLabs/ejtraderCP/14661fb51c0a57356b0f83177c4e4a62d4656058/Example/Java/target/test-1.0-SNAPSHOT.jar -------------------------------------------------------------------------------- /Example/Java/target/test-classes/test/AppTest.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ejtraderLabs/ejtraderCP/14661fb51c0a57356b0f83177c4e4a62d4656058/Example/Java/target/test-classes/test/AppTest.class -------------------------------------------------------------------------------- /Example/PHP/Subscribe.php: -------------------------------------------------------------------------------- 1 | connect($serverAddr ); 7 | $socket->setSockOpt(ZMQ::SOCKOPT_SUBSCRIBE, ""); 8 | 9 | // Zmq blocking mode for received the message 10 | while ($enabled) { 11 | $messageReceived = trim($socket->recv()); 12 | $messageData = explode(" ", $messageReceived); 13 | 14 | if (count($messageData) != 2) 15 | continue; 16 | 17 | $orderData = explode("|", $messageData[1]); 18 | 19 | if (count($orderData) != 9) 20 | continue; 21 | 22 | print_r([ 23 | "Login" => $messageData[0], 24 | "Action" => $orderData[0], 25 | "Symbol" => $orderData[1] 26 | ]); 27 | } 28 | 29 | $socket->disconnect($serverAddr ); -------------------------------------------------------------------------------- /Example/Python/.gitignore: -------------------------------------------------------------------------------- 1 | # Created by https://www.gitignore.io/api/python 2 | # Edit at https://www.gitignore.io/?templates=python 3 | 4 | ### Python ### 5 | # Byte-compiled / optimized / DLL files 6 | __pycache__/ 7 | *.py[cod] 8 | *$py.class 9 | 10 | # C extensions 11 | *.so 12 | 13 | # Distribution / packaging 14 | .Python 15 | build/ 16 | develop-eggs/ 17 | dist/ 18 | downloads/ 19 | eggs/ 20 | .eggs/ 21 | lib/ 22 | lib64/ 23 | parts/ 24 | sdist/ 25 | var/ 26 | wheels/ 27 | pip-wheel-metadata/ 28 | share/python-wheels/ 29 | *.egg-info/ 30 | .installed.cfg 31 | *.egg 32 | MANIFEST 33 | 34 | # PyInstaller 35 | # Usually these files are written by a python script from a template 36 | # before PyInstaller builds the exe, so as to inject date/other infos into it. 37 | *.manifest 38 | *.spec 39 | 40 | # Installer logs 41 | pip-log.txt 42 | pip-delete-this-directory.txt 43 | 44 | # Unit test / coverage reports 45 | htmlcov/ 46 | .tox/ 47 | .nox/ 48 | .coverage 49 | .coverage.* 50 | .cache 51 | nosetests.xml 52 | coverage.xml 53 | *.cover 54 | .hypothesis/ 55 | .pytest_cache/ 56 | 57 | # Translations 58 | *.mo 59 | *.pot 60 | 61 | # Django stuff: 62 | *.log 63 | local_settings.py 64 | db.sqlite3 65 | 66 | # Flask stuff: 67 | instance/ 68 | .webassets-cache 69 | 70 | # Scrapy stuff: 71 | .scrapy 72 | 73 | # Sphinx documentation 74 | docs/_build/ 75 | 76 | # PyBuilder 77 | target/ 78 | 79 | # Jupyter Notebook 80 | .ipynb_checkpoints 81 | 82 | # IPython 83 | profile_default/ 84 | ipython_config.py 85 | 86 | # pyenv 87 | .python-version 88 | 89 | # pipenv 90 | # According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control. 91 | # However, in case of collaboration, if having platform-specific dependencies or dependencies 92 | # having no cross-platform support, pipenv may install dependencies that don’t work, or not 93 | # install all needed dependencies. 94 | #Pipfile.lock 95 | 96 | # celery beat schedule file 97 | celerybeat-schedule 98 | 99 | # SageMath parsed files 100 | *.sage.py 101 | 102 | # Environments 103 | .env 104 | .venv 105 | env/ 106 | venv/ 107 | ENV/ 108 | env.bak/ 109 | venv.bak/ 110 | 111 | # Spyder project settings 112 | .spyderproject 113 | .spyproject 114 | 115 | # Rope project settings 116 | .ropeproject 117 | 118 | # mkdocs documentation 119 | /site 120 | 121 | # mypy 122 | .mypy_cache/ 123 | .dmypy.json 124 | dmypy.json 125 | 126 | # Pyre type checker 127 | .pyre/ 128 | 129 | # End of https://www.gitignore.io/api/python -------------------------------------------------------------------------------- /Example/Python/Subscribe.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | import sys 3 | import time 4 | 5 | import zmq 6 | import numpy 7 | 8 | def main(): 9 | connect_to = "tcp://127.0.0.1:5559" 10 | topics = "" 11 | 12 | ctx = zmq.Context() 13 | s = ctx.socket(zmq.SUB) 14 | s.connect(connect_to) 15 | s.setsockopt(zmq.SUBSCRIBE, b'') 16 | 17 | try: 18 | while True: 19 | recv = s.recv_multipart() 20 | recvMsg = recv[0].decode("utf-8") 21 | message = recvMsg.split(" ") 22 | order = message[1].split("|") 23 | 24 | v_action = order[0] 25 | v_symbol = order[1] 26 | v_ticket = order[2] 27 | v_type = order[3] 28 | v_openprice = order[4] 29 | v_closeprice = order[5] 30 | v_lots = order[6] 31 | v_sl = order[7] 32 | v_tp = order[8] 33 | 34 | print("Action: ", v_action, ", Symbol: ", v_symbol) 35 | except KeyboardInterrupt: 36 | pass 37 | 38 | if __name__ == "__main__": 39 | main() 40 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2023 Ejtrader 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. 22 | -------------------------------------------------------------------------------- /MQL/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ejtraderLabs/ejtraderCP/14661fb51c0a57356b0f83177c4e4a62d4656058/MQL/.DS_Store -------------------------------------------------------------------------------- /MQL/MQL4/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ejtraderLabs/ejtraderCP/14661fb51c0a57356b0f83177c4e4a62d4656058/MQL/MQL4/.DS_Store -------------------------------------------------------------------------------- /MQL/MQL4/Experts/Client.mq4: -------------------------------------------------------------------------------- 1 | #property copyright "Copyright 2023, Ejtrader" 2 | #property link "https://github.com/ejtraderlabs/ejtraderCP" 3 | #property version "1.12" 4 | #property description "MT4 Copy Trade Subscriber Application. Subscribe order status from source signal trader." 5 | #property strict 6 | #property show_inputs 7 | 8 | #include 9 | 10 | //--- Inputs 11 | input string Server = "tcp://localhost:5559"; // Subscribe server ip 12 | input uint ServerDelayMilliseconds = 300; // Subscribe from server delay milliseconds (Default is 300) 13 | input bool ServerReal = false; // Under real server (Default is false) 14 | input string SignalAccount = ""; // Subscribe signal account from server (Default is empty) 15 | input double MinLots = 0.00; // Limit the minimum lots (Default is 0.00) 16 | input double MaxLots = 0.00; // Limit the maximum lots (Default is 0.00) 17 | input double PercentLots = 100; // Lots Percent from Signal (Default is 100) 18 | input int Slippage = 3; 19 | input bool AllowOpenTrade = true; // Allow Open a New Order (Default is true) 20 | input bool AllowCloseTrade = true; // Allow Close a Order (Default is true) 21 | input bool AllowModifyTrade = true; // Allow Modify a Order (Default is true) 22 | input string AllowSymbols = ""; // Allow Trading Symbols (Ex: EURUSDq,EURUSDx,EURUSDa) 23 | input bool InvertOrder = false; // Invert original trade direction (Default is false) 24 | input double MinFreeMargin = 0.00; // Minimum Free Margin to Open a New Order (Default is 0.00) 25 | input string SymbolPrefixAdjust = ""; // Adjust the Symbol Name as Local Symbol Name (Ex: d=q,d=) 26 | 27 | //--- Globales Struct 28 | struct ClosedOrder 29 | { 30 | int s_login; 31 | int s_orderid; 32 | int s_before_orderid; 33 | int orderid; 34 | }; 35 | 36 | struct SymbolPrefix 37 | { 38 | string s_name; 39 | string d_name; 40 | }; 41 | 42 | //--- Globales Application 43 | const string app_name = "Ejtrader Expert Advisor"; 44 | 45 | //--- Globales ZMQ 46 | Context context; 47 | Socket subscriber(context, ZMQ_SUB); 48 | 49 | string zmq_server = ""; 50 | uint zmq_subdelay = 0; 51 | bool zmq_runningstatus = false; 52 | 53 | //--- Globales Order 54 | double order_minlots = 0.00; 55 | double order_maxlots = 0.00; 56 | double order_percentlots = 100; 57 | int order_slippage = 0; 58 | bool order_allowopen = true; 59 | bool order_allowclose = true; 60 | bool order_allowmodify = true; 61 | bool order_invert = false; 62 | 63 | //--- Globales Account 64 | int account_subscriber = 0; 65 | double account_minmarginfree = 0.00; 66 | 67 | //--- Globales File 68 | string local_drectoryname = "Data"; 69 | string local_pclosedfilename = "partially_closed.bin"; 70 | ClosedOrder local_pclosed[]; 71 | 72 | SymbolPrefix local_symbolprefix[]; 73 | string local_symbolallow[]; 74 | int symbolprefix_size = 0; 75 | int symbolallow_size = 0; 76 | 77 | //+------------------------------------------------------------------+ 78 | //| Expert program start function | 79 | //+------------------------------------------------------------------+ 80 | void OnInit() 81 | { 82 | if (DetectEnvironment() == false) 83 | { 84 | Alert("Error: The property is fail, please check and try again."); 85 | return; 86 | } 87 | 88 | StartZmqClient(); 89 | } 90 | 91 | //+------------------------------------------------------------------+ 92 | //| Override deinit function | 93 | //+------------------------------------------------------------------+ 94 | void OnDeinit(const int reason) 95 | { 96 | StopZmqClient(); 97 | } 98 | 99 | //+------------------------------------------------------------------+ 100 | //| Detect the script parameters | 101 | //+------------------------------------------------------------------+ 102 | bool DetectEnvironment() 103 | { 104 | if (Server == "") 105 | return false; 106 | 107 | if (ServerReal == true && IsDemo()) 108 | { 109 | Print("Account is Demo, please switch the Demo account to Real account."); 110 | return false; 111 | } 112 | 113 | if (IsDllsAllowed() == false) 114 | { 115 | Print("DLL call is not allowed. ", app_name, " cannot run."); 116 | return false; 117 | } 118 | 119 | zmq_server = Server; 120 | zmq_subdelay = (ServerDelayMilliseconds > 0) ? ServerDelayMilliseconds : 10; 121 | zmq_runningstatus = false; 122 | 123 | order_minlots = MinLots; 124 | order_maxlots = MaxLots; 125 | order_percentlots = (PercentLots > 0) ? PercentLots : 100; 126 | order_slippage = Slippage; 127 | order_allowopen = AllowOpenTrade; 128 | order_allowclose = AllowCloseTrade; 129 | order_allowmodify = AllowModifyTrade; 130 | order_invert = InvertOrder; 131 | 132 | account_subscriber = (SignalAccount != "") ? StringToInteger(SignalAccount) : -1; 133 | account_minmarginfree = MinFreeMargin; 134 | 135 | // Load the Symbol prefix maps 136 | if (SymbolPrefixAdjust != "") 137 | { 138 | string symboldata[]; 139 | int symbolsize = StringSplit(SymbolPrefixAdjust, ',', symboldata); 140 | int symbolindex = 0; 141 | 142 | ArrayResize(local_symbolprefix, symbolsize); 143 | 144 | for (symbolindex=0; symbolindex 0) 217 | Print("Signal Account: " + account_subscriber); 218 | 219 | while (!IsStopped()) 220 | { 221 | ticketstart = GetTickCount(); 222 | 223 | subscriber.recv(received, true); 224 | message = received.getData(); 225 | 226 | if (message != "" && AccountEquity() > 0.00) 227 | { 228 | singallogin = -1; 229 | singalorderdata = ""; 230 | 231 | ParseMessage(message, singallogin, singalorderdata); 232 | 233 | if (singallogin > 0) 234 | { 235 | if (account_subscriber <= 0 || account_subscriber == singallogin) 236 | ParseOrderFromSingal(singallogin, singalorderdata); 237 | } 238 | 239 | continue; 240 | } 241 | 242 | tickcount = GetTickCount() - ticketstart; 243 | 244 | if (delay > tickcount) 245 | Sleep(delay-tickcount-2); 246 | } 247 | } 248 | 249 | //+------------------------------------------------------------------+ 250 | //| Stop the zmq client | 251 | //+------------------------------------------------------------------+ 252 | void StopZmqClient() 253 | { 254 | if (zmq_server == "") 255 | return; 256 | 257 | // Save local closed order to file 258 | LocalClosedDataToFile(); 259 | 260 | Print("UnLoad Subscribe: ", zmq_server); 261 | 262 | ArrayFree(local_pclosed); 263 | ArrayFree(local_symbolprefix); 264 | ArrayFree(local_symbolallow); 265 | 266 | if (zmq_runningstatus == true) 267 | { 268 | subscriber.unsubscribe(""); 269 | subscriber.disconnect(zmq_server); 270 | } 271 | } 272 | 273 | //+------------------------------------------------------------------+ 274 | //| Parse the message from server signal | 275 | //+------------------------------------------------------------------+ 276 | bool ParseMessage(const string message, 277 | int &login, 278 | string &orderdata) 279 | { 280 | if (message == "") 281 | return false; 282 | 283 | string messagedata[]; 284 | int size = StringSplit(message, ' ', messagedata); 285 | 286 | login = -1; 287 | orderdata = ""; 288 | 289 | if (size != 2) 290 | return false; 291 | 292 | login = StrToInteger(messagedata[0]); 293 | orderdata = messagedata[1]; 294 | 295 | return true; 296 | } 297 | 298 | //+------------------------------------------------------------------+ 299 | //| Parse the order from signal message | 300 | //+------------------------------------------------------------------+ 301 | bool ParseOrderFromSingal(const int login, 302 | const string ordermessage) 303 | { 304 | if (login <= 0 || ordermessage == "") 305 | return false; 306 | 307 | string orderdata[]; 308 | int size = StringSplit(ordermessage, '|', orderdata); 309 | 310 | if (size != 9) 311 | return false; 312 | 313 | // Order data from signal 314 | string op = orderdata[0]; 315 | string symbol = orderdata[1]; 316 | //int orderid = StrToInteger(orderdata[2]); 317 | int orderid = -1; 318 | int beforeorderid = -1; 319 | int type = StrToInteger(orderdata[3]); 320 | double openprice = StringToDouble(orderdata[4]); 321 | double closeprice = StringToDouble(orderdata[5]); 322 | double lots = StringToDouble(orderdata[6]); 323 | double sl = StringToDouble(orderdata[7]); 324 | double tp = StringToDouble(orderdata[8]); 325 | 326 | string orderiddata[]; 327 | int orderidsize = StringSplit(orderdata[2], '_', orderiddata); 328 | 329 | symbol = GetOrderSymbolPrefix(symbol); 330 | 331 | // Partially closed a trade 332 | // Partially closed a trade will have 2 order id (orderid and before orderid) 333 | if (orderidsize == 2) 334 | { 335 | orderid = StrToInteger(orderiddata[0]); 336 | beforeorderid = StrToInteger(orderiddata[1]); 337 | } 338 | else 339 | { 340 | orderid = StrToInteger(orderdata[2]); 341 | } 342 | 343 | return MakeOrder(login, op, symbol, orderid, beforeorderid, type, openprice, closeprice, lots, sl, tp); 344 | } 345 | 346 | //+------------------------------------------------------------------+ 347 | //| Make a order by signal message (Market and Pending Order) | 348 | //+------------------------------------------------------------------+ 349 | bool MakeOrder(const int login, 350 | const string op, 351 | const string symbol, 352 | const int orderid, 353 | const int beforeorderid, 354 | const int type, 355 | const double openprice, 356 | const double closeprice, 357 | const double lots, 358 | const double sl, 359 | const double tp) 360 | { 361 | if (login <= 0 || symbol == "" || orderid == 0) 362 | return false; 363 | 364 | if (GetOrderSymbolAllowed(symbol) == false) 365 | return false; 366 | 367 | int ticketid = -1; 368 | string comment = StringFormat("%d|%d", login, orderid); 369 | bool orderstatus = false; 370 | bool localstatus = false; 371 | 372 | if (op == "OPEN") 373 | { 374 | ticketid = FindOrderBySingalComment(symbol, orderid); 375 | 376 | if (ticketid <= 0) 377 | { 378 | ticketid = MakeOrderOpen(symbol, type, openprice, lots, sl, tp, comment); 379 | 380 | Print("Open:", symbol, ", Type:", type, ", TicketId:", ticketid); 381 | } 382 | } 383 | else if (op == "CLOSED") 384 | { 385 | ticketid = FindOrderBySingalComment(symbol, orderid); 386 | 387 | if (ticketid <= 0) 388 | { 389 | ticketid = FindPartClosedOrderByLocal(symbol, orderid); 390 | } 391 | 392 | if (ticketid > 0) 393 | { 394 | orderstatus = MakeOrderClose(ticketid, symbol, type, closeprice, lots, sl, tp); 395 | 396 | Print("Closed:", symbol, ", Type:", type); 397 | } 398 | } 399 | else if (op == "PCLOSED") 400 | { 401 | ticketid = FindOrderBySingalComment(symbol, beforeorderid); 402 | // Parcial Close 403 | if (ticketid <= 0) 404 | { 405 | ticketid = FindPartClosedOrderByLocal(symbol, beforeorderid); 406 | } 407 | 408 | if (ticketid > 0) 409 | { 410 | //string localmessage = StringFormat("%d|%d-%d|%d", login, orderid, beforeorderid, ticketid); 411 | localstatus = LocalClosedDataSave(login, orderid, beforeorderid, ticketid); 412 | orderstatus = MakeOrderPartiallyClose(ticketid, symbol, type, closeprice, lots, sl, tp); 413 | 414 | Print("Partially Closed:", symbol, ", Type:", type); 415 | } 416 | } 417 | else if (op == "MODIFY") 418 | { 419 | ticketid = FindOrderBySingalComment(symbol, orderid); 420 | 421 | if (ticketid <= 0) 422 | { 423 | ticketid = FindPartClosedOrderByLocal(symbol, orderid); 424 | } 425 | 426 | if (ticketid > 0) 427 | { 428 | orderstatus = MakeOrderModify(ticketid, symbol, openprice, sl, tp); 429 | 430 | Print("Modify:", symbol, ", Type:", type); 431 | } 432 | } 433 | 434 | return (ticketid > 0) ? true : false; 435 | } 436 | 437 | //+------------------------------------------------------------------+ 438 | //| Make a market or pending order by signal message | 439 | //+------------------------------------------------------------------+ 440 | int MakeOrderOpen(const string symbol, 441 | const int type, 442 | const double openprice, 443 | const double lots, 444 | const double sl, 445 | const double tp, 446 | const string comment) 447 | { 448 | int ticketid = -1; 449 | 450 | // Allow signal to open the order 451 | // Symbol must not be empty 452 | if (order_allowopen == false || symbol == "") 453 | return ticketid; 454 | 455 | // Allow Expert Advisor to open the order 456 | if (IsTradeAllowed() == false) 457 | return ticketid; 458 | 459 | // Check if account margin free is less than settings 460 | if (account_minmarginfree > 0.00 && AccountInfoDouble(ACCOUNT_MARGIN_FREE) < account_minmarginfree) 461 | return ticketid; 462 | 463 | double vprice = openprice; 464 | double vlots = GetOrderLots(symbol, lots); 465 | int vtype = type; 466 | 467 | // The parameter price must be greater than zero 468 | if (vprice <= 0.00) 469 | vprice = SymbolInfoDouble(symbol, SYMBOL_ASK); 470 | 471 | // Invert the origional order 472 | if (order_invert) 473 | { 474 | switch (vtype) 475 | { 476 | case OP_BUY: 477 | vtype = OP_SELL; 478 | break; 479 | 480 | case OP_SELL: 481 | vtype = OP_BUY; 482 | break; 483 | 484 | case OP_BUYLIMIT: 485 | vtype = OP_SELLLIMIT; 486 | break; 487 | 488 | case OP_BUYSTOP: 489 | vtype = OP_SELLSTOP; 490 | break; 491 | 492 | case OP_SELLLIMIT: 493 | vtype = OP_BUYLIMIT; 494 | break; 495 | 496 | case OP_SELLSTOP: 497 | vtype = OP_BUYSTOP; 498 | break; 499 | } 500 | } 501 | 502 | switch (vtype) 503 | { 504 | case OP_BUY: 505 | ticketid = OrderSend(symbol, OP_BUY, vlots, vprice, order_slippage, sl, tp, comment, 0, 0, clrYellow); 506 | break; 507 | 508 | case OP_SELL: 509 | ticketid = OrderSend(symbol, OP_SELL, vlots, vprice, order_slippage, sl, tp, comment, 0, 0, clrYellow); 510 | break; 511 | 512 | case OP_BUYLIMIT: 513 | if (openprice > 0.00) 514 | ticketid = OrderSend(symbol, OP_BUYLIMIT, vlots, openprice, order_slippage, sl, tp, comment, 0, 0, clrYellow); 515 | break; 516 | 517 | case OP_BUYSTOP: 518 | if (openprice > 0.00) 519 | ticketid = OrderSend(symbol, OP_BUYSTOP, vlots, openprice, order_slippage, sl, tp, comment, 0, 0, clrYellow); 520 | break; 521 | 522 | case OP_SELLLIMIT: 523 | if (openprice > 0.00) 524 | ticketid = OrderSend(symbol, OP_SELLLIMIT, vlots, openprice, order_slippage, sl, tp, comment, 0, 0, clrYellow); 525 | break; 526 | 527 | case OP_SELLSTOP: 528 | if (openprice > 0.00) 529 | ticketid = OrderSend(symbol, OP_SELLSTOP, vlots, openprice, order_slippage, sl, tp, comment, 0, 0, clrYellow); 530 | break; 531 | } 532 | 533 | return ticketid; 534 | } 535 | 536 | //+------------------------------------------------------------------+ 537 | //| Make a order close by signal message | 538 | //+------------------------------------------------------------------+ 539 | bool MakeOrderClose(const int ticketid, 540 | const string symbol, 541 | const int type, 542 | const double closeprice, 543 | const double lots, 544 | const double sl, 545 | const double tp) 546 | { 547 | bool result = false; 548 | 549 | // Allow signal to close the order 550 | // The parameter ticketid must be greater than zero 551 | if (order_allowclose == false || ticketid <= 0) 552 | return result; 553 | 554 | // Allow Expert Advisor to close the order 555 | if (IsTradeAllowed() == false) 556 | return result; 557 | 558 | if (OrderSelect(ticketid, SELECT_BY_TICKET, MODE_TRADES) == true) 559 | { 560 | double price = closeprice; 561 | 562 | if (price <= 0.00) 563 | price = SymbolInfoDouble(symbol, SYMBOL_ASK); 564 | 565 | switch (type) 566 | { 567 | case OP_BUYLIMIT: 568 | case OP_BUYSTOP: 569 | case OP_SELLLIMIT: 570 | case OP_SELLSTOP: 571 | result = OrderDelete(ticketid); 572 | break; 573 | 574 | default: 575 | result = OrderClose(ticketid, OrderLots(), price, order_slippage, clrYellow); 576 | break; 577 | } 578 | } 579 | 580 | return result; 581 | } 582 | 583 | //+------------------------------------------------------------------+ 584 | //| Make a partially order close by signal message | 585 | //+------------------------------------------------------------------+ 586 | bool MakeOrderPartiallyClose(const int ticketid, 587 | const string symbol, 588 | const int type, 589 | const double closeprice, 590 | const double lots, 591 | const double sl, 592 | const double tp) 593 | { 594 | bool result = false; 595 | 596 | // Allow signal to close the order 597 | // The parameter ticketid must be greater than zero 598 | if (order_allowclose == false || ticketid <= 0) 599 | return result; 600 | 601 | // Allow Expert Advisor to close the order 602 | if (IsTradeAllowed() == false) 603 | return result; 604 | 605 | if (OrderSelect(ticketid, SELECT_BY_TICKET, MODE_TRADES) == true) 606 | { 607 | double price = closeprice; 608 | double vlots = GetOrderLots(symbol, lots); 609 | double vcloselots = OrderLots(); 610 | 611 | if (vcloselots - vlots > 0) 612 | { 613 | vlots = vcloselots - vlots; 614 | } 615 | 616 | if (price <= 0.00) 617 | price = SymbolInfoDouble(symbol, SYMBOL_ASK); 618 | 619 | switch (type) 620 | { 621 | case OP_BUYLIMIT: 622 | case OP_BUYSTOP: 623 | case OP_SELLLIMIT: 624 | case OP_SELLSTOP: 625 | break; 626 | 627 | default: 628 | result = OrderClose(ticketid, vlots, price, order_slippage, clrYellow); 629 | break; 630 | } 631 | } 632 | 633 | return result; 634 | } 635 | 636 | //+------------------------------------------------------------------+ 637 | //| Make a order modify by signal message | 638 | //+------------------------------------------------------------------+ 639 | bool MakeOrderModify(const int ticketid, 640 | const string symbol, 641 | const double openprice, 642 | const double sl, 643 | const double tp) 644 | { 645 | bool result = false; 646 | 647 | // Allow signal to modify the order 648 | // The parameter ticketid must be greater than zero 649 | if (order_allowmodify == false || ticketid <= 0) 650 | return result; 651 | 652 | // Allow Expert Advisor to modify the order 653 | if (IsTradeAllowed() == false) 654 | return result; 655 | 656 | if (OrderSelect(ticketid, SELECT_BY_TICKET, MODE_TRADES) == true) 657 | { 658 | result = OrderModify(ticketid, openprice, sl, tp, 0, clrYellow); 659 | } 660 | 661 | return result; 662 | } 663 | 664 | //+------------------------------------------------------------------+ 665 | //| Get the order lots is greater than or less than max and min lots | 666 | //+------------------------------------------------------------------+ 667 | double GetOrderLots(const string symbol, const double lots) 668 | { 669 | double result = lots; 670 | 671 | if (order_percentlots > 0) 672 | { 673 | result = lots * (order_percentlots / 100); 674 | } 675 | 676 | if (order_minlots > 0.00) 677 | result = (lots <= order_minlots) ? order_minlots : result; 678 | 679 | if (order_maxlots > 0.00) 680 | result = (lots >= order_maxlots) ? order_maxlots : result; 681 | 682 | if (order_percentlots > 0) 683 | { 684 | double s_maxlots = MarketInfo(symbol, MODE_MAXLOT); 685 | double s_mixlots = MarketInfo(symbol, MODE_MINLOT); 686 | 687 | if (result > s_maxlots) 688 | result = s_maxlots; 689 | 690 | if (result < s_mixlots) 691 | result = s_mixlots; 692 | } 693 | 694 | return result; 695 | } 696 | 697 | //+------------------------------------------------------------------+ 698 | //| Get the order symbol between A broker and B broker | 699 | //+------------------------------------------------------------------+ 700 | string GetOrderSymbolPrefix(const string symbol) 701 | { 702 | string result = symbol; 703 | 704 | if (symbolprefix_size == 0) 705 | return result; 706 | 707 | int symbolsize = StringLen(symbol); 708 | int symbolindex = 0; 709 | 710 | for (symbolindex=0; symbolindex 0) 796 | break; 797 | } 798 | } 799 | 800 | return ticketid; 801 | } 802 | 803 | //+------------------------------------------------------------------+ 804 | //| Find a history order closed by server signal | 805 | //+------------------------------------------------------------------+ 806 | int FindClosedOrderByHistoryToComment(const string symbol, 807 | const int signal_ticketid) 808 | { 809 | int ticketid = -1; 810 | 811 | int ordersize = OrdersHistoryTotal(); 812 | int orderindex = 0; 813 | 814 | // Find a history order closed by part-close order 815 | for (orderindex=0; orderindex= 0) 833 | { 834 | if (StringReplace(ordercomment, "to #", "") >= 0) 835 | { 836 | ticketid = StringToInteger(ordercomment); 837 | 838 | if (ticketid > 0) 839 | break; 840 | } 841 | } 842 | } 843 | 844 | return ticketid; 845 | } 846 | 847 | //+------------------------------------------------------------------+ 848 | //| Find a part closed order by server signal | 849 | //+------------------------------------------------------------------+ 850 | int FindPartClosedOrderByLocal(const string symbol, 851 | const int signal_ticketid) 852 | { 853 | int ticketid = -1; 854 | 855 | int before_orderid = -1; 856 | int pclosedsize = ArraySize(local_pclosed); 857 | int pclosedindex = 0; 858 | 859 | for (pclosedindex=0; pclosedindex 0) 871 | ticketid = FindClosedOrderByHistoryToComment(symbol, before_orderid); 872 | 873 | return ticketid; 874 | } 875 | 876 | //+------------------------------------------------------------------+ 877 | //| Local closed data save | 878 | //+------------------------------------------------------------------+ 879 | bool LocalClosedDataSave(const int s_login, 880 | const int s_orderid, 881 | const int sl_beforeorderid, 882 | const int orderid) 883 | { 884 | bool result = false; 885 | 886 | int local_pclosedsize = ArraySize(local_pclosed); 887 | 888 | if (ArrayResize(local_pclosed, local_pclosedsize + 1)) 889 | { 890 | local_pclosed[local_pclosedsize].s_login = s_login; 891 | local_pclosed[local_pclosedsize].s_orderid = s_orderid; 892 | local_pclosed[local_pclosedsize].s_before_orderid = sl_beforeorderid; 893 | local_pclosed[local_pclosedsize].orderid = orderid; 894 | } 895 | 896 | return result; 897 | } 898 | 899 | //+------------------------------------------------------------------+ 900 | //| Local closed data to memory | 901 | //+------------------------------------------------------------------+ 902 | void LocalClosedDataToMemory() 903 | { 904 | int login = AccountInfoInteger(ACCOUNT_LOGIN); 905 | string filename = IntegerToString(login) + "_" + local_pclosedfilename; 906 | 907 | int handle = FileOpen(local_drectoryname + "//" + filename, FILE_READ|FILE_BIN); 908 | 909 | if (handle != INVALID_HANDLE) 910 | { 911 | FileReadArray(handle, local_pclosed); 912 | FileClose(handle); 913 | } 914 | else 915 | { 916 | Print("Failed to open the closed order file, error ", GetLastError()); 917 | } 918 | } 919 | 920 | //+------------------------------------------------------------------+ 921 | //| Local closed data to file | 922 | //+------------------------------------------------------------------+ 923 | void LocalClosedDataToFile() 924 | { 925 | int login = AccountInfoInteger(ACCOUNT_LOGIN); 926 | string filename = IntegerToString(login) + "_" + local_pclosedfilename; 927 | 928 | int handle = FileOpen(local_drectoryname + "//" + filename, FILE_WRITE|FILE_BIN); 929 | 930 | if (handle != INVALID_HANDLE) 931 | { 932 | int local_pclosedsize = ArraySize(local_pclosed); 933 | 934 | FileSeek(handle, 0, SEEK_END); 935 | FileWriteArray(handle, local_pclosed, 0, local_pclosedsize); 936 | FileClose(handle); 937 | } 938 | else 939 | { 940 | Print("Failed to open the closed order file, error ", GetLastError()); 941 | } 942 | } 943 | -------------------------------------------------------------------------------- /MQL/MQL4/Experts/Server.mq4: -------------------------------------------------------------------------------- 1 | #property copyright "Copyright 2023, Ejtrader" 2 | #property link "https://github.com/ejtraderlabs/ejtraderCP" 3 | #property version "1.12" 4 | #property description "MT4 Copy Trade Publisher Application. Push all order-to-subscribers." 5 | #property strict 6 | #property show_inputs 7 | 8 | #include 9 | 10 | //--- Inputs 11 | input string Server = "tcp://*:5559"; // Push server ip 12 | input uint ServerDelayMilliseconds = 300; // Push to clients delay milliseconds (Default is 300) 13 | input bool ServerReal = false; // Under real server (Default is false) 14 | input string AllowSymbols = ""; // Allow Trading Symbols (Ex: EURUSDq,EURUSDx,EURUSDa) 15 | 16 | //--- Globales Application 17 | const string app_name = "Ejtrader Expert Advisor"; 18 | 19 | //--- Globales ZMQ 20 | Context context; 21 | Socket publisher(context, ZMQ_PUB); 22 | 23 | string zmq_server = ""; 24 | uint zmq_pushdelay = 0; 25 | bool zmq_runningstatus = false; 26 | 27 | //--- Globales Order 28 | int ordersize = 0; 29 | int orderids[]; 30 | double orderopenprice[]; 31 | double orderlot[]; 32 | double ordersl[]; 33 | double ordertp[]; 34 | bool orderchanged = false; 35 | bool orderpartiallyclosed = false; 36 | int orderpartiallyclosedid = -1; 37 | 38 | int prev_ordersize = 0; 39 | 40 | //--- Globales File 41 | string local_symbolallow[]; 42 | int symbolallow_size = 0; 43 | 44 | //+------------------------------------------------------------------+ 45 | //| Expert program start function | 46 | //+------------------------------------------------------------------+ 47 | void OnInit() 48 | { 49 | if (DetectEnvironment() == false) 50 | { 51 | Alert("Error: The property is fail, please check and try again."); 52 | return; 53 | } 54 | 55 | StartZmqServer(); 56 | } 57 | 58 | //+------------------------------------------------------------------+ 59 | //| Override deinit function | 60 | //+------------------------------------------------------------------+ 61 | void OnDeinit(const int reason) 62 | { 63 | StopZmqServer(); 64 | } 65 | 66 | //+------------------------------------------------------------------+ 67 | //| Detect the script parameters | 68 | //+------------------------------------------------------------------+ 69 | bool DetectEnvironment() 70 | { 71 | if (Server == "") 72 | return false; 73 | 74 | if (ServerReal == true && IsDemo()) 75 | { 76 | Print("Account is Demo, please switch the Demo account to Real account."); 77 | return false; 78 | } 79 | 80 | if (IsDllsAllowed() == false) 81 | { 82 | Print("DLL call is not allowed. ", app_name, " cannot run."); 83 | return false; 84 | } 85 | 86 | zmq_server = Server; 87 | zmq_pushdelay = (ServerDelayMilliseconds > 0) ? ServerDelayMilliseconds : 10; 88 | zmq_runningstatus = false; 89 | 90 | // Load the Symbol allow map 91 | if (AllowSymbols != "") 92 | { 93 | string symboldata[]; 94 | int symbolsize = StringSplit(AllowSymbols, ',', symboldata); 95 | int symbolindex = 0; 96 | 97 | ArrayResize(local_symbolallow, symbolsize); 98 | 99 | for (symbolindex=0; symbolindex 0) 148 | UpdateCurrentOrdersOnTicket(); 149 | 150 | tickcount = GetTickCount() - ticketstart; 151 | 152 | if (delay > tickcount) 153 | Sleep(delay-tickcount-2); 154 | } 155 | } 156 | 157 | //+------------------------------------------------------------------+ 158 | //| Stop the zmq server | 159 | //+------------------------------------------------------------------+ 160 | void StopZmqServer() 161 | { 162 | if (zmq_server == "") 163 | return; 164 | 165 | ArrayFree(orderids); 166 | ArrayFree(orderopenprice); 167 | ArrayFree(orderlot); 168 | ArrayFree(ordersl); 169 | ArrayFree(ordertp); 170 | ArrayFree(local_symbolallow); 171 | 172 | Print("Unload Server: ", zmq_server); 173 | 174 | if (zmq_runningstatus == true) 175 | publisher.unbind(zmq_server); 176 | 177 | zmq_runningstatus = false; 178 | } 179 | 180 | //+------------------------------------------------------------------+ 181 | //| Get all of the orders | 182 | //+------------------------------------------------------------------+ 183 | void GetCurrentOrdersOnStart() 184 | { 185 | prev_ordersize = 0; 186 | ordersize = OrdersTotal(); 187 | 188 | if (ordersize == prev_ordersize) 189 | return; 190 | 191 | if (ordersize > 0) 192 | { 193 | ArrayResize(orderids, ordersize); 194 | ArrayResize(orderopenprice, ordersize); 195 | ArrayResize(orderlot, ordersize); 196 | ArrayResize(ordersl, ordersize); 197 | ArrayResize(ordertp, ordersize); 198 | } 199 | 200 | prev_ordersize = ordersize; 201 | 202 | int orderindex = 0; 203 | 204 | // Save the orders to cache 205 | for (orderindex=0; orderindex prev_ordersize) 228 | { 229 | // Trade has been added 230 | changed = PushOrderOpen(); 231 | } 232 | else if (ordersize < prev_ordersize) 233 | { 234 | // Trade has been closed 235 | changed = PushOrderClosed(); 236 | } 237 | else if (ordersize == prev_ordersize) 238 | { 239 | // Trade has been modify 240 | changed = PushOrderModify(); 241 | } 242 | 243 | return changed; 244 | } 245 | 246 | //+------------------------------------------------------------------+ 247 | //| Update all of the orders status | 248 | //+------------------------------------------------------------------+ 249 | void UpdateCurrentOrdersOnTicket() 250 | { 251 | if (ordersize > 0) 252 | { 253 | ArrayResize(orderids, ordersize); 254 | ArrayResize(orderopenprice, ordersize); 255 | ArrayResize(orderlot, ordersize); 256 | ArrayResize(ordersl, ordersize); 257 | ArrayResize(ordertp, ordersize); 258 | } 259 | 260 | int orderindex = 0; 261 | 262 | // Save the orders to cache 263 | for (orderindex=0; orderindex 0) 336 | { 337 | if (GetOrderSymbolAllowed(OrderSymbol()) == false) 338 | continue; 339 | 340 | Print("Order Closed:", OrderSymbol(), ", Size:", ArraySize(orderids), ", OrderId:", OrderTicket()); 341 | 342 | PushToSubscriber(StringFormat("%d %s|%s|%d|%d|%f|%f|%f|%f|%f", 343 | AccountInfoInteger(ACCOUNT_LOGIN), 344 | "CLOSED", 345 | OrderSymbol(), 346 | OrderTicket(), 347 | OrderType(), 348 | OrderOpenPrice(), 349 | OrderClosePrice(), 350 | OrderLots(), 351 | OrderStopLoss(), 352 | OrderTakeProfit() 353 | )); 354 | 355 | changed ++; 356 | } 357 | } 358 | 359 | return changed; 360 | } 361 | 362 | //+------------------------------------------------------------------+ 363 | //| Push the modify order to all of the subscriber | 364 | //+------------------------------------------------------------------+ 365 | int PushOrderModify() 366 | { 367 | int changed = 0; 368 | int orderindex = 0; 369 | 370 | for (orderindex=0; orderindex= 0) 392 | { 393 | if (StringReplace(ordercomment, "from #", "") >= 0) 394 | { 395 | orderpartiallyclosed = true; 396 | orderpartiallyclosedid = StringToInteger(ordercomment); 397 | } 398 | } 399 | } 400 | 401 | // Change Pending Order 402 | if(orderopenprice[orderindex] != OrderOpenPrice()) 403 | orderchanged = true; 404 | 405 | if (ordersl[orderindex] != OrderStopLoss()) 406 | orderchanged = true; 407 | 408 | if (ordertp[orderindex] != OrderTakeProfit()) 409 | orderchanged = true; 410 | 411 | // Temporarily method for recognize modify order or part-closed order 412 | // Part-close order will close order by a litte lots and re-generate an new order with new order id 413 | if (orderchanged == true) 414 | { 415 | if (orderpartiallyclosed == true) 416 | { 417 | Print("Partially Closed:", OrderSymbol(), ", Size:", ArraySize(orderids), ", OrderId:", OrderTicket(), ", Before OrderId: ", orderpartiallyclosedid); 418 | 419 | PushToSubscriber(StringFormat("%d %s|%s|%s|%d|%f|%f|%f|%f|%f", 420 | AccountInfoInteger(ACCOUNT_LOGIN), 421 | "PCLOSED", 422 | OrderSymbol(), 423 | OrderTicket() + "_" + orderpartiallyclosedid, 424 | OrderType(), 425 | OrderOpenPrice(), 426 | OrderClosePrice(), 427 | OrderLots(), 428 | OrderStopLoss(), 429 | OrderTakeProfit() 430 | )); 431 | } 432 | else 433 | { 434 | Print("Order Modify:", OrderSymbol(), ", Size:", ArraySize(orderids), ", OrderId:", OrderTicket()); 435 | 436 | PushToSubscriber(StringFormat("%d %s|%s|%d|%d|%f|%f|%f|%f|%f", 437 | AccountInfoInteger(ACCOUNT_LOGIN), 438 | "MODIFY", 439 | OrderSymbol(), 440 | OrderTicket(), 441 | OrderType(), 442 | OrderOpenPrice(), 443 | OrderClosePrice(), 444 | OrderLots(), 445 | OrderStopLoss(), 446 | OrderTakeProfit() 447 | )); 448 | } 449 | 450 | changed ++; 451 | } 452 | } 453 | 454 | return changed; 455 | } 456 | 457 | //+------------------------------------------------------------------+ 458 | //| Push the message for all of the subscriber | 459 | //+------------------------------------------------------------------+ 460 | bool PushToSubscriber(const string message) 461 | { 462 | if (message == "") 463 | return false; 464 | 465 | ZmqMsg replymsg(message); 466 | 467 | int result = publisher.send(replymsg); 468 | 469 | return (result == 1) ? true : false; 470 | } 471 | 472 | //+------------------------------------------------------------------+ 473 | //| Get the symbol allowd on trading | 474 | //+------------------------------------------------------------------+ 475 | bool GetOrderSymbolAllowed(const string symbol) 476 | { 477 | bool result = true; 478 | 479 | if (symbolallow_size == 0) 480 | return result; 481 | 482 | // Change result as FALSE when allow list is not empty 483 | result = false; 484 | 485 | int symbolindex = 0; 486 | 487 | for (symbolindex=0; symbolindex 0) ? true : false; 521 | } 522 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # CopyTrade 2 | 3 | Copy Trade System for MetaTrader 4/MetaTrader 5 Client based on MQL Expertt. 4 | 5 | ![GitHub](https://img.shields.io/github/license/ejtraderLabs/ejtraderCP.svg) 6 | ![dependency status for GitHub repo](https://img.shields.io/librariesio/github/dingmaotu/mql-zmq.svg) 7 | 8 | ## Environment 9 | 10 | - Windows 7 above (recommend) 11 | - MetaTrader 4 Client / MetaTrader 5 Client 12 | - [ZeroMQ](https://github.com/zeromq) 13 | - [ZeroMQ for MQL](https://github.com/dingmaotu/mql-zmq) 14 | 15 | ## Features 16 | 17 | - Remote Publisher and Subscriber (Based on IP address) 18 | - New Order (Market Order, Pending Order) 19 | - Modify Order (TP, SL) 20 | - Close Order (Normal Close, Partial Close) 21 | - Custom Trading Symbol between Publisher and Subscriber 22 | - Subscriber Copy From Multi-Publisher 23 | - Subscriber Min Lots, Max Lots and Percent Lots 24 | - Subscriber Invert Original Orders 25 | - Subscriber Symbol adjust 26 | - Subscriber Free Margin Check 27 | 28 | The Publishers do not need to log in with a trading password, just log in and using the investor password. 29 | 30 | ## License 31 | Copyright (c) 2017-2023 Ejtrader. 32 | 33 | 34 | Code released under the MIT license. 35 | 36 | 37 | ## Acknowledgements 38 | 39 | I would like to express my gratitude to [@jiowcl](https://github.com/jiowcl) for creating the initial project. Their work has been an invaluable starting point for my modifications and improvements. 40 | 41 | I would like to express my gratitude to [@dingmaotu](https://github.com/dingmaotu) for creating the [ZeroMQ for MQL](https://github.com/dingmaotu/mql-zmq) Their work has been an invaluable. 42 | 43 | --------------------------------------------------------------------------------