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.
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");
//On Strategy Tester
Print("Closing All due to Close All Button Press in Strategy Tester");
//other on tick code here