I have simplified and corrected your example
//+------------------------------------------------------------------+ //| Test.mq5 | //| Copyright © 2022, Vladimir Karputov | //| https://www.mql5.com/en/users/barabashkakvn | //+------------------------------------------------------------------+ #property copyright "Copyright © 2022, Vladimir Karputov" #property link "https://www.mql5.com/en/users/barabashkakvn" #property version "1.00" //+------------------------------------------------------------------+ //| Expert initialization function | //+------------------------------------------------------------------+ int OnInit() { //--- //--- return(INIT_SUCCEEDED); } //+------------------------------------------------------------------+ //| Expert deinitialization function | //+------------------------------------------------------------------+ void OnDeinit(const int reason) { //--- Print(__FUNCTION__); ResetLastError(); int filehandle=FileOpen("Experts\\Files\\bullmatricearray.csv",FILE_READ|FILE_WRITE|FILE_CSV,","); Print("filehandle=",filehandle); if(filehandle<0) { Print("Failed to open the file by the absolute path "); Print("Error code ",GetLastError()); } FileSeek(filehandle,0,SEEK_END); FileWrite(filehandle,"column1"); for(int i=0; i<10; i++) { FileWrite(filehandle,IntegerToString(i)); } FileClose(filehandle); } //+------------------------------------------------------------------+ //| Expert tick function | //+------------------------------------------------------------------+ void OnTick() { //--- } //+------------------------------------------------------------------+
You should look for your file in the "sandbox"
("you will find the sandbox after you read the Documentation")
I have simplified and corrected your example
You should look for your file in the "sandbox"
("you will find the sandbox after you read the Documentation")
After reading some documentation I understood the "sandbox" was defining the "folders scope", the only ones which can be accessed from the terminal.
I tested your code and the result was the same.
The issue was then me not searching at the right place. I am testing the code with the tester and the documentation says " The file is opened in the folder of the client terminal in the subfolder MQL5\files (or testing_agent_directory\MQL5\files in case of testing)" , so I was searching there :
C:\Users\user\AppData\Roaming\MetaQuotes\Terminal\ FB9A56D617EDDDFE29EE54EBEFFEXXXX\...tester but is was there :
C:\Users\user\AppData\Roaming\MetaQuotes\Tester\FB9A56D617EDDDFE29EE54EBEFFEXXXX\testing_agent_directory\MQL5\Files\Experts\Files
Thanks for your help
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
I am not able, from Meta Editor, to open/create a CSV file to write in it.
The code made in this purpose doesn't return any error or warning, filehandle=1; LastError=0;
but still I don't see any CSV file being created afterward in the destination subfolder.
Do you see any code mistake, or the issue might be outside the terminal ?