Looking at the last screenshot: "history cache allowed for 54260 bars and contains 54040 bars from 2023.01.02 13:00 to 2024.12.11 22:20"
You're trying to test from 2024.12.12 to 2024.12.13 and have no history loaded for that time.
Visual mode works as that basically runs like "every tick based on real ticks" which is what you should always be using anyway. "every tick" in MetaTrader is just OHLC and then it makes up the ticks, while "every tick based on real ticks" gets actual market data and uses that. Reference: Tick Data Explained. Remember MT4 is from 2005 and MT5 is from 2010, back in those days' shortcuts had to be taken if you didn't want the back test to take hours and literal days if you wanted to optimize something. These days you should always use "every tick based on real ticks".
- 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 noticed this behavior start once I restarted MT5. I don't think there was any updates when it restarted. I'm currently running MT5 Build 4831.
Context:
My EA will place a buy order every time the previous candle closed below the lower Bollinger band. So when there is a new bar I check if the previous candle close is below the Lower BB and if so, place an order. Well, ever since I restarted MT5 it will place one order in the first 10 minutes of session and then close the order due to end of test.
The interesting part is that when running the BT in visual mode, it will place all the orders, as it should. However, in non-visual mode, it won't. It'll place just one and finish the test at that exact time, as if the trading session had ended.
I should also mention that sometimes, it will just run the BT in non-visual mode just fine but most of the times it will finish it earlier.
This is the "broken" BT that finishes earlier:
You can see in the example where it ends prematurely that it says only 3 bars were generated.
I deleted all the cache under `Tester\cache` and all the data under `bases` but it hasn't fixed the issue.
Running with every tick based on real ticks seems to resolve but I'm not sure as the results vary. Some times it runs fine, sometimes it will finish earlier it seems completely random.
Please don't question the validity of the code, this EA is older than 1 year and I run backtests pretty much every week and only now I noticed this behavior. Also, we can clearly see the tests finishing off earlier than it should, my EA couldn't possibly cause that. If you have no clue and nothing to add your silence is appreciated.