pls help me add start and stop trade time

Back to topics list To post a new topic, please log in or register
avatar
1
akintinoyea 2015.06.28 07:43
 
pls i want to add
avatar
120
DeanDeV 2015.06.28 10:47 #
 
akintinoyea:
pls i want to add
Post your code.
avatar
12985
WHRoeder 2015.06.28 13: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.
avatar
273
sheriffonline 2015.06.28 18: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**** 
    }
    
}

avatar
313
JD4 2015.06.28 18:55 #
 
I didn't realise you were the one with the problem sheriff.  (:P )
avatar
Moderator
3407
GumRai 2015.06.28 19: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

 

 

avatar
120
DeanDeV 2015.06.28 22:16 #
 
sheriffonline:

double StartTime=X;
double FinishTime=Y;

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

 }

avatar
12985
WHRoeder 2015.06.28 22: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.
Back to topics list  

To add comments, please log in or register