What about checking the time? If the first TimeCurrent() is too far away from TimeLocal() - more than a couple of hours?
I will try, though I doubt it makes sense - the TimeCurrent should be tampered only in the tester thread, which is not the case here.
Ok I just read: "During testing in the Strategy Tester, TimeLocal() is always equal to TimeCurrent() simulated server time."
So you can use some WinApi-funtions - like GetSystemTime?
Ok I just read: "During testing in the Strategy Tester, TimeLocal() is always equal to TimeCurrent() simulated servertime."
So you can use some WinApi-funtions - like GetSystemTime?
I wonder if someone knows a way how to detect a 'visual' chart launched by the Strategy Tester using a pure MQL. I would like to prevent running my scripts on such a chart, as the chart does not update graphic objects with ChartRedraw(). The IsVisualMode returns false in scripts, and saved chart template indicates nothing about the visual mode.
I just did a short test on my setup (build 988) and these were my results:
- Indicators:
Indicators, when added to the "Visual Chart", are in fact detected by the Strategy tester and the "IsVisualMode()" does report correctly, but I do not know how much of the data and functions are correctly processed in emulated/simulated mode.
- Scripts:
It seems that adding a Script to the "Visual Mode" Chart is not detected by the Strategy Tester at all and consequently data is not emulated/simulated. In fact, any data such as Bid or Ask or calls to functions like MarketInfo() or OrdersTotal() for example, obtain the current "live" values and not the emulated/simulated values in the Strategy Tester.
So, in conclusion, even if you were able to detect if it was on the "Visual Chart" or not, the results obtained in the Script or manipulations of data or orders would report to the "live" state of things and not that of the emulated/simulated conditions in the Strategy Tester.
My suggestion is to give your customers this warning:
WARNING - NEVER attach Scripts to the Visual Chart as the results will reflect on the "live" chart and not the simulation. This is especially DANGEROUS if the Script manipulates Orders.
I just did a short test on my setup (build 988) and these were my results:
- Indicators:
Indicators, when added to the "Visual Chart", are in factdetected by the Strategy tester and the "IsVisualMode()" does reportcorrectly, but I do not know how much of the data and functions arecorrectly processed in emulated/simulated mode.
- Scripts:
It seems that adding a Script to the "Visual Mode" Chart is not detected by the Strategy Tester at all and consequently data is not emulated/simulated. In fact, any data such as Bid or Ask or calls to functions like MarketInfo() or OrdersTotal() for example, obtain the current "live" values and not the emulated/simulated values in the Strategy Tester.
So, in conclusion, even if you were able to detect if it was on the "Visual Chart" or not, the results obtained in the Script or manipulations of data or orders would report to the "live" state of things and not that of the emulated/simulated conditions in the Strategy Tester.
My suggestion is to give your customers this warning:
WARNING - NEVER attach Scripts to the Visual Chart as the results will reflect on the "live" chart and not the simulation. This is especially DANGEROUS if the Script manipulates Orders.
Thank you for the report. Actually the main reason I was trying to avoid the "visual" charts was, that they did not update graphical objects (I specified information in the first post). So using script interaction via GUI becomes tricky.
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
I wonder if someone knows a way how to detect a 'visual' chart launched by the Strategy Tester using a pure MQL. I would like to prevent running my scripts on such a chart, as the chart does not update graphic objects with ChartRedraw(). The IsVisualMode returns false in scripts, and saved chart template indicates nothing about the visual mode.