Would like to have an MT4 EA that can open and close trades on the basis of time and day of the week.
For instance, “open long Monday 01:30 close Wednesday 13:00, open short, Wednesday 13:00, close trade Friday 09:00″… I would be able to input how many lots… I found this bit of code that might work:
enum daysOfWeek {Monday,Tuesday,Wednesday,Thursday,Friday};
extern daysOfWeek dayOfWeek1=Monday; extern string timeSlot1=”00:00-00:00″;
extern daysOfWeek dayOfWeek2=Tuesday; extern string timeSlot2=”00:00-00:00″;
extern daysOfWeek dayOfWeek3=Wednesday;extern string timeSlot3=”00:00-00:00″;
extern daysOfWeek dayOfWeek4=Thursday; extern string timeSlot4=”00:00-00:00″;
extern daysOfWeek dayOfWeek5=Friday; extern string timeSlot5=”00:00-00:00”;
int OnInit(){
dayOfWeek1 +=1;dayOfWeek2 +=1;dayOfWeek3 +=1;dayOfWeek4 +=1;dayOfWeek5
if ((!isSlotOK(1,timeSlot1)) || (!isSlotOK(2,timeSlot2)) || (!isSlotOK(3,timeSlot3)) || (!isSlotOK(4,timeSlot4)) || (!isSlotOK(5,timeSlot5)) ||
return (INIT_PARAMETERS_INCORRECT);
return(INIT_SUCCEEDED);
Can you help? My hope is that this would be a small job.