HosseinKOGO:
Hi friends,
I've noticed when I use GVs in my code, They does save when I do backtest. How can I prevent saving and also retrieving GVs during backtest while they are permitted to save and retrieve in Live trading? Any idea?
check what mode it is running and and control from there
https://docs.mql4.com/check/istesting
https://docs.mql4.com/check/isvisualmode
https://docs.mql4.com/check/isoptimization
but if you require GVs but ignore them in testing will the testing results be valid...

- Why do you care? Other than diagnostics during non-live/non-optimizer modes, you shouldn't be doing anything different.
- Test for it.
Detect optimization mode programmatically - Expert Advisors - MQL5 programming forum (2020.05.15)

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
Hi friends,
I've noticed when I use GVs in my code, They does save when I do backtest. How can I prevent saving and also retrieving GVs during backtest while they are permitted to save and retrieve in Live trading? Any idea?