wish to trade only spicific time of day - page 2

 
Anyhow, back on topic,

So I should be able to create my own function for trading within a time range by using the date and time functions and using bool of some type ?
This is going to make my eyes blurry. Back to the drawing board again.
I'll post me code of my own invention to get some feedback and/or advise on it once completed.

Thanks all
 
I have some code that sets a bool depending on time of day allowed to trade . . . the tricky bit it to get it right if the start time is greater than the finish time, e.g. allow trading from 10pm to 8am.
 
RaptorUK:
I have some code that sets a bool depending on time of day allowed to trade . . . the tricky bit it to get it right if the start time is greater than the finish time, e.g. allow trading from 10pm to 8am.
Or mine
 

Hi with WHRoeder point 3 code.

int secStart = 14400*TradeHr.UTC.Start, // is this where you set the 4hr time

secEnd = 43200*TradeHr.UTC.End, // is this where for 12hr time

please explain .UTC.Start,

.UTC.End,

Also I don't see where is the

if conditional statement to allow trading.

Thanks

 

The comments are there for a specific reason . . .

//extern double   TradeHr.UTC.Start   =   7.3;    // London-1
//extern double   TradeHr.UTC.End     =  12.9;    // NY open

add these externs and this is where you set your start time (TradeHr.UTC.Start) and finish time (TradeHr.UTC.End)

TradeHr.UTC.End is a variable name . . .

There is no conditional statement to allow trading . . . you need to add it, if the code runs to the end then it's OK to trade as it is within the allowed hours . . otherwise the two returns exit the code early. You could build this into a function, change the returns to return(false); and add a return(true); at the very end . . .

Also you are going to have to look through WHRoeder's other code in the same thread to find the function for TimeGMT()