Creating fake ticks for MT5

To add comments, please log in or register
holocast
264
holocast  
#include <WinUser32.mqh>
#import "user32.dll"
int RegisterWindowMessageW(string lpString);
#import 
//+------------------------------------------------------------------+ 
//| script program start function | 
//+------------------------------------------------------------------+ 
int start() 
{ 
//---- 
int MT4InternalMsg = RegisterWindowMessageW("MetaTrader4_Internal_Message"); 
int hWnd = WindowHandle(Symbol(),Period()); 
PostMessageW(hWnd,MT4InternalMsg,2,1);
//---- 
return(0); 
} //+------------------------------------------------------------------+

Hello everyone, the code above creates a fake tick for MT4, am trying to do same for MT5 but it's not working. Can anyone confirm if this functionality is still possible in MT5, if yes how to do it.

Here's my attempt at converting the above code to MT5, it compiles fine, but the terminal does not react as it should.


#include <\\WinAPI\\winuser.mqh>
#import "user32.dll"
//int RegisterWindowMessageW(const string str);
#import 
//+------------------------------------------------------------------+
//| Script program start function                                    |
//+------------------------------------------------------------------+
void OnStart()
  {
//---
   uint MT4InternalMsg = RegisterWindowMessageW("MetaTrader5_Internal_Message"); 
   long hWnd = ChartGetInteger(0,CHART_WINDOW_HANDLE);
   PostMessageW(hWnd,MT4InternalMsg,2,1);
  }
//+------------------------------------------------------------------+

Am I missing anything?

Alain Verleyen
39559
Alain Verleyen  

Of course it doesn't work, there is no such thing as "MetaTrader5_Internal_Message".

Why do you want a tick ?

holocast
264
holocast  
Alain Verleyen:

Of course it doesn't work, there is no such thing as "MetaTrader5_Internal_Message".

Why do you want a tick ?

I'm trying to measure time it takes an EA to process all functions within the OnTick event. Unfortunately, markets are closed. If I could generate a fake tick, I can continue without waiting for market to open
Alain Verleyen
39559
Alain Verleyen  
holocast:
I'm trying to measure time it takes an EA to process all functions within the OnTick event. Unfortunately, markets are closed. If I could generate a fake tick, I can continue without waiting for market to open
Use a timer.
holocast
264
holocast  
Alain Verleyen:
Use a timer.

Good idea. Thanks

To add comments, please log in or register