Make Buttons Work on MQL5 backtest
Correct, but there is a partial work-around you can use. The code below is for MQL4 but you can adjust it for MQL5 ...
Forum on trading, automated trading systems and testing trading strategies
Chart Event For MT4 Backtester
Fernando Carreiro, 2016.04.03 15:40
I know this is a an old thread, but I recently needed to debug some of my code that implements "buttons" to control certain aspects of an EA I was coding and had need for it to work in the Strategy Tester.
The solution I came up with was to check the button states on every incoming tick when the EA was in Visual Mode.
In other words, something like this:
void CheckResetButton() { if( bool( ObjectGetInteger( 0, idResetButtonObject, OBJPROP_STATE ) ) ) { Print( "Reset Button Clicked" ); ObjectSetInteger( 0, idResetButtonObject, OBJPROP_STATE, false ); } } void OnTick() { // Only needed in Visual Testing Mode if( IsVisualMode() ) { // Check Chart Buttons in Visual Mode CheckResetButton(); } return; }
Hello friends
Please I'm trying to make my gui buttons work on MT5 backtest
Below is the code I used
Please help. Thanks