I never got to the bottom of the problem described above. The behaviour was not consistent. For some reason (and only sometimes) the EA was closing my trades on Monday night, rather then Friday night.dclayw » Tue Aug 15, 2017 11:56 pm wrote: This is all running on demo. I've checked and re-checked the settings. There are no other time closings activated. The CloseFriday function is what is writing the journal entries for these closed trades, i.e.:
Print("APTM:CloseFriday:Close ",IntegerToString(ticket)," Succeeded !");
These are the entries in the journal in my screen shot. They were written on Monday at around 23.45 broker time.
I do not believe it is a problem with the EA or the EA settings. It's as if the time settings on my VPS have gone a little bit haywire, although they "look" right. The VPS was booted just prior to starting the tests at market open on Monday morning.
Just wondering if anyone had come across something similar in the past. The solution will be a simple one I'm sure, I'll come back when I find it.
Anyway, in the EA rather then using "if((DayOfWeek()==5)" I changed this to "if((TimeDayOfWeek(TimeCurrent())==5)". I did not do exhaustive testing but I have not seen the problem since.