Summary: Fix historical data errors in MT4/MT5 backtesting. This guide shows how to download full data, export from broker, and set correct modeling mode for accurate EA testing.
Step 1: Identify the Historical Data Error
Run a backtest on your EA. If you see warnings like "Not enough history data" or "Chart gaps detected" or the backtest only runs for a short period, you have a historical data error. Screenshot: Backtest report showing insufficient data message.
Step 2: Open Symbol Management
In MT4/MT5, click "View" > "Symbols" (or press Ctrl+U). Find the currency pair or instrument you are testing. Screenshot: Symbols window with list of instruments.
Step 3: Enable All Timeframes for That Symbol
Select your symbol, click "Properties". Check that all timeframes (M1 to MN1) are visible. If any are disabled, enable them. Screenshot: Symbol properties with all timeframes checked.
Step 4: Download Fresh Historical Data
Click "Tools" > "Options" (MT4) or "Settings" (MT5). Go to the "Charts" tab. Increase "Max bars in chart" to 2000000 or more. Then go back to the main window. Press F2 to open the History Center. Screenshot: History Center window.
Step 5: Select Symbol and Timeframe in History Center
In History Center, expand your symbol folder. Select "1 Minute" data. Click "Download". Wait for the progress bar to complete. Repeat for other timeframes (5M, 15M, 1H, 4H, 1D). Screenshot: Download button and progress bar.
Step 6: Export Data from Your Broker (Alternative Method)
If built-in download fails, go to "Tools" > "History Center". Select your symbol, then click "Export". Save as CSV. Then ask your broker support for a complete history CSV file. Import it using "Import" button in the same History Center window. Screenshot: Export and Import buttons.
Step 7: Set Correct Modeling Mode
Open Strategy Tester (Ctrl+R). Click the modeling mode dropdown. Select "Every tick" (the most accurate) instead of "Control points" or "Open prices only". Screenshot: Modeling mode dropdown showing "Every tick" selected.
Step 8: Increase Backtest Period Length
In Strategy Tester, set "From" date to at least 2 years before current date (e.g., 2024-01-01 to 2026-06-07). Avoid starting dates that are too recent. Screenshot: Date range fields filled correctly.
Step 9: Clear Cache and Restart MT4/MT5
Close MT4/MT5. Navigate to your data folder: "File" > "Open Data Folder". Delete the "bases" folder (cache). Then restart MT4/MT5. Screenshot: Data folder with bases folder highlighted.
Step 10: Re-run Backtest
Run the same backtest again. The "not enough history" error should disappear. The backtest progress bar should cover the entire selected date range. Check the Journal tab for any remaining warnings. Screenshot: Successful backtest running without errors.
Reference: MetaQuotes Help Desk - History Center and Backtesting / MQL5 Documentation - Testing on Historical Data.