Video summary

How to Get Historical Data from MT4

Main summary

Key takeaways

Technology

Overview

This video tutorial explains how to export historical market data from MetaTrader 4 (MT4) and use it in Expert Advisor Studio to generate trading strategies (Expert Advisors).

Steps / Key Concepts

  1. Download the MT4 historical data export script

    • In Expert Advisor StudioData section → download the MetaTrader 4 (.mq4) script.
    • If you’re not using Expert Advisor Studio, the script may also be included in the video’s resource file attachment.
  2. Load maximum historical data in MT4

    • In MT4, disable “Scroll the chart to the end of tick incoming.”
    • For each timeframe, start from M1, then move through: M5, M15, M30, H1, H4, D1, W1, MN (monthly):
      • Select the timeframe.
      • Press and hold the Home key to scroll back to the earliest available bars for that broker.
    • Notes:
      • Brokers provide different amounts of history.
      • Small timeframes (e.g., M1) take longer due to more bars.
      • Strategy-relevant outcome: on the monthly timeframe, the data can go back to November 1997 (example shown).
  3. Allow the platform to build historical data

    • After installing MT4 with your broker, leave it running for 1–2 days so historical data gradually builds up, allowing deeper scrolling than right after first launch.
  4. Determine trading costs: spread and commission

    • Spread
      • In Market Watch, right-click → Spread.
      • Example: for EURUSD, spread is roughly 19–20 (video mentions an ~18–20 range).
    • Commission
      • Open a quick demo buy order (one-click trading).
      • Example result: commission shown as 0.
    • These values are important because they feed into the export/strategy generation inputs.
  5. Install/compile the export script in MT4

    • Copy the downloaded .mq4 script into MT4’s data path:
      • File → Open Data Folder → MQL4 → Scripts
    • Then refresh the Scripts node in Navigator so MT4 compiles it.
  6. Run the script on the chart to export bars

    • Example strategy timeframe: H1 (1-hour).
    • Drag the script from Scripts into the H1 chart.
    • Script inputs:
      • Enter spread (use a pessimistic/max style choice by selecting a higher spread value within the observed range).
      • Set commission to 0 (as measured on the demo order).
    • Result:
      • The script exports historical bars (files created per timeframe).
  7. Export the generated data into Expert Advisor Studio

    • Open MT4’s data folder again:
      • MQL4 → Files
    • In Expert Advisor Studio:
      • Select the exported files and drag/drop them into the drop zone.
    • After upload, they’re used to generate strategies.

Main sources / speakers

  • “Hi, guys…” narrator / presenter (only a single unnamed speaker is indicated; no other voices are referenced).

Original video