Download MetaTrader 5
To add comments, please log in or register
Manage agents in your profile. It is easy!
puiucristian
24
puiucristian 2016.01.24 17:31 

Greetings.

 Is there any way that I can pause or slow down the speed value while testing in visual mode? 

 I want to run it at  32 speed and pause or slow down when a condition is met, so i can see visually what's going on.

Abdullah Alrai
11337
Abdullah Alrai 2016.01.24 18:00  
puiucristian:

Greetings.

 Is there any way that I can pause or slow down the speed value while testing in visual mode? 

 I want to run it at  32 speed and pause or slow down when a condition is met, so i can see visually what's going on.

i like to learn that too
Marco vd Heijden
Moderator
4073
Marco vd Heijden 2016.01.24 21:55  

There is no way to alter the playback speed other then to move the speed slider.

If there was i would have implemented it.

Atsushi Yamanaka
5321
Atsushi Yamanaka 2016.01.29 05:18  

you can press "pause" in your code.

#import "user32.dll"

bool YourCondition=true;
if(YourCondition)
  {
  int hwnd = WindowHandle(Symbol(),Period());
  PostMessageA(hwnd, WM_KEYDOWN, 19, 0);//19=Pause
  PostMessageA(hwnd, WM_KEYUP, 19, 0);
  }
puiucristian
24
puiucristian 2016.01.29 12:42  
Atsushi Yamanaka:

you can press "pause" in your code.

you're my hero!

 I had to include this line too to make it work

 

#include <WinUser32.mqh>
Atsushi Yamanaka
5321
Atsushi Yamanaka 2016.01.29 19:15  
puiucristian:

you're my hero!

 I had to include this line too to make it work

 

sorry, i forgot and thanx to cover.
Atsushi Yamanaka
5321
Atsushi Yamanaka 2016.02.02 01:10  

Now I need to ask you to help.

On MT5 tester, how come this didn't work? 

#include <WinUser32.mqh> 
#import "user32.dll" 

bool mycondition=true;
if(mycondition && MQLInfoInteger(MQL_TESTER)==1)
            {
              int hwnd = (int)ChartGetInteger(ChartID(),CHART_WINDOW_HANDLE,0);
              PostMessageA(hwnd, WM_KEYDOWN, 32, 0);//32=Space
              PostMessageA(hwnd, WM_KEYUP, 32, 0);
              Print("hwnd= ",hwnd);
            }
Atsushi Yamanaka
5321
Atsushi Yamanaka 2016.02.04 06:19  
I tried PostMessageW but still it doesn't work...
puiucristian
24
puiucristian 2016.02.04 20:49  
Atsushi Yamanaka:
I tried PostMessageW but still it doesn't work...

I'm not sure why your code doesn't work

 

I use this one to pause it

 

void pause()
{
   int hwnd = WindowHandle(Symbol(),Period());
   PostMessageA(hwnd, WM_KEYDOWN, 19, 0);
   PostMessageA(hwnd, WM_KEYUP, 19, 0);
}

 

something like

 

if(mycondition && MQLInfoInteger(MQL_TESTER)==1) pause();
Atsushi Yamanaka
5321
Atsushi Yamanaka 2016.02.06 10:09  

>puiucristian

Thank you for trying to help.

But is it for MT5? 

/
To add comments, please log in or register