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

 

I am still stuck at  "error opening the file 4103". 

 

Does any one has fix for this please ? 

 
j2011:

I am still stuck at  "error opening the file 4103". 

Does any one has fix for this please ? 

It seems that the file which MetaTrader 4 tries to open is locked by another application (a some program opened this file and still keeps). 
 

where is this file located ? Path ?

 
Rosh:
It seems that the file which MetaTrader 4 tries to open is locked by another application (a some program opened this file and still keeps). 
The problem is that you probably installed MT4 under MQL5/FILES. You need to install it under MQL5/FILES/METATRADER4.
 

My MT4 path: 

C:\Program Files\MetaTrader 5\MQL5\Files\METATRADER4

 Still same error.

 

 

amir_avatar,

are you able to copy trades from any of these championship trades to your live account ?  and are the trades copied close to their results  ? 

Documentation on MQL5: Timeseries and Indicators Access / CopyClose
  • www.mql5.com
Timeseries and Indicators Access / CopyClose - Documentation on MQL5
 

This is great tool, working as intended, makes me stay with mt5 for sure.


Regards

John

 

I get these warnings when compiling. Granted, they are just warnings and not errors. 

 Compiling 'Copyist_positions.mq4'... 
'cmd' - comparison expression expected C:\Program Files\MetaTrader 5\MQL5\Files\Metatrader 4\experts\scripts\Copyist_positions.mq4 (120, 46)
'cmd' - comparison expression expected C:\Program Files\MetaTrader 5\MQL5\Files\Metatrader 4\experts\scripts\Copyist_positions.mq4 (122, 46)
0 error(s), 2 warning(s) 

The above refers to these two lines of code:

//--- open price
double price_open(string symbol,int cmd) {if(cmd%2)return(bid(symbol));else return(nd(symbol,ask(symbol)));}
//--- close price
double price_close(string symbol,int cmd){if(cmd%2)return(ask(symbol));else return(nd(symbol,bid(symbol)));} 

I'm thinking that  "if(cmd%2)" should be changed to "if(cmd<2)" , but I'm not sure.

 

I get these errors when running the above script in MT4 

2013.02.26 06:16:38 Copyist_positions EURUSDm,H1: Error opening file 4103
2013.02.26 06:16:38 Copyist_positions EURUSDm,H1: ArrayInitialize function internal error

  

Here is the path I used to install Metatrader 4 and used to the run script:

C:\Program Files\MetaTrader 5\MQL5\Files\Metatrader 4\experts\scripts

 

It looks like a few people are having the same problems. Any help on how to fix the problems or a new clean version of the file would be appreciated. 

 


 

Documentation on MQL5: Array Functions / ArrayInitialize
  • www.mql5.com
Array Functions / ArrayInitialize - Documentation on MQL5
 
Jeysun:

I get these warnings when compiling. Granted, they are just warnings and not errors. 

 Compiling 'Copyist_positions.mq4'... 
'cmd' - comparison expression expected C:\Program Files\MetaTrader 5\MQL5\Files\Metatrader 4\experts\scripts\Copyist_positions.mq4 (120, 46)
'cmd' - comparison expression expected C:\Program Files\MetaTrader 5\MQL5\Files\Metatrader 4\experts\scripts\Copyist_positions.mq4 (122, 46)
0 error(s), 2 warning(s) 

The above refers to these two lines of code:

//--- open price
double price_open(string symbol,int cmd) {if(cmd%2)return(bid(symbol));else return(nd(symbol,ask(symbol)));}
//--- close price
double price_close(string symbol,int cmd){if(cmd%2)return(ask(symbol));else return(nd(symbol,bid(symbol)));} 

I'm thinking that  "if(cmd%2)" should be changed to "if(cmd<2)" , but I'm not sure.

I think the code is correct,  not very readable,  some might say horrible,  but correct.   I assume CMD is the order/operation type  OP_BUY is 0 OP_SELL is 1,  so OP_BUY%2 = 0  OP_SELL%2 = 1,   0 and 1 equate to false and true.  So  (cmd%2)  is true for a OP_SELL  and the open price for a OP_SELL is Bid  and close price is Ask
Documentation on MQL5: Standard Constants, Enumerations and Structures / Indicator Constants / Price Constants
  • www.mql5.com
Standard Constants, Enumerations and Structures / Indicator Constants / Price Constants - Documentation on MQL5
 
Jeysun:

  

Here is the path I used to install Metatrader 4 and used to the run script:

C:\Program Files\MetaTrader 5\MQL5\Files\Metatrader 4\experts\scripts

 

It looks like a few people are having the same problems. Any help on how to fix the problems or a new clean version of the file would be appreciated. 

Perhaps it is a UAC issue,  try installing in a folder other than Program Files,  for example C:\MT4Installs\  
Reason: