Can the strategy tester start at a pre-defined time or does it always start at midnight?

 

Hi all,

I want to test a strategy that only works from 10-12 and it's very annyoing that I have to wait and watch the bars being printed from 0-10 although my EA doesn't work during these hours. Is there a possibilty to let the strategy tester start working from another time? 

 
mar:

Hi all,

I want to test a strategy that only works from 10-12 and it's very annyoing that I have to wait and watch the bars being printed from 0-10 although my EA doesn't work during these hours. Is there a possibilty to let the strategy tester start working from another time? 

I would have thought that if the EA has been coded to only work between 10-12 that it would not be doing anything at other times except checking the time. So it should whizz through at other times.
 
Yes, you are right. I have forgotten to mention that I often use the visual mode. For me it is a very good tool to find possible errors quickly. And if you use the visual mode on a tick-basis it can be very annyoing to wait so long until the EA begins its work. Unfortunately there is no possibility to "fast forward" or even start at a pre-defined time.
 
mar:
Yes, you are right. I have forgotten to mention that I often use the visual mode. For me it is a very good tool to find possible errors quickly. And if you use the visual mode on a tick-basis it can be very annyoing to wait so long until the EA begins its work. Unfortunately there is no possibility to "fast forward" or even start at a pre-defined time.

I usually have the problem that at speed 32 in visual mode is way too fast and at 31 painfully slow. I have suggested to the service desk that something should be done about this, but they seem uninterested. Maybe more people should contact them about this and they may realise that it is important.

I add useless loops to my code to slow it down (in Visual Mode only) because speed 32 is useless and 31 even more useless. 

 
I totally agree. If you use other methods than tick-mode you are fine with speeds around 25-30 but when using tick mode the speed should be adjusted more sensitively. I will also write this to the service desk. 
 
MQ could add a HH:MM:SS or at least an HH:MM to the 'use date' calendar.  I've suggested this a few times but they have ignored the request.  Maybe you will have better luck.  No excuse to backtest the entire day if you only need to review a few hours.
 
4evermaat:
MQ could add a HH:MM:SS or at least an HH:MM to the 'use date' calendar.  I've suggested this a few times but they have ignored the request.  Maybe you will have better luck.  No excuse to backtest the entire day if you only need to review a few hours.

That would be useful.

You can add a time filter in your code.

 

I found a solution that works for me. Maybe somebody else can make use of it.

I just put one loop right after OnTick() starts. Then I use speed 32 in the strategy tester. This loop causes the tester to hold for a short time and gives me enough time to switch the speed down manually. It  works really good because you don't have to slow down your whole code. The following code pauses at 10:00 for a couple of seconds. Just set stopEA to true in the global section.

void OnTick() {
   Comment(TimeToString(TimeCurrent(), TIME_SECONDS));
   if (TimeToString(TimeCurrent(), TIME_SECONDS)>="10:00:00" && stopEA==true) {
      for (int i=1000000000; i>0; i--) {}
      stopEA=false;
   }

.....
.....




  }
 
Better is just to stop the tester
//{                                  PauseTest
// https://forum.mql4.com/35112
// Each chart consists of two windows (i.e. two hWnds): the drawing area (WH,)
// and a container (GA.) There is then a standard MDI container which holds all
// the chart windows (GA1.) And that sits inside the main MT4 window (GA2.)
//}
#include <WinUser32.mqh>
#import "user32.dll"
   int      GetAncestor(int, int);
#import
void     pause_visual_mode(){
   if(Pause_Visual_Mode && get_modus_operandi() == MODE_VISUAL 
   && IsDllsAllowed() ){
      datetime now = TimeCurrent();    static datetime oncePerTick;
      if(oncePerTick != now){ oncePerTick = now;            #define GA_ROOT 2
         int      main = GetAncestor(WindowHandle(_Symbol, _Period), GA_ROOT);
         SendMessageA(main, WM_COMMAND, 0x57a, 0); // 1402. Pause
   }  }
}
Reason: