How button work on backtest.

 

Dear guys

I create a button. it work on very well. but it is not work on backtest. I don't know why. can anyone tell me how button work on backtest on visual mode. 

Thanks 

 
Buttons do not work in a visual back test - it's a limitaton of the MQL code.
 
d4v3:
Buttons do not work in a visual back test - it's a limitaton of the MQL code.


But i download this product : https://www.mql5.com/en/market/product/XXXX

it work button on visual back testing. How it work? 

 
It probably uses MT4GUI which does work in visual back tests.
 
d4v3:
It probably uses MT4GUI which does work in visual back tests.


no this product not use any plugin. Because it don't download any plugin file.  Here the file i download from market and test on visual backtests, button also work on back tests. 

 

 

 

regardless to your issue

martingale is a very dangerous strategy it can wipe you out 

 
In that case it probably uses OBJ_RECTANGLE_LABEL instead of OBJ_BUTTON - I can not find the place where I read that Buttons do not work when back testing, but maybe the Rectangle Label does.
 
d4v3:
Buttons do not work in a visual back test - it's a limitaton of the MQL code.
Buttons are working in visual backtest. It's chartevent event handler which is not working.
 
capilta:

Dear guys

I create a button. it work on very well. but it is not work on backtest. I don't know why. can anyone tell me how button work on backtest on visual mode. 

Thanks 

 

You have to  check the button state :

ObjectGetInteger(chart,objname,OBJPROP_STATE);

Which can only be done in OnTick() with the Strategy Tester, as other events (OnTimer, OnChartEvent) are not working.

 
angevoyageur:
Buttons are working in visual backtest. It's chartevent event handler which is not working.

Thanks for the clarification. Do you know whether this is something that MQL are going to fix?


I've been putting off converting all my Buttons from MT4GUI to the new MQL code for this very reason (as well as the lack of ENUM_BORDER_TYPE for Buttons), and I'm still not sure whether it is worth creating the code for OnTick and OnChartEvent so that they will also work when back testing.

 
I HAVE THE SAME PROBLEM, i would suggest to you not to convert all your files to mt4gui, but to make a function one, for buttons on the tester and the other for real.
Reason: