Hello all,
I have some code to prevent trades being placed outside of certain hours, with those hours set as extern variables.
This is what I have come up with, but it seems a little clumsy - is there a more elegant way to achieve the same result?
Many thanks in advance for any comments
I have some code to prevent trades being placed outside of certain hours, with those hours set as extern variables.
This is what I have come up with, but it seems a little clumsy - is there a more elegant way to achieve the same result?
Inserted Code
extern bool TimeFilter = true; extern int MarketOpen = 04; extern int MarketClose = 20; int start() { if(TimeFilter) { datetime marketstart = StrToTime(StringConcatenate(MarketOpen,":00")); datetime marketend = StrToTime(StringConcatenate(MarketClose,":00")); if((TimeCurrent() < marketstart) && (TimeCurrent() >= marketend)) { Status = 1; } }