Download MetaTrader 5
To add comments, please log in or register
Sign up for MQL5.community to post your Forum topic
Richard
76
Richard 2014.03.02 17:31 

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?

whroeder1
13640
whroeder1 2014.03.02 18:01  
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};
Richard
76
Richard 2014.03.02 19:34  
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.
whroeder1
13640
whroeder1 2014.03.02 20:03  
rwbta: by both declaring and initializing as a global, the problem was solved;
Isn't that what I posted?
Alain Verleyen
Moderator
28648
Alain Verleyen 2014.03.02 20:49  
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.
/
To add comments, please log in or register