|
Need procedure to only trade at certain times - Please help
Looking for a procedure to Check Time to see if it is within a trade window. My code here is okay but isn't playing nice with the EA when I'm just trying to test a system. Example - I may only want to open trades from 1700GMT - 2000GMT. Anyway, if anyone has a procedure, that would be great. Thanks in advance.
Minnelli
.................................................. .........................................
extern bool xTime = TRUE;
extern int _xTime_GMT_Offset = 3;
extern int _xTime_From = 17;
extern int _xTime_To = 20;
e
bool CheckTime(int ai_start, int ai_stop) {
if (xTime) {
if (ai_stop > 0 && ai_stop < 6 && Period() == xPerMin && ai_start >= _xTime_From + _xTime_GMT_Offset || ai_start <= _xTime_To + _xTime_GMT_Offset) {
g_is_trade_time = TRUE;
return (TRUE);
} else {
g_is_trade_time = FALSE;
return (FALSE);
}
} else {
g_is_trade_time = TRUE;
return (TRUE);
}
}
|