Yes it was explained that it wouldn't work in INITRUN.
I wrongly assumed that an int or bool that I define is NOT INITRUN.
You will be pleased to know that I have figured it out.
I don't understand why it works, but it works.
Sorry if I was a pest.
The following will read the file just once at the beginning and print the readfile to the log file.
Why? Don't know why comparing a var is different than comparing an int or a bool. But it apparently is.
var firstprice=0;
function run()
{
BarPeriod = 60;
TimeFrame = H1;
Lots=1;
Margin=0;
set(LOGFILE);
StartDate=20080102;
EndDate=20080131;
var acctbal;
string buff;
if(firstprice==0){
firstprice=priceClose();
buff = file_content("History\\atestfile.txt");
printf("# \n %s \n", buff);
}
Thanks.
P