Hi,
i'm sick of using mql and its limitations. I am currently developing a library to handle the EA/Indicator/script logic in java.
My current library stage:
- Execute native java methods (static String (String))
- Data exchange between mql and java factories
- Service management
Technical background:
- Lib MQL4J is loaded (native c++ dll) in the beginning of the first mql4 script/indicator/ea execution
- A full JVM (java virtual machine) is launched as a Empty4 thread and keeps alive for all other EAs/indicators/scripts
- All .jar files in the Library directory will added to the JVM classpath at startup
- You can call your java code in this jar files in mql4 code (executed by JNI (java native interface)
- Indicators/EAs keeps running as java thread
- Communication between java and mql is using an embedded activemq
As example, i have attached some screenshots
Now the time has come to release it. But at first, do you have any suggestions, ideas, comments?
Mql4j - Java for Empty4
-
Mql4j
- Posts: 3
- Joined: Sat Dec 12, 2015 1:59 am
Mql4j - Java for Empty4
You do not have the required permissions to view the files attached to this post.
-
AnotherBrian
Mql4j - Java for Empty4
No comment. Java is out of my league. Not sure how many people on SHF know that language, probably a low number.
- renexxxx
- Trader
- Posts: 860
- Joined: Sat Dec 31, 2011 3:48 am
Mql4j - Java for Empty4
Do you have some figures for to speed of this communication? Have you considered ZeroMQ or nanomsg instead? As the JVM and Empty4 would be running on the same computer, you don't have to traverse firewalls etcMqlGuy » Sat Dec 12, 2015 11:06 pm wrote:Communication between java and mql is using an embedded activemq
How do you marshal and unmarshal parameters, or is this all handled by activemq?
I'm sure that you are aware of earlier efforts in this respect, such as JFX-API and MT4J and would like your ideas on how your library is different from those.
Also, I would be interested to have a look at the API of your library and see some code examples.
In general I applaud your initiative and I wish you all the best in completing this!
Rene.
-
Mql4j
- Posts: 3
- Joined: Sat Dec 12, 2015 1:59 am
Mql4j - Java for Empty4
This is a good idea. I will create and provide a benchmarking function.renexxxx » Sat Dec 12, 2015 11:05 pm wrote: Do you have some figures for to speed of this communication?
activemq has much more features and is designed for heavy workload. It has also clustering features. It can be embedded in a JVM. It supports JMS (java message queue) and CMS (c++ message queue). It is possible to run activemq as an dedicated process / server / cluster. But in this case it is running in the JVM. The JVM is running as a thread in the Empty4 process. With other words:renexxxx » Sat Dec 12, 2015 11:05 pm wrote: Have you considered ZeroMQ or nanomsg instead? As the JVM and Empty4 would be running on the same computer, you don't have to traverse firewalls etc
Empty4 process == JVM process == activemq process.
mt4j is a nice prove of concept. Last commit is more than 4 years old. My plan is to provide a possibility to build EAs / indicators / scripts and so on in a easy to use framework. With synchronized data between mt and java and each mt chart window and java.renexxxx » Sat Dec 12, 2015 11:05 pm wrote: I'm sure that you are aware of earlier efforts in this respect, such as JFX-API and MT4J and would like your ideas on how your library is different from those.
Oh i forgot - My plan is to release this project
:!: :!: completely open source under Apache License 2.0. Absolutely for free for everyone :!: :!:
I will upload the source code, compiled binaries and examples in the next few days.renexxxx » Sat Dec 12, 2015 11:05 pm wrote: Also, I would be interested to have a look at the API of your library and see some code examples.
In general I applaud your initiative and I wish you all the best in completing this!
-
jseparovic
- Posts: 2
- Joined: Tue Jan 12, 2016 9:24 am
Mql4j - Java for Empty4
I'm eagerly watching this thread. I've been using jfx-api for a while now, and while it's great for functionality, the backtesting performance is lacking (I'm guessing due to the tcp layer)
I do like the idea of using a message broker between mql4 and java. So this would be purely in memory yeh, with no tcp stack involved?
I do like the idea of using a message broker between mql4 and java. So this would be purely in memory yeh, with no tcp stack involved?
- parrondo
- Posts: 3
- Joined: Thu Nov 17, 2011 6:10 am
Mql4j - Java for Empty4
It's a great idea. I encourage you to continue with it. Of course , I will follow closely.
-
jseparovic
- Posts: 2
- Joined: Tue Jan 12, 2016 9:24 am
Mql4j - Java for Empty4
If anyone's interested I've put together a C# api here https://github.com/jseparovic/MQL4CSharp
I went a different approach and am using threads, shared variables and polling on both sides to execute commands and obtain the result. I plan to build a java version as well using this approach with the help of the ideas from mql4j. BTW, I've added a REST API too.
I went a different approach and am using threads, shared variables and polling on both sides to execute commands and obtain the result. I plan to build a java version as well using this approach with the help of the ideas from mql4j. BTW, I've added a REST API too.
-
OpenTrading
- Posts: 2
- Joined: Wed Feb 24, 2016 5:34 pm
Mql4j - Java for Empty4
You might want to take a look at the projects in github.com/OpenTrading
for open-source trading code. We're using ZeroMQ and RabbitMQ under Empty4,
and linking those to Python based receivers. We also have a full Python running
in a thread under Empty4.
There are 2 parts to the problem: sending and receiving. Your best using just
a good bidirectional protocol like one of the *MQs, with ZeroMQ having
the advantage of being brokerless. Our experience is that you want to do the
least possible under Empty4 because otherwise you are running your Python/Java under
a black-box that is a moving target (i.e Build 600 strings live rollout).
On the receiving end, you inevitably have to write the equivalent of what should be an
Eval function in Empty4. Look at the OpenTrading code to see what we implemented,
and feel free to rewrite it or clean it up. Look for the ProcessCmd files.
The projects are:
https://github.com/OpenTrading/OTMql4Zmq Python and non-Python Zmq bindings.
https://github.com/OpenTrading/OTMql4AMQP Python and non-Python RabbitMq bindings.
https://github.com/OpenTrading/OTMql4Fix Partial Fix bindings.
https://github.com/OpenTrading/OTMql4Lib A common Empty4 library including our ProcessCmd
https://github.com/OpenTrading/OpenTrader - the application that will talk to Empty4 using
ZeroMQ or RabbitMQ.
Caveat: this is a work in progress and MetaQuotes breaks things with new builds...
for open-source trading code. We're using ZeroMQ and RabbitMQ under Empty4,
and linking those to Python based receivers. We also have a full Python running
in a thread under Empty4.
There are 2 parts to the problem: sending and receiving. Your best using just
a good bidirectional protocol like one of the *MQs, with ZeroMQ having
the advantage of being brokerless. Our experience is that you want to do the
least possible under Empty4 because otherwise you are running your Python/Java under
a black-box that is a moving target (i.e Build 600 strings live rollout).
On the receiving end, you inevitably have to write the equivalent of what should be an
Eval function in Empty4. Look at the OpenTrading code to see what we implemented,
and feel free to rewrite it or clean it up. Look for the ProcessCmd files.
The projects are:
https://github.com/OpenTrading/OTMql4Zmq Python and non-Python Zmq bindings.
https://github.com/OpenTrading/OTMql4AMQP Python and non-Python RabbitMq bindings.
https://github.com/OpenTrading/OTMql4Fix Partial Fix bindings.
https://github.com/OpenTrading/OTMql4Lib A common Empty4 library including our ProcessCmd
https://github.com/OpenTrading/OpenTrader - the application that will talk to Empty4 using
ZeroMQ or RabbitMQ.
Caveat: this is a work in progress and MetaQuotes breaks things with new builds...