MQL5 TO MQL4 COPY AND PASTE EXPERT ADVISOR

To add comments, please log in or register
ayham123
30
ayham123  

HEY guys i have been trying to create an expert advisor on mql5 and  tried to copy the ea code that i want ( it's been automatically created because on mql5 you can creat an ea without writing a code so can i copy what i've been working on and simply paste it on mql4 i have tried but it didn't work i keep getting errors 

thanks 

Alain Verleyen
39034
Alain Verleyen  
It will never work.
Stanislav Korotky
31628
Stanislav Korotky  
Alain Verleyen:
It will never work.
I'd not tell "never" ;-). I know MQ have had full standard library support (including trading) for MT4 in minds. The priority and timing were not disclosed but it could happen some time. Of course, they can reconsider and cancel this at any time. I've planned and probed such thing myself, but stopped it since I knew that MQ can work on this.
Fernando Carreiro
4945
Fernando Carreiro  
ayham123: HEY guys i have been trying to create an expert advisor on mql5 and  tried to copy the ea code that i want ( it's been automatically created because on mql5 you can creat an ea without writing a code so can i copy what i've been working on and simply paste it on mql4 i have tried but it didn't work i keep getting errors. thanks 
If you want to write code to be able to compile on both MQL5 or on MQL4 then you have to code it using common elements. Where that is not possible, you have to use conditional compilation (#ifdef __MQL4__ or #ifdef __MQL5__) to separate the differences.

This is what I have been doing for a while for my own projects, which allows me to have my Indicators and EA's available on both systems.

This requires advanced coding skills and very good knowledge of both systems, so you cannot just use the default code generator for that.
Alain Verleyen
39034
Alain Verleyen  
Stanislav Korotky:
I'd not tell "never" ;-). I know MQ have had full standard library support (including trading) for MT4 in minds. The priority and timing were not disclosed but it could happen some time. Of course, they can reconsider and cancel this at any time. I've planned and probed such thing myself, but stopped it since I knew that MQ can work on this.
Source of this information ?
Stanislav Korotky
31628
Stanislav Korotky  
Alain Verleyen:
Source of this information ?
Service desk. Ticket 2015.07.22 15:52#1266145 .
ayham123
30
ayham123  
Fernando Carreiro:
If you want to write code to be able to compile on both MQL5 or on MQL4 then you have to code it using common elements. Where that is not possible, you have to use conditional compilation (#ifdef __MQL4__ or #ifdef __MQL5__) to separate the differences.

This is what I have been doing for a while for my own projects, which allows me to have my Indicators and EA's available on both systems.

This requires advanced coding skills and very good knowledge of both systems, so you cannot just use the default code generator for that.

I understand, Thank you. i'm actually working on learning MQL4 

Alain Verleyen
39034
Alain Verleyen  
Stanislav Korotky:
Service desk. Ticket 2015.07.22 15:52#1266145 .
Thanks. It's rather old, I strongly doubt it's still on the table.
Stanislav Korotky
31628
Stanislav Korotky  
Alain Verleyen:
Thanks. It's rather old, I strongly doubt it's still on the table.

I've just made some progress on my frozen project and I'm now able to run example advisers built from MT5 wizard (such as ExpertMAMA, ExpertMACD, ExpertMAPSAR) in MT4. I'll post further updates here. Currently I see a problem, that an expert adviser generated in the wizard should use a strategy based on hedging. I'm not sure how the hedging is enabled in the standard library.

Stanislav Korotky
31628
Stanislav Korotky  

I've just posted my work in the blog - MQL5 Wizard generates Expert Advisers for MetaTrader 4.

This is a library (a set of header files)  which presumably allows you to run expert advisers denerated by MetaTrader 5 Wizard in MetaTrader 4. No code modifications needed.

To add comments, please log in or register