Osazee Asikhemhen #: That means I can't use buttons on strategy tester?
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; }
And please don't add so much white-space in your posts. I have edited them and removed the extra blank lines.
You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
Hello friends
Please I'm trying to make my gui buttons work on MT5 backtest
Below is the code I used
Please help. Thanks