Hi,
the idea: start a function on Saturday or Sunday when the market is closed that e.g. investigates the performance of a (each single) system or of all together in order to e.g. change the parameter that e.g. calculates the lotsizes for the next week.
The start()-function is started at each incoming tick. But Sa. and Su. no tick will wake up that function.
Is there another possibility (time-controlled) to start a function other than a tick (=> start()) or a re-start (=>init()) of the whole MT4-terminal?
I even can't start a function that sleeps for several hours, because first the control won't come back to start() and without ticks the terminal doesn't check the 'sleep-counter' so that this function will continue only right after that market has reopened. :(Gooly
the idea: start a function on Saturday or Sunday when the market is closed that e.g. investigates the performance of a (each single) system or of all together in order to e.g. change the parameter that e.g. calculates the lotsizes for the next week.
Well,
to me it would be the better solution to split trading and a backward analyse.
Beside that the possibility to start a function by time and not by tick would offer a wide range of things to be done in the spare time by the terminal.
You don't have to have an if(..) {..} at every tick 24/5 only to catch the last or the first tick of the week.
Gooly
Why not just recalculate what you want when you get the first tick of the new week? KISS.
Well,
to me it would be the better solution to split trading and a backward analyse.
Beside that the possibility to start a function by time and not by tick would offer a wide range of things to be done in the spare time by the terminal.
You don't have to have an if(..) {..} at every tick 24/5 only to catch the last or the first tick of the week.
I happen to agree with WHRoeder. It is probably better (and may be easier) to recalculate upon the first tick of the new week. By the way, how do you know when the last tick of the week will happen?
The following code runs once per week (or once after the EA is initialized):
datetime StartOfWeek = 0; int init() { StartOfWeek = StrToTime(StringConcatenate(Year(), ".", Month(), ".", Day())) - (DayOfWeek() * 86400); return (0); } int start() { // the following code executes once per week (and once when the EA is reinitialized) datetime today = StrToTime(StringConcatenate(Year(), ".", Month(), ".", Day())); if (today >= StartOfWeek) { // put calculation code here Print ("Current Sunday = ", TimeToStr(StartOfWeek), " and Next Sunday = ", TimeToStr(StartOfWeek+604800)); StartOfWeek += 604800; } return (0); }
The above code is only an example. There are several ways to achieve the same result.
I am still not convinced, waiting for the last or the first tick of the week makes me still depending on the server of the broker and still needs for the one and only moment that if()..
Last week I realized a 'gap' of ticks for 90 sec - but of course the bar that I missed was beautifully drawn.
What if the server after the weekend fails to come up...
I realize there is no other solution but the start-by-tick.
Is there a wish-list for mt4?
Gooly
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Hi,
the idea: start a function on Saturday or Sunday when the market is closed that e.g. investigates the performance of a (each single) system or of all together in order to e.g. change the parameter that e.g. calculates the lotsizes for the next week.
The start()-function is started at each incoming tick. But Sa. and Su. no tick will wake up that function.
Is there another possibility (time-controlled) to start a function other than a tick (=> start()) or a re-start (=>init()) of the whole MT4-terminal?
I even can't start a function that sleeps for several hours, because first the control won't come back to start() and without ticks the terminal doesn't check the 'sleep-counter' so that this function will continue only right after that market has reopened. :(Gooly