Timer Function Acting Strange

 
#include <Mql5Book/Timer.mqh>
CTimer Timer;


input bool UseTimer = true;
input bool UseTrailingStop = true;
input bool UseLocalTime = false;
input int StartHour = 15;
input int StartMinute = 59;
input int EndHour = 18;
input int EndMinute = 59;

int OnInit()
  {
   bool timerOn = true;

   if(UseTimer == true)
     {
      timerOn = Timer.DailyTimer(StartHour, StartMinute, EndHour, EndMinute, UseLocalTime);
     }

This code runs completely fine until the input variables are changed on Strategy Tester.

i.e. At first I tested the code with StartHour = 8 but when I change it to a random figure, in this case 15, it still runs as if the StartHour was 8.


The lines below are from the Journal in MT5 once the values have been changed to StartHour = 15.

2022.06.13 12:15:16.875  StartHour=8
2022.06.13 12:15:16.875  StartMinute=59
2022.06.13 12:15:16.875  EndHour=16
2022.06.13 12:15:16.875  EndMinute=59

I have closed MT5 and launched it again but the same problem occurs. The only solution I have found is the 'copy + paste' on to a new 'project'.


Is there a fix for this or is this is a bug caused from the constant updates?

The Fundamentals of Testing in MetaTrader 5
The Fundamentals of Testing in MetaTrader 5
  • www.mql5.com
What are the differences between the three modes of testing in MetaTrader 5, and what should be particularly looked for? How does the testing of an EA, trading simultaneously on multiple instruments, take place? When and how are the indicator values calculated during testing, and how are the events handled? How to synchronize the bars from different instruments during testing in an "open prices only" mode? This article aims to provide answers to these and many other questions.
 
That's because you change the default settings in the code file, but once the binary has been loaded by the terminals strategy tester, settings need to be changed in the terminal.

Open the terminal and press CTRL-R to open the dialog for the tester, now switch to the tab inputs. There you change the settings which will be used in the strategy tester.


 
Dominik Christian Egert #:
That's because you change the default settings in the code file, but once the binary has been loaded by the terminals strategy tester, settings need to be changed in the terminal.

Open the terminal and press CTRL-R to open the dialog for the tester, now switch to the tab inputs. There you change the settings which will be used in the strategy tester.


Much appreciated. Thank you.