Chart events in strategy tester

 

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.

 
Has no anybody an idea to this problem?
 
No events get fired, but you may still toggle the buttons and read their status.
 
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.
 
zirkoner:
Chart events are working in the Strategy Tester for indicators.
Not sure how it helps OP.
 
Ovo:
Not sure how it helps OP.
Really ?
 

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 

 
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
Reason: