Graphical objects do not work during optimisations.
Instead, write your code not to depend on graphical objects for data. Use variables (they are way faster).
Only use graphical objects for display purposes if really needed. Have an option to enable them or not for the user, but don't depend on them for the logic execution.
Operation of Programs in the Strategy Tester - MQL4 programs - MQL4 Reference
Graphical Objects in Testing
During visualization, the Expert Advisor interacts with a real chart. In case there is no visualization, the Expert Advisor works with a "virtual" chart that is not displayed. The former case has some peculiarities. During optimization, working with graphical objects is not supported.
![Operation of Programs in the Strategy Tester - MQL4 programs - MQL4 Reference Operation of Programs in the Strategy Tester - MQL4 programs - MQL4 Reference](https://c.mql5.com/36/58/operation-of-programs-in-the-strategy.png)
- docs.mql4.com
Operation of Programs in the Strategy Tester - MQL4 programs - MQL4 Reference
Graphical Objects in Testing
During visualization, the Expert Advisor interacts with a real chart. In case there is no visualization, the Expert Advisor works with a "virtual" chart that is not displayed. The former case has some peculiarities. During optimization, working with graphical objects is not supported.
got it, thank you very much:)
![MQL5 - Language of trade strategies built-in the MetaTrader 5 client terminal](https://c.mql5.com/i/registerlandings/logo-2.png)
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
see code example and pic attached.