Download MetaTrader 5

Pause / slow down visual mode speed

To add comments, please log in or register
puiucristian
24
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.

Abdullah Alrai
17913
Abdullah Alrai  
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
5164
Marco vd Heijden  

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
5521
Atsushi Yamanaka  

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  
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
5521
Atsushi Yamanaka  
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
5521
Atsushi Yamanaka  

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
5521
Atsushi Yamanaka  
I tried PostMessageW but still it doesn't work...
puiucristian
24
puiucristian  
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
5521
Atsushi Yamanaka  

>puiucristian

Thank you for trying to help.

But is it for MT5? 

To add comments, please log in or register