Download MetaTrader 5
To add comments, please log in or register
Publish your trading signal. Gain access to millions of traders!
Sherif Hasan
7223
Sherif Hasan 2014.10.04 17:24 

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;
    }  
Keith Watford
Moderator
7948
Keith Watford 2014.10.04 21:15  
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
/
To add comments, please log in or register