Can you help with EA ?

Ibrahim Konyali
273
Ibrahim Konyali  

Hello, 

I have trained keras model which is i want to use in EA, how can i add the keras model to MQL5?? 


from tensorflow.keras.models import Sequential,load_model

model = load_model('MyModel.h5')

Predict = model.predict(Data,verbose=2)  

In python i use like this, is there a way to use this in MQL5 ? 

Nelson Wanyama
1423
Nelson Wanyama  
Ibrahim konyalı:

Hello, 

I have trained keras model which is i want to use in EA, how can i add the keras model to MQL5?? 


In python i use like this, is there a way to use this in MQL5 ? 

Use the python intergration with Mt5 (documented). Unless you mean creating a keras library for MQL.

Ibrahim Konyali
273
Ibrahim Konyali  
Nelson Wanyama:

Use the python intergration with Mt5 (documented). Unless you mean creating a keras library for MQL.

I see some people using lstm in MQL to train and use it in EA that's why i asked, if there is a way to use trained model in EA
Richard
113
Richard  
Ibrahim Konyali:
I see some people using lstm in MQL to train and use it in EA that's why i asked, if there is a way to use trained model in EA

I have the same basic question. Specifically, how can I send the predict result from python to the ea?

Dominik Egert
1273
Dominik Egert  
These are two different topics.

To import a trained model from python into mql, you need to code a compatible environment in mql to load the data.

To communicate between your python and your own mql EA, you need to utilize some connection between them. I would point to named pipes as a technology to get a communication channel.

Other would be to use python integration, which exposes the mql5 API to python. Here you can integrate directly into python code what is supposed to happen on the MT5.
Richard
113
Richard  
Dominik Egert:
These are two different topics.

To import a trained model from python into mql, you need to code a compatible environment in mql to load the data.

To communicate between your python and your own mql EA, you need to utilize some connection between them. I would point to named pipes as a technology to get a communication channel.

Other would be to use python integration, which exposes the mql5 API to python. Here you can integrate directly into python code what is supposed to happen on the MT5.

If I understand python integration correctly, it is only useful for sending info from mt5 to python. I don't plan to rewrite my existing EAs & indicators in python. I just want a result from my tensorflow keras model.predict to be sent to MT5. I've programmed named pipes solutions to send data back and forth between mql5 and C# DLLs in the past. Can python create DLLs? Is that the only way to send data from python to mql5 code?

Ibrahim Konyali
273
Ibrahim Konyali  
You can connect your python file by local server. Once you connect you can send data back and forth with python but downside is you can't test this ea since it using local server
Dominik Egert
1273
Dominik Egert  
I am sure named pipes work also across networks.BBut to be honest, I've not tested it with python.

I did however successfully used mysql in tester and optimizer across networks with a central mysql server available to the agents over the network.

So I do know, it is possible.