Chart events in strategy tester

Back to topics list To post a new topic, please log in or register
avatar
6
petermql5 2015.05.24 16: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.

avatar
34
traderdoc 2016.01.23 17:21 #
 
Has no anybody an idea to this problem?
avatar
1111
Ovo 2016.01.23 19:31 #
 
No events get fired, but you may still toggle the buttons and read their status.
avatar
125
zirkoner 2016.01.26 19: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.
avatar
1111
Ovo 2016.01.26 23:06 #
 
zirkoner:
Chart events are working in the Strategy Tester for indicators.
Not sure how it helps OP.
avatar
125
zirkoner 2016.01.26 23:18 #
 
Ovo:
Not sure how it helps OP.
Really ?
avatar
1
alikadabra 2016.06.23 16: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 

avatar
13010
WHRoeder 2016.06.23 20: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
Back to topics list  

To add comments, please log in or register