Download MetaTrader 5

OffLine Debug/ OnTick() emulator

To add comments, please log in or register
Sell products right in MetaTrader. Millions of traders are waiting for this!
Marcelo Coutinho
1151
Marcelo Coutinho 2014.05.10 01:44 

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 

Rodrigo Malacarne
Moderator
9892
Rodrigo Malacarne 2014.05.10 01:59  
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.
Marcelo Coutinho
1151
Marcelo Coutinho 2014.05.10 02:26  
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
Alexander Piechotta
6950
Alexander Piechotta 2014.05.10 10:59  

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);
   }
}

//+------------------------------------------------------------------+
Alain Verleyen
Moderator
30721
Alain Verleyen 2014.05.10 12:08  
FinGeR:

With the help of WinApi you can try it.

Here is an example for MetaTrader 4:

That doesn't work for MT5.
Rogerio Figurelli
Moderator
39545
Rogerio Figurelli 2014.05.10 13:44  
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? 

Marcelo Coutinho
1151
Marcelo Coutinho 2014.05.10 16:23  
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 :(
To add comments, please log in or register