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?
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.
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; } ..... ..... }
//{ 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 } } }
void OnTick() {if(IsTesting() && isTradeTimeString(Time_Begin,Time_End))// to disable all functions and speed up the advisor to the opening time Time_Begin previously defined as input string Time_Begin1 = "10:00:00"; ....
}
input string Time_Begin = "10:00:00";
input string Time_End = "12:00:00";
void OnTick()
{
bool EA_on = true;
if(IsTesting() && !isTradeTimeString(Time_Begin,Time_End))// to disable all functions and speed up the advisor to the opening time Time_Begin
{
EA_on = false; // The tradebot is not using computer´s resources and not calculating nor plotting graphics.
if (EA_on == true)}
.... your action script ...
- 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 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?