Download MetaTrader 5
To add comments, please log in or register
They are making profit already using Freelance service. You can join them!
Akintunde Akintinoye
230
Akintunde Akintinoye 2015.06.28 05:43 
pls i want to add
DeanDeV
330
DeanDeV 2015.06.28 08:47  
akintinoyea:
pls i want to add
Post your code.
whroeder1
13627
whroeder1 2015.06.28 11:47  
learn to code it, or pay someone. We're not going to code it FOR you. We are willing to HELP you when you post your attempt (using SRC) and the nature of your problem.
Sherif Hasan
7223
Sherif Hasan 2015.06.28 16:43  
DeanDeV:
Post your code.
extern int HoursFrom = 10;
extern int HoursTo = 20;

int start()
{
int datetime = TimeCurrent();
int hour = TimeHour(datetime);
    
if ((HoursFrom < HoursTo && hour >= HoursFrom && hour < HoursTo) ||
    (HoursFrom > HoursTo && (hour < HoursTo || hour >= HoursFrom)))
    {  
     //Do**** 
    }
    
}
JD4
1101
JD4 2015.06.28 16:55  
I didn't realise you were the one with the problem sheriff.  (:P )
Keith Watford
Moderator
7955
Keith Watford 2015.06.28 17:45  

sheriffonline:

extern int HoursFrom = 10;
extern int HoursTo = 20;

int start()
{
int datetime = TimeCurrent();
int hour = TimeHour(datetime);
    
if ((HoursFrom < HoursTo && hour >= HoursFrom && hour < HoursTo) ||
    (HoursFrom > HoursTo && (hour < HoursTo || hour >= HoursFrom)))
    {  
     //Do**** 
    }
    
}

 



 I wouldn't think that would compile using datetime as a variable name

extern int HoursFrom = 10;
extern int HoursTo = 20;

int start()
{
int hour = TimeHour(TimeCurrent());
    
if ((HoursFrom < HoursTo && hour >= HoursFrom && hour < HoursTo) ||
    (HoursFrom > HoursTo && (hour < HoursTo || hour >= HoursFrom)))
    {  
     //Do**** 
    }
    
}

 You can do away with that line altogether

DeanDeV
330
DeanDeV 2015.06.28 20:16  
sheriffonline:

double StartTime=X;
double FinishTime=Y;

if(Hour()>=StartTime && Hour()<=FinishTime)
 {

 }
whroeder1
13627
whroeder1 2015.06.28 20:59  
DeanDeV:
double StartTime=X;
double FinishTime=Y;

if(Hour()>=StartTime && Hour()<=FinishTime)
 {

 }
Sorry Dean but that fails if you want to run over midnight (start 1800 end 0200) GumRai has it right.
/
To add comments, please log in or register