.gitignore for MetaTrader 5

26 ignore rules for MetaTrader 5, ready to copy into your repository.

Trading platform

The complete .gitignore for MetaTrader 5

# Generated by LFGitignore - https://lfgitignore.com
# Created: 2026-08-05 01:34:42 UTC
# Technologies: MetaTrader 5

### MetaTrader 5 ###
*.ex5
# For MQL4 compatibility if you also manage MT4 projects in a similar structure
*.ex4
# Log file
*.log
# Strategy Tester logs
*.slog
# FXT files (history data for testing)
*.fxt
# History data files (can be large)
*.hst
# Initialization files (often generated by tester or EAs)
*.ini
# Data files (various purposes, often temporary)
*.dat
# CSV export files (e.g., from tester reports)
*.csv
# Journal files (tester journal)
*.jrn
# Market Watch symbol sets
*.set
# Chart templates
*.tpl
# Chart settings files (can be generated when saving templates or profiles)
*.chr
# Dynamic link library
*.dll
# Environment variables (e.g., for Python integration credentials)
.env
# Configuration files (if not meant to be shared)
*.cfg
# Be careful: if you have config JSONs you *do* want to commit, add specific exceptions.
*.json
# Temporary files (e.g., ~MyScript.mq5)
*.~*
# Backup files (e.g., MyScript.mq5.bak)
*.bak
*.mqh.bak
*.mq5.bak
.mqproj
# Python compiled bytecode cache
__pycache__/
# Jupyter Notebook checkpoints
.ipynb_checkpoints/
# Python compiled files
*.pyc
# Python dynamic modules
*.pyd

What these MetaTrader 5 rules actually ignore

Every pattern below, and why it belongs in your .gitignore.

These are generated from .mq5 source files and should not be committed.

Pattern What it ignores
*.ex5 These are generated from .mq5 source files and should not be committed.
*.ex4 For MQL4 compatibility if you also manage MT4 projects in a similar structure

Terminal logs, strategy tester logs, and custom logs from Print() functions.

Pattern What it ignores
*.log Log file
*.slog Strategy Tester logs

History data, optimization results, and temporary files used by the tester.

Pattern What it ignores
*.fxt FXT files (history data for testing)
*.hst History data files (can be large)
*.ini Initialization files (often generated by tester or EAs)
*.dat Data files (various purposes, often temporary)
*.csv CSV export files (e.g., from tester reports)
*.jrn Journal files (tester journal)

User-specific lists of symbols in Market Watch, and terminal profiles.

Pattern What it ignores
*.set Market Watch symbol sets
*.tpl Chart templates
*.chr Chart settings files (can be generated when saving templates or profiles)
*.dll Dynamic link library

Files containing sensitive information or local user settings.

Pattern What it ignores
.env Environment variables (e.g., for Python integration credentials)
*.cfg Configuration files (if not meant to be shared)
*.json Be careful: if you have config JSONs you *do* want to commit, add specific exceptions.

Temporary files and backup files generated by MetaEditor

Pattern What it ignores
*.~* Temporary files (e.g., ~MyScript.mq5)
*.bak Backup files (e.g., MyScript.mq5.bak)
*.mqh.bak Temporary files and backup files generated by MetaEditor
*.mq5.bak Temporary files and backup files generated by MetaEditor

Project files for MetaEditor workspaces.

Pattern What it ignores
.mqproj Project files for MetaEditor workspaces.
__pycache__/ Python compiled bytecode cache
.ipynb_checkpoints/ Jupyter Notebook checkpoints
*.pyc Python compiled files
*.pyd Python dynamic modules

How to use this .gitignore for MetaTrader 5

  1. Copy the MetaTrader 5 rules above, or download the file directly.
  2. Create a file named .gitignore at the root of your Git repository and paste the rules into it.
  3. If some of those files are already tracked, run git rm -r --cached . then commit again — Git only applies ignore rules to untracked files.
  4. Commit the .gitignore so everyone on the team shares the same rules.