Download MetaTrader 5
To add comments, please log in or register
Post web links to other trader's signals and make profit
petermql5
32
petermql5 2015.05.24 14:42 

Hi,

I've searched over the internet and this forum about running chart events in strategy tester and everybody confirms, including MQL4 documentation, that chart events don't run in the tester.

Then I ran into this simulator (http://mt4-trading-simulator.com/index.php) that has full-fledged GUI running in the tester and can use buttons and other visual control and thus places orders while in the tester.

Does anybody have any idea on how this can be done? Is there any Windows API that can help?

If you don't want to run the EX4, here is the video demo https://www.youtube.com/watch?v=6uha8JmsXV4

Thanks in advance.

programmierer
74
programmierer 2016.01.23 16:21  
Has no anybody an idea to this problem?
Ovo Cz
2951
Ovo Cz 2016.01.23 18:31  
No events get fired, but you may still toggle the buttons and read their status.
Zirkon
123
Zirkon 2016.01.26 18:31  
Ovo:
No events get fired, but you may still toggle the buttons and read their status.
Chart events are working in the Strategy Tester for indicators.
Ovo Cz
2951
Ovo Cz 2016.01.26 22:06  
zirkoner:
Chart events are working in the Strategy Tester for indicators.
Not sure how it helps OP.
Zirkon
123
Zirkon 2016.01.26 22:18  
Ovo:
Not sure how it helps OP.
Really ?
alikadabra
3
alikadabra 2016.06.23 14:34  

the solution I found is to add a piece of code in OnTick that check to see if the Strategy Tester is running if so get the state manually. If EA is running live then just use the OnChartEvent

 

//On regular trading 

void OnChartEvent(const int id,                 const long& lparam,                 const double& dparam,                  const string& sparam)

{

   if(sparam=="CloseButton") // Close button has been pressed

   {

      Print("Closing All Positions Due CloseAll Button Press");

     CloseOrdersAndReset();   

      Stopping=true;

      ObjectSetInteger(0,"CloseButton",OBJPROP_STATE,false);

   }

}  

 

//On Strategy Tester

 void OnTick()

{    if(IsTesting()){

      if(ObjectGet("CloseButton",OBJPROP_STATE))

      {

         Print("Closing All due to Close All Button Press in Strategy Tester");

         CloseOrdersAndReset();

         Stopping=true;

         ObjectSet("CloseButton",OBJPROP_STATE,0);

      }

   }

 

//other on tick code here 

whroeder1
13627
whroeder1 2016.06.23 18:29  
alikadabra: the solution I found is to add a piece of code in OnTick that check to see if the Strategy Tester is running if so get the state manually. If EA is running live then just use the OnChartEvent
  1. Don't paste code
    Play video
    Please edit your post.
    For large amounts of code, attach it.

  2. Exactly Chart Event For MT4 Backtester (Migel) - MQL4 forum
/
To add comments, please log in or register