order execution within a time frame, please help, code doesnt seem to work

 
int CancelTime=StrToTime(cancelOrder_HR + ":" + cancelOrder_Min ); int EndTime=StrToTime(End_HR +":" + End_Min); int ScriptDurationInSec = ((Close_Pending_After_X_Hr*60 + Close_Pending_After_X_Min)*60); //---between open and close time if(CurTime()>=EndTime && CurTime()<= CancelTime && (CancelTime - EndTime)<= ScriptDurationInSec && (CancelTime - EndTime)>= 0)


basically the code is suppost to run between endtime and canceltime, but only on the same date, (if i dont put the same date in, the EA runs mad and calculates all bars)
but with this code, the ea only shows up within a 2 week period in the tester, i ran one for a whole year. please help!

thank you!
 
o6o2:
int CancelTime=StrToTime(cancelOrder_HR + ":" + cancelOrder_Min ); int EndTime=StrToTime(End_HR +":" + End_Min); int ScriptDurationInSec = ((Close_Pending_After_X_Hr*60 + Close_Pending_After_X_Min)*60); //---between open and close time if(CurTime()>=EndTime && CurTime()<= CancelTime && (CancelTime - EndTime)<= ScriptDurationInSec && (CancelTime - EndTime)>= 0)


basically the code is suppost to run between endtime and canceltime, but only on the same date, (if i dont put the same date in, the EA runs mad and calculates all bars)
but with this code, the ea only shows up within a 2 week period in the tester, i ran one for a whole year. please help!

thank you!
This is what i saw in help for StrToTime:

datetime StrToTime( string value)


looking in your code i saw int instead of datetime. Maybe this is your problem
Reason: