Saving text files in MQL5

 

So, Instead of looking at my account balance everyday for my EA, I would like to create a text file with the relevant information. 

Problem: When I backtest, the file is being saved at : C:\Users\Chiji\AppData\Roaming\MetaQuotes\Tester\***MY_HEX_KEY***\Agent-127.0.0.1-3000\MQL5\Files

I would like to save the file in C:\Chiji\AccountHist\

How do I specify file save location?

It works, and it creates the file with account date and account balance, just as desired, but it is just in the wrong location. 



if ( LastBalance!=Balance  && iTime(NULL, PERIOD_D1, 1) != DayCandle ) 

            {  LastBalance = Balance ; 

               DayCandle = iTime(NULL, PERIOD_D1, 1);

               Account= AccountInfoInteger(ACCOUNT_LOGIN)+".txt";

               int AccountHandle=FileOpen(Account,FILE_READ|FILE_WRITE|FILE_CSV|FILE_ANSI);

               FileSeek(AccountHandle,0,SEEK_END);

               FileWrite(AccountHandle,iTime(NULL, PERIOD_D1, 1), AccountInfoDouble(ACCOUNT_EQUITY) );

               FileClose(AccountHandle);

            }      

Files:
15100304.txt  1 kb
 
Chijioke Chukwunonso Iloabachie:

So, Instead of looking at my account balance everyday for my EA, I would like to create a text file with the relevant information. 

Problem: When I backtest, the file is being saved at : C:\Users\Chiji\AppData\Roaming\MetaQuotes\Tester\***MY_HEX_KEY***\Agent-127.0.0.1-3000\MQL5\Files

I would like to save the file in C:\Chiji\AccountHist\

How do I specify file save location?

It works, and it creates the file with account date and account balance, just as desired, but it is just in the wrong location. 



If you check the documentation

Using the Shared Folder of All of the Client Terminals #

All testing agents are isolated from each other and from the client terminal: each agent has its own folder in which its logs are recorded. In addition, all file operations during the testing of the agent occur in the folder agent_name/MQL5/Files. However, we can implement the interaction between the local agents and the client terminal through a shared folder for all of the client terminals, if during the file opening you specify the flag FILE_COMMON:

https://www.mql5.com/en/docs/runtime/testing#common_folder

Documentation on MQL5: MQL5 programs / Testing Trading Strategies
Documentation on MQL5: MQL5 programs / Testing Trading Strategies
  • www.mql5.com
The idea of automated trading is appealing by the fact that the trading robot can work non-stop for 24 hours a day, seven days a week. The robot...
 
Paul Anscombe #:

If you check the documentation

Using the Shared Folder of All of the Client Terminals #

All testing agents are isolated from each other and from the client terminal: each agent has its own folder in which its logs are recorded. In addition, all file operations during the testing of the agent occur in the folder agent_name/MQL5/Files. However, we can implement the interaction between the local agents and the client terminal through a shared folder for all of the client terminals, if during the file opening you specify the flag FILE_COMMON:

https://www.mql5.com/en/docs/runtime/testing#common_folder

yes but how do I specify an exact file location?

 
Chijioke Chukwunonso Iloabachie #: yes but how do I specify an exact file location?

You don't. Use the common flag and file name, and it uses the location Paul said.

 
William Roeder #:

You don't. Use the common flag and file name, and it uses the location Paul said.

From what I am understanding, there are only 2 choices, 

1) Each agents folder, The folder agent_name/MQL5/Files. (Pretty much where I can see my own txt file.)

2) The file path in the common folder of all client terminals \Terminal\Common\Files.

There is no method of specifying another separate folder.