function run()
{
StartDate = 20100101;
EndDate = 20201231;
BarPeriod = 1;
LookBack = 0;
string filename = "Stocks_gaps.csv";
if(is(INITRUN)) // specifying the header in the first run
{
char header[500];
sprintf(header, "Asset, UTCDate, DoW, Time, Gap_Minutes, \n");
file_delete(filename);
file_append(filename, header);
}
assetList("AssetsMyStonks100.csv");
History = "*_us_stock.t6";
Detrend = NOPRICE; // prevents that asset and price data is checked and outliers are removed
while(asset(loop(Assets)))
{
var tdiff = (wdate() - wdate(1)); // time difference in days of the last consecutive bars
if(tdiff > (BarPeriod/1440)*2 && dow() == dow(1))
{
char line[500];
sprintf(line, "%s, %d-%02d-%02d, %i, %02d:%02d, %i, \n",
Asset, year(), month(), day(), dow(), hour(), minute(),minutesAgo(1));
file_append(filename, line);
}
}
}