MQL4 - automated forex trading   /  

Forum

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

Back to topics list To post a new topic, please log in or register

avatar
44
o6o2 2006.04.12 00:20 
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!
article

Object Approach in MQL

This article will be interesting first of all for programmers both beginners and professionals working in MQL environment. Also it would be useful if this article were read by MQL environment developers and ideologists, because questions that are analyzed here may become projects for future implementation of MetaTrader and MQL.


avatar
13
bar4ka 2006.04.15 03:56 
o6o2 wrote:
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
Back to topics list  

To add comments, please log in or register