Please Resolve my mistake?

 

Hi,

I want to run my ea as following time.

eg: 10,11,13,14,15,17,18,19,20

I tried following code, but i get error. hope i use user variable i defined something wrong. can you support me to resolve this issue?

extern int HoursOpen = 1,2,3,4,5,6,7,8;

    int datetime = TimeCurrent();
    int hour0 = TimeHour(datetime);
    int hours[] = HoursOpen;
    bool execute = false;
    
    for (int i=0; i < ArraySize(hours); i++)
    {
        if (hour0 == hours[HoursOpen])
        execute = true;
    }  
 
sheriffonline:

Hi,

I want to run my ea as following time.

eg: 10,11,13,14,15,17,18,19,20

I tried following code, but i get error. hope i use user variable i defined something wrong. can you support me to resolve this issue?

You can define your external variable  as a string and then use StringSplit to populate the array. Obviously, you will have to convert the strings to numbers