Yes, there is alternative ... 5 ) Go Distributed :
having a similar motivation for using non-MQL4
code for fast & complex mathematics in external quantitative models for FX-trading, I have started to use both { MATLAB | python | ... }
and MetaTrader Terminal
environments in an interconnected form of a heterogeneous distributed processing system.
MQL4
part is responsible for:
anAsyncFxMarketEventFLOW
processing
aZmqInteractionFRAMEWORK
setup and participation in message-patterns handling
anFxTradeManagementPOLICY
processing
anFxTradeDetectorPolicyREQUESTOR
sending analysis RQST
-s to remote AI/ML-predictor
anFxTradeEntryPolicyEXECUTOR
processing upon remote node(s) indication(s)
{ MATLAB | python | ... }
part is responsible for:
aZmqInteractionFRAMEWORK
setup and participation in message-patterns handling
anFxTradeDetectorPolicyPROCESSOR
receiving & processing analysis RQST
-s to from remote { MQL4 | ... }
-requestor
anFxTradeEntryPolicyREQUESTOR
sending trade entry requests to remote { MQL4 | other-platform | ... }
-market-interfacing-node(s)
Why to start thinking in a Distributed way?
The core advantage is in re-using the strengths of MATLAB
and other COTS AI/ML
-packages, without any need to reverse engineer the still creeping MQL4
interfacing options ( yes, in the last few years, DLL-interfaces had several dirty hits from newer updates ( strings ceased to be strings and started to become a struct (!!!) etc. -- many man*years of pain with a code-base under maintenance, so there is some un-forgettable experience what ought be avoided ... ).
The next advantage is to become able to add failure-resilience. A distributed system can work in ( 1 + N ) protected shading.
The next advantage is to become able to increase performance. A distributed system can provide a pool of processors - be it in a { SEQ | PAR }
-mode of operations ( a pipeline-process or a parallel-form process execution ).
MATLAB
node just joins:
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% MATLAB script to setup
zeromq-matlab
clear all;
if ~ispc
s1 = zmq( 'subscribe', 'ipc', 'MATLAB' ); %% using IPC transport on <localhost>
else
disp( '0MQ IPC not supported on Windows.' )
disp( 'Setup TCP transport class instead' )
disp( 'Setting up TCP') %% using TCP transport on <localhost>
s1 = zmq( 'subscribe', 'tcp', 'localhost', 5555 );
end
recv_data1 = []; %% setup RECV buffer
This said, one can preserve strengths on each side and avoid any form of duplications of already implemented native, high-performance tuned, libraries, while the distributed mode of operations also adds some brand new potential benefits for Expert Advisor
modus operandi.
A Distributed System, on top of a Communication Framework:
MATLAB
has already available port of ZeroMQ
Communication Framework, the same that MetaTrader Terminal
has, thanks to Austin CONRAD's wrapper ( though the MQH
is interfacing to a ver 2.1.11
DLL, the services needed work like a charm ), so you are straight ready to use it on each side, so these types of nodes are ready to join their respective roles in any form one can design into a truly heterogeneous distributed system.

My recent R&D uses several instances of python
-side processes to operate AI/ML-predictor
, r/KBD
, r/RealTimeANALYSER
and a centralised r/LOG
services, that are actively used, over many PUSH/PULL
+ XREQ/XREP
+ PUB/SUB
Scalable Formal Communication Patterns, from several instances of MetaTrader Terminal
-s by their respective MQL4
-code.
MATLAB
functions could be re-used in the same way.