OffLine Debug/ OnTick() emulator

 

Hi,

Can someone please tell me if there is any option on MT5 that allows me to Debug a EA when the market is closed ?

I was wondering is there is any way to "send a tick" to the EA based on a market data.

Thank you

MRC 

 
YouTrade:

Hi,

Can someone please tell me if there is any option on MT5 that allows me to Debug a EA when the market is closed ?

I was wondering is there is any way to "send a tick" to the EA based on a market data.

Thank you

MRC 

You can try to put parts of code inside the event handler OnTimer( ). Of course it won't send any order to the market, however, functions involving copy of data and plots of indicators will work normally inside OnTimer( ). Of course it's not the best solution, however if you use it together with the Strategy Tester, it helps you do decrease significantly the development time of your code.
 
Malacarne:
You can try to put parts of code inside the event handler OnTimer( ). Of course it won't send any order to the market, however, functions involving copy of data and plots of indicators will work normally inside OnTimer( ). Of course it's not the best solution, however if you use it together with the Strategy Tester, it helps you do decrease significantly the development time of your code.
Thank you
 

With the help of WinApi you can try it.

Here is an example for MetaTrader 4:

/**
* MT4/experts/scripts/ticks.mq4
* send a fake tick every 200 ms to the chart and
* all its indicators and EA until this script is removed.
*/

#property copyright "© Bernd Kreuss"

#import "user32.dll"
   int PostMessageA(int hWnd, int Msg, int wParam, int lParam);
   int RegisterWindowMessageA(string lpString);
#import

int start(){
   int hwnd = WindowHandle(Symbol(), Period());
   int msg = RegisterWindowMessageA("MetaTrader4_Internal_Message");
   while(!IsStopped()){
      PostMessageA(hwnd, msg, 2, 1);
      Sleep(200);
   }
}

//+------------------------------------------------------------------+
 
FinGeR:

With the help of WinApi you can try it.

Here is an example for MetaTrader 4:

That doesn't work for MT5.
 
YouTrade:

Hi,

Can someone please tell me if there is any option on MT5 that allows me to Debug a EA when the market is closed ?

I was wondering is there is any way to "send a tick" to the EA based on a market data.

Thank you

MRC 

Hi Marcelo, what about Strategy Tester to do it using common functions like Print(), Comment(), etc?

Or are you talking about the MT5 debugger specifically? 

 
figurelli:

Hi Marcelo, what about Strategy Tester to do it using common functions like Print(), Comment(), etc?

Or are you talking about the MT5 debugger specifically? 

Debugger specifically :(
Reason: