what's wrong with this array initialization?

 

it is declared global

int tflist[];

it is initialized in OnInit

tflist[8]={PERIOD_M1,PERIOD_M5,PERIOD_M10,PERIOD_M15,PERIOD_M30,PERIOD_H1,PERIOD_H4,PERIOD_D1};

it generates this error: '{' - expression expected. What am I doing wrong?

 
int tflist[8]={PERIOD_M1,PERIOD_M5,PERIOD_M10,PERIOD_M15,PERIOD_M30,PERIOD_H1,PERIOD_H4,PERIOD_D1};
// or let compiler count
int tflist[]={PERIOD_M1,PERIOD_M5,PERIOD_M10,PERIOD_M15,PERIOD_M30,PERIOD_H1,PERIOD_H4,PERIOD_D1};
 
WHRoeder:
int tflist[8]={PERIOD_M1,PERIOD_M5,PERIOD_M10,PERIOD_M15,PERIOD_M30,PERIOD_H1,PERIOD_H4,PERIOD_D1};
// or let compiler count
int tflist[]={PERIOD_M1,PERIOD_M5,PERIOD_M10,PERIOD_M15,PERIOD_M30,PERIOD_H1,PERIOD_H4,PERIOD_D1};

both those options generated errors. by both declaring and initializing as a global, the problem was solved; it also worked when declared and initialized in OnCalculate. naturally, it would not work at all when declared and initialized in OnInit. could not declare in global and initialize in OnInit.
 
rwbta: by both declaring and initializing as a global, the problem was solved;
Isn't that what I posted?
 
rwbta:

both those options generated errors. by both declaring and initializing as a global, the problem was solved; it also worked when declared and initialized in OnCalculate. naturally, it would not work at all when declared and initialized in OnInit. could not declare in global and initialize in OnInit.
You can declare it as global, and initialize in OnInit but not with the same syntax, you have to initialize an item at a time.