I can not help much ... because I use backtesting/optimization on MT4 just to understand about how EA works (where stop loss/tp is place to, and so on).
Anyway, there are two posts on the forum about the following:

How to Start with Metatrader 5 - How to Prepare Metatrader 5 Quotes for Other Applications
- 2017.02.08
- Sergey Golubev
- www.mql5.com
How to prepare metatrader 5 quotes for other applications. To send changes to the repository, execute the. Mql5 programming language: advanced use of the trading platform metatrader 5: creating trading robots and indicators

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
In MT4 using the Strategy tester, the data only allows a certain range of dates. Right now its from 8/9/2023 to 4/9/2024 in one installation and only a few days in another. There is a bug. I have found a work-around.
Version2: 4.00 Build 1415 1 MAR 2024 (Oanda's version and the same for Forex.com)
Issue:
Using the History Center, I can update any pair and timeframe. The data is there. It's just not used by the tester.
The History data is stored is the main History folder in .hst files. The tester data is created and stored in the ../Tester/History folder in .fxt files. This also seems to use a cache file in the folder ../tester/cache.
After a new install, the first time using the strategy tester, the Journal will show gathering data day by day. This never seems to happen again if the date range changes. Just tried again and the data starts on 8/9/2023 even though I requested 1/1/2022.
Example issue 1: Sometimes in using the Optimization option, I will pick one of the results and one a single test. The data range used, with no setting changes other than unchecking the Optimization box are different. This one cost me many hours of frustration think I had done something wrong. Nope, it just decides to us different range....meaning the data became unavailable.
Example issue 2: Started with a new pair AUDUSD H1. Set date range to test an EA. 1/1/2022 to 4/9/2024. Started the test on an EA. The Journal loads backwards day by day and stops on 8/9/2023. So I go to the History Center and load the remaining data for the pair and timeframe. The run the test again. This time the date range use is 5/25/2023 to 4/9/2023. No errors.
Example 2 modified: Ok, so I do this in shifts. Since it stopped at 5//25/2023, I'll use 1/1/2022 to 5/24/2023 as my new range.
So, Ok, let me go back to History Center and re-download the data. According to his tool I have data now from 1993.
This seemed to work for the new range. I'll record this as a Work-around below. Tested a few more times and this seems to work.
What have I already done to fix this?
1. Before you send me to other threads. I have watched a dozen videos on this.
2. Read every thread on the internet. :-)
3. Reinstalled MetaTrader 4 multiple times.
4. Working on two different installs with two different brokers.
5. Downloaded data from a third party and replaced the .hst and .fxt files.
6. There are no errors in the Strategy Tester Journal.
7. Working two primary pairs, but have tested multiple pairs and timeframes.
Work-around
There are still bugs. Shouldn't be this confusing and with no indication something has changed or what data is being used.
1. When back testing (Strategy Tester) - Always confirm that the range it used is the range you specified. If your EA trades at least once a day, you can see this in the Results tab.
2. After running your first test and seeing a different range used
I hope this helps. Maybe an admin here can fill in the blanks as to why this is happening.