Does your MT4 installation reside in this directory ? E:\Program Files\MetaTrader 5\MQL5\Files\MetaTrader 4\
Is the file already open by another program ? maybe MT5 ?
Does your MT4 installation reside in this directory ? E:\Program Files\MetaTrader 5\MQL5\Files\MetaTrader 4\
Is the file already open by another program ? maybe MT5 ?
Thanks for your reply, RaptorUK.
Yes, my MT4 was installed in that directory, as instructed in that article.
MT5 was also run for sure since I have to test whether the trade opened in MT5 was copied to the corresponding MT4, as shown in that article as well. Would that be a problem? @.@
Thanks for your reply, RaptorUK.
Yes, my MT4 was installed in that directory, as instructed in that article.
MT5 was also run for sure since I have to test whether the trade opened in MT5 was copied to the corresponding MT4, as shown in that article as well. Would that be a problem? @.@
I haven't done very much with MT5 but I have done a little with CSV files in MT4, if I have a CSV file open in Excel and I try to write to the file from MT4 it will fail.
If you close MT5 so it doesn't have the file open will the MT4 code run without error ?
I haven't done very much with MT5 but I have done a little with CSV files in MT4, if I have a CSV file open in Excel and I try to write to the file from MT4 it will fail.
If you close MT5 so it doesn't have the file open will the MT4 code run without error ?
I see. But what interesting is for these two programs, the one in MT5 writes the file "Translator positions.csv" and the other in MT5 continuously reads this file, detects the outstanding positions recently updated in MT5 and does the same in MT4. So it's not possible that MT5 is closed.
But you've given me an insight. I just copy that program out, remarks all the irrelevant coding and just tests the file open function of my MT4. If it still doesn't work, I think it may be something in error other than the program coding. But indeed I did reinstall MT4 and MT5 already. Should I even have to reinstall OS? *.* Hope not. Thanks again.
You probably need to close the Filehandler in MT5 in order that MT4 can access the file.
Beside that if you are running on Vista/Win 7, have your terminals in C:/Program Files/* and you still have enabled UAC the both programs do not necessary have the rights to alter / access files in the directory. The files are most likely stored in the virtual pool managed by windows and not in the correct filesystem location.
just a few cents
//z
You probably need to close the Filehandler in MT5 in order that MT4 can access the file.
Beside that if you are running on Vista/Win 7, have your terminals in C:/Program Files/* and you still have enabled UAC the both programs do not necessary have the rights to alter / access files in the directory. The files are most likely stored in the virtual pool managed by windows and not in the correct filesystem location.
just a few cents
//z
Thanks, zzuegg. Luckily, I run in WinXP so the access right problem should be much easier to handle. Any similar issue if using administrator or other user profiles in WinXP? Well, maybe I have to check the access settings among the paths in MT4.
BTW, I copy part of the source program in MT5 related to the write file function as follows for your reference:
//+------------------------------------------------------------------+ //| write positions states to a csv file | //+------------------------------------------------------------------+ void WriteFile(string folder="Translator positions") { //--- open file for writing, shared read mode int han=FileOpen(subfolder+"\\experts\\files\\"+folder+".csv",FILE_WRITE|FILE_SHARE_READ|FILE_ANSI,","); if(han!=INVALID_HANDLE)// file opened successfully { string com=""; // comment FileWrite(han,(string)cnt_command); cnt_command++; for(int i=0;i<TotalSymbols;i++) { //--- write position state on symbol, specified in Symbols[i] FileWrite(han, //--- position symbol Symbols[i], //--- position volume DoubleToString(prevSymPosVol[i],DigitsStepLot(Symbols[i])), //--- position type (string)prevSymPosType[i], //--- position stop loss DoubleToString(prevSymPosSL[i],(int)SymbolInfoInteger(Symbols[i],SYMBOL_DIGITS)), //--- position take profit DoubleToString(prevSymPosTP[i],(int)SymbolInfoInteger(Symbols[i],SYMBOL_DIGITS)) ); //--- comment com=com+"\n"+ //--- position symbol Symbols[i]+" [ "+ //--- position volume DoubleToString(prevSymPosVol[i],DigitsStepLot(Symbols[i]))+" ] [ "+ //--- position type (string)prevSymPosType[i]+" ] [ "+ //--- position stop loss DoubleToString(prevSymPosSL[i],(int)SymbolInfoInteger(Symbols[i],SYMBOL_DIGITS))+" ] [ "+ //--- position take profit DoubleToString(prevSymPosTP[i],(int)SymbolInfoInteger(Symbols[i],SYMBOL_DIGITS))+" ]" ; } //--- close file FileClose(han); //--- print comment Comment((string)(cnt_command-1),com); } //--- if file open has failed else Print("File open has failed"+subfolder+"\\"+folder+".csv, error",GetLastError());
It's using FILE_WRITE|FILE_SHARE_READ|FILE_ANSI already and also a FileClose at the end. Any ideas?
22:02:30 Copyist_positions EURUSD,M1: Error opening file 4103
22:02:30 Copyist_positions EURUSD,M1: ArrayInitialize function internal error
The variable integer handle was -1. The file failed to open is "Translator positions.csv."
Some other programmers have reinstalled MT4 and MT5 and resolved this problem successfully but unluckily I didn't. As handle was -1, it's highly likely that "Translator positions.csv" is having a problem but I really could not figure out what the problem is. This csv file was located in my PC E:\Program Files\MetaTrader 5\MQL5\Files\MetaTrader 4\experts\files, where was suggested by the article.- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Hi all, recently I've developed a EA in MT5 and would like to transfer the transactions done in MT5 to MT4 through a set of programs offered in https://www.mql5.com/en/articles/189.
It composes of 2 programs, one each in MT5 and MT4. The bug that I have found was in the program in MT4 so I would like to seek assistance from you all.
When this has been compiled and run as a script, the following error displayed in Experts page in Toolbox window:
22:02:30 Copyist_positions EURUSD,M1: Error opening file 4103
22:02:30 Copyist_positions EURUSD,M1: ArrayInitialize function internal error
According to what MT4 document has stated, error 4103 is 'chart not found'. I've tried to debug and found out that error was come from the following coding:
The variable integer handle was -1. The file failed to open is "Translator positions.csv."
Some other programmers have reinstalled MT4 and MT5 and resolved this problem successfully but unluckily I didn't. As handle was -1, it's highly likely that "Translator positions.csv" is having a problem but I really could not figure out what the problem is. This csv file was located in my PC E:\Program Files\MetaTrader 5\MQL5\Files\MetaTrader 4\experts\files, where was suggested by the article.Actually I need this program urgently (as I haven't got enough time to writ my MT4 version EA) so any inputs would be much appreciated.
Many thanks.