Download MetaTrader 5

Discussion of article "How to Copy Trading from MetaTrader 5 to MetaTrader 4"

To add comments, please log in or register
MetaQuotes Software Corp.
Moderator
182454
MetaQuotes Software Corp. 2011.01.26 13:48 

New article How to Copy Trading from MetaTrader 5 to MetaTrader 4 is published:

Is it possible to trade on a real MetaTrader 5 account today? How to organize such trading? The article contains the theory of these questions and the working codes used for copying trades from the MetaTrader 5 terminal to MetaTrader 4. The article will be useful both for the developers of Expert Advisors and for practicing traders.

Author: Николай

investeo
4100
investeo 2011.01.26 13:58  
Useful, If it works for me at demo I am going to try this on real account.
Documentation on MQL5: Standard Constants, Enumerations and Structures / Environment State / Account Properties
  • www.mql5.com
Standard Constants, Enumerations and Structures / Environment State / Account Properties - Documentation on MQL5
AVIOMEX SAS
134
Arnaud VINCENT 2011.01.31 18:17  

Very very useful work to use my MT5's EA with brokers that still use MT4 platform, thanks a lot !

Unfortunaltely I got some unexpected errors on MT4 side by using it (Terminal - Experts  windows) : "Copyist_positions EURUSD,M1: ArrayInitialize function internal error" 

And some  warnings when compiling source code on MT4 MetaEditor :" 'cmd' - comparison expression expected C:\Program Files\MetaTrader 5\MQL5\Files\MetaTrader 4\experts\Copyist_positions.mq4 (127, 46)"

Some idea to fix this bugs ? 


Documentation on MQL5: Array Functions / ArrayInitialize
  • www.mql5.com
Array Functions / ArrayInitialize - Documentation on MQL5
Automated-Trading
Admin
100933
Automated-Trading 2011.01.31 18:34  
arnovinc:

Very very useful work to use my MT5's EA with brokers that still use MT4 platform, thanks a lot !

Unfortunaltely I got some unexpected errors on MT4 side by using it (Terminal - Experts  windows) : "Copyist_positions EURUSD,M1: ArrayInitialize function internal error" 

And some  warnings when compiling source code on MT4 MetaEditor :" 'cmd' - comparison expression expected C:\Program Files\MetaTrader 5\MQL5\Files\MetaTrader 4\experts\Copyist_positions.mq4 (127, 46)"

Some idea to fix this bugs ? 

Thank you, we will check it.

Try the codes from the original russian article.

AVIOMEX SAS
134
Arnaud VINCENT 2011.02.01 02:09  
Automated-Trading:

Thank you, we will check it.

Try the codes from the original russian article.

Bug is fixed now, I have just reinstalled MT5 & MT4 and it works !

Thanks a lot for your work. 

hftsang
39
hftsang 2011.08.12 23:50  

I might be the unlucky one that that error message still continuously prompt out even I reinstalled MT5 and MT4 for both source codes in English and Russian.  Could any one help on this?  I actually need this function urgently.  Many thanks!

 P.S.  I've already tried to debug this by placing "Translator positions.csv" in every file level but still the file cannot be found with the code 4103.  The only difference between my path and this article is just the drive (mine is E:\).  I did try to put the same csv file in the newly created path in C:\ but same error prompted.  Thus, the  file seemed to be transparent to the copyist program.  :(

Rashid Umarov
Admin
11989
Rashid Umarov 2011.08.14 08:58  
hftsang:


 P.S.  I've already tried to debug this by placing "Translator positions.csv" in every file level but still the file cannot be found with the code 4103.  The only difference between my path and this article is just the drive (mine is E:\).  I did try to put the same csv file in the newly created path in C:\ but same error prompted.  Thus, the  file seemed to be transparent to the copyist program.  :(

This error 4103 is about chart operations. Don't you confuse something?

Charts

 

 

ERR_CHART_WRONG_ID

4101

Wrong chart ID

ERR_CHART_NO_REPLY

4102

Chart does not respond

ERR_CHART_NOT_FOUND

4103

Chart not found

Documentation on MQL5: Chart Operations / ChartID
  • www.mql5.com
Chart Operations / ChartID - Documentation on MQL5
hftsang
39
hftsang 2011.08.15 18:07  

I did think that I have been a bit confused since from others' program coding about fileopen function, they do check the error 4103 like the following:

int start()
{
int Handle, nbre=0;//, sens=2, ticket=3333;
string File_Name="trading.txt", sens=2, ticket=3333;
//-----Lecture-------------------------------------------------------+
Handle=FileOpen(File_Name,FILE_CSV|FILE_READ,";");// File opening
if(Handle<0) // File opening fails
{
if(GetLastError()==4103) // If the file does not exist,..
Alert("No file named ",File_Name);//.. inform trader
else // If any other error occurs..
Alert("Error while opening file ",File_Name);//..this message
PlaySound("Bzrrr.wav"); // Sound accompaniment

return; // Exit start()

Actually, I compiled the source https://c.mql5.com/2/8/copyist_positions.mq4 successfully with some debug displays added and this program was run as a script.  The following error occurred in the Experts window:

22:02:25 Copyist_positions EURUSD,M1: Error opening file 4103,Translator positionsHandle=-1

22:02:30 Copyist_positions EURUSD,M1: Error opening file 4103,Translator positionsHandle=-1

22:02:30 Copyist_positions EURUSD,M1: ArrayInitialize function internal error

The integer handle is clearly not equal to zero and fileopen function failed (though 4103 may not be the exact error code referring to this error since it's just got from getlasterror()?).

 

Much appreciated for any feedback for the above. 

Vaclav
53
Vaclav 2011.10.01 14:17  

Hi,

would it be possible to rewrite the master part from MQ5 to MQ4? To be both usable on MT4 platform? Any idea how to convert, please?


Thanks a lot


LEE Chun Wing
831
LEE Chun Wing 2011.10.29 15:31  

this tools have a problem/bug that will open position until MT4 position up to MT5 lots,

that means it neglect the extern double  koeff_lot=1.0;( position volume coefficient ) in MT4 scripts

if I set the koeff_lot to 0.1

If MT5  open 2 lot ,surely i want MT4 open 0.2 lot only

but this tools will enter 0.2 + 0.2 +0.2 , until MT4 open 2 lots

, it's terrible~ ~

 

can anyone fix this problem? 

 

LEE Chun Wing
831
LEE Chun Wing 2011.10.29 15:35  

someone tell me to fix it,

add :

if ( (MT4_lots_total_in_that_symbol()  >= MT5_lots() )  return(0);

 

I know how to code  MT4_lots_total_in_that_symbol() ,

but hows to code  MT5_lots() ?

I know zero in MQL5, and don't know how to pass this value to Script in MT4 Client Terminal ? 

Thanks 

12345
To add comments, please log in or register