I am not aware of the event handler function you are using.
But there is something strange to me. Could the function be called several times(or not at all) during the hh:mm of first Sunday of month?
should be one time on first sunday of the month.
(dt.day == 1 || dt.day == 2 || dt.day == 3 || dt.day == 4 || dt.day == 5 || dt.day == 6 || dt.day == 7) // first sunday of the month
the code above used since we don't know the date of the first sunday but we know that it would fall between date 1st to 7th.
// input variable input uchar InpReOptimizingStartHour = 05; input uchar InpReOptimizingStartMinute = 00; dt.hour == InpReOptimizingStartHour && dt.min == InpReOptimizingStartMinute) { // at specified hour
and on the hour and minute it will only runs once depending on the hour and minute that specified
already tested and it works like I want, even though at the end I change it to more simpler one.
![MQL5 - Language of trade strategies built-in the MetaTrader 5 client terminal](https://c.mql5.com/i/registerlandings/logo-2.png)
You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
Hi,
I want to run a code once a month on OnTimer() function and here's how I do it.
Does this correct way to do that?