#include <default.c>
#include <windows.h>
typedef struct SYSTEMTIME {
WORD wYear;
WORD wMonth;
WORD wDayOfWeek;
WORD wDay;
WORD wHour;
WORD wMinute;
WORD wSecond;
WORD wMilliseconds;
} SYSTEMTIME;
SYSTEMTIME myNow;
char TargetFile[100];
char exportString[100];
function run() {
if(is(INITRUN)) {
BarPeriod = 30;
StartDate = 20190630;
// EndDate = 20190625;
// UpdateDays = -1;
LookBack = 1440/BarPeriod*1;
assetList("History\\_AssetsMath28.csv");
sprintf(TargetFile, "Exports\\tempAllAssets.csv");
sprintf(exportString, "Date");
file_write(TargetFile, exportString, 0);
while(asset(loop(Assets))) {
sprintf(exportString, ",%s", Asset);
file_append(TargetFile, exportString, 0);
}
sprintf(exportString, "\n");
file_append(TargetFile, exportString, 0);
}
GetSystemTime(&myNow);
string strDateCurrent = strf("%02d.%02d.%02d", myNow.wDay, myNow.wMonth, myNow.wYear);
string strDateBar = strdate("%d.%m.%Y", wdate(0));
if(strcmp(strDateCurrent, strDateBar)==0) {
printf("\n %s", strf("%02d.%02d.%02d", myNow.wDay, myNow.wMonth, myNow.wYear));
printf("\n bar --> %s", strdate("%d.%m.%Y", wdate(0)));
sprintf(exportString, "%s",strdate("%d.%m.%y %H:%M", wdate(0)));
sprintf(TargetFile, "Exports\\tempAllAssets.csv");
file_append(TargetFile, exportString, 0);
while(asset(loop(Assets))) {
vars pc = series(priceClose());
sprintf(TargetFile, "Exports\\tempAllAssets.csv");
sprintf(exportString, ",%.10f", pc[0]);
file_append(TargetFile, exportString, 0);
}
sprintf(exportString, "\n");
file_append(TargetFile, exportString, 0);
}
}