View Single Post
  #181 (permalink)  
Old 03-13-2009, 01:01 PM
weirdgod weirdgod is offline
Member
 
Join Date: Mar 2009
Location: Slovenia, EU
Posts: 32
weirdgod is on a distinguished road
How to Save Balance to Excel file once per day...

Hello there

I am new at MT4 scripting, so please forgive me if I am asking a stupid thing...
I am testing few EAs, and what I would like to do, is export current account balance (and optionally daily change) to a .csv or .txt file, once every day (at 00:01 for example)...
I tried writing a script that would do that, but although i was looking for examples, i did not get past this:

int start()
{
//----
int handle;
handle=FileOpen("my_data.csv",FILE_CSV|FILE_READ,' ;');
if(handle<1)
{
Print("File c:\my_data.dat not found, the last error is ", GetLastError());
return(false);
}
balance=DoubleToStr(AccountBalance(),2);

//----
return(0);
}
//+---------


So, I know how to open a file and how to get balance... But how to write it the end of file?
And how to run this at exact time, but only once daily?

thanks,
Jaka

Last edited by weirdgod; 03-13-2009 at 01:28 PM.