I want to download history for multiple stocks listed in a file.
The following code does work BUT just for the first stock returned.
>> I saw where a script only loads for the first "run" but this is the "main".
Also; I only need one year of data but somewhere it starts requesting data for 2023...
TIA for your help.
Walt
****************************************************************
string Filename = "Data\\MyStrategy.csv"; // rotation list
string Fileformat = "ss,f,f,f";
string Outfile = "Log\\Rotation.log";
function main()
{
LookBack = 110;
UpdateDays = 25;
set(LOGFILE);
SaveMode = 0;
NumYears = 1;
BarPeriod = 60;
Filename = file_select("Data","Rotation Lists\0*.csv\0\0");
int i,Records = dataParse(1,Fileformat,Filename);
if(!Records) return quit("CSV file not found");
printf("\nSubscribing %i assets..",Records);
for(i=0; i<Records; i++) {
string Ticker = dataStr(1,i,0);
// StartDate = 2024;
// printf(".");
// assetHistory(Ticker, 1) ;
file_append(Outfile,Ticker,0);
}
}