I have an indicator that writes data into file. I want text files to be named DayOfYear()+".txt" so I would like to call init() when a new day starts. (Could be both with live platform and when opened in the morning). At the moment I have to delete and reattach indicator to get the result I want.
I am not entirely sure what RefreshRates() does, but I unsuccessfully tried this:
In this case I could probably just copy paste init() operations (substituting RefreshRates()) and be just fine, but I would like hear more general solutions.
So.. how to auto reinitialize indicators when you open your platforum in the morning?
Inserted Code
int init()
{ day = DayOfYear();
nameData = Symbol()+DayOfYear()+".txt"; // name of the data file to be sent
handle = FileOpen(nameData, FILE_CSV|FILE_WRITE|FILE_READ,';');
return(0);
} I am not entirely sure what RefreshRates() does, but I unsuccessfully tried this:
Inserted Code
int start()
{ if(DayOfYear()>day)
{FileClose(handle);RefreshRates();}} In this case I could probably just copy paste init() operations (substituting RefreshRates()) and be just fine, but I would like hear more general solutions.
So.. how to auto reinitialize indicators when you open your platforum in the morning?