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!
MagicNumber: "Magic" Identifier of the Order

MagicNumber: "Magic" Identifier of the Order

The article deals with the problem of conflict-free trading of several experts on the same МТ 4 Client Terminal. It "teaches" the expert to manage only "its own" orders without modifying or closing "someone else's" positions (opened manually or by other experts). The article was written for users who have basic skills of working with the terminal and programming in MQL 4.


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

To add comments, please log in or register