.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-09-17 18:11:20 UTC
# Technologies: MetaTrader 5

### MetaTrader 5 ###
*.ex5
*.ex4
# Log file
*.log
*.slog
*.fxt
*.hst
*.ini
*.dat
*.csv
*.jrn
*.set
*.tpl
*.chr
# Dynamic link library
*.dll
# Environment variables
.env
*.cfg
*.json
*.~*
# Backup file
*.bak
*.mqh.bak
*.mq5.bak
.mqproj
# Python bytecode cache directory
__pycache__/
.ipynb_checkpoints/
*.pyc
*.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.

For MQL4 compatibility if you also manage MT4 projects in a similar structure

Pattern What it ignores
*.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

Strategy Tester logs

Pattern What it ignores
*.slog Strategy Tester logs

FXT files (history data for testing)

Pattern What it ignores
*.fxt FXT files (history data for testing)

History data files (can be large)

Pattern What it ignores
*.hst History data files (can be large)

Initialization files (often generated by tester or EAs)

Pattern What it ignores
*.ini Initialization files (often generated by tester or EAs)

Data files (various purposes, often temporary)

Pattern What it ignores
*.dat Data files (various purposes, often temporary)

CSV export files (e.g., from tester reports)

Pattern What it ignores
*.csv CSV export files (e.g., from tester reports)

Journal files (tester journal)

Pattern What it ignores
*.jrn Journal files (tester journal)

Market Watch symbol sets

Pattern What it ignores
*.set Market Watch symbol sets

Chart templates

Pattern What it ignores
*.tpl Chart templates

Chart settings files (can be generated when saving templates or profiles)

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

Environment variables (e.g., for Python integration credentials)

Pattern What it ignores
.env Environment variables

Configuration files (if not meant to be shared)

Pattern What it ignores
*.cfg Configuration files (if not meant to be shared)

Be careful: if you have config JSONs you *do* want to commit, add specific exceptions.

Pattern What it ignores
*.json Be careful: if you have config JSONs you *do* want to commit, add specific exceptions.

Temporary files (e.g., ~MyScript.mq5)

Pattern What it ignores
*.~* Temporary files (e.g., ~MyScript.mq5)

Backup files (e.g., MyScript.mq5.bak)

Pattern What it ignores
*.bak Backup file
*.mqh.bak Backup files (e.g., MyScript.mq5.bak)
*.mq5.bak Backup files (e.g., MyScript.mq5.bak)

Project files for MetaEditor workspaces.

Pattern What it ignores
.mqproj Project files for MetaEditor workspaces.

Python compiled bytecode cache

Pattern What it ignores
__pycache__/ Python bytecode cache directory

Jupyter Notebook checkpoints

Pattern What it ignores
.ipynb_checkpoints/ Jupyter Notebook checkpoints

Python compiled files

Pattern What it ignores
*.pyc Python compiled files

Python dynamic modules

Pattern What it ignores
*.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.