Skip to content

Repository files navigation

πŸš€ Portable MetaTrader 5 Development Environment

License: MIT PowerShell VS Code MetaTrader 5

A comprehensive template and toolkit for setting up a professional, portable MetaTrader 5 development environment with VS Code integration, automated compilation, and symbolic link management.

🎯 What This Repository Provides

This repository contains battle-tested scripts, configurations, and documentation for creating a complete portable development environment that can be used for MetaTrader 5 projects and adapted for other portable application scenarios.

✨ Key Features

  • πŸ”§ Portable MetaTrader 5 Setup: Complete configuration for portable MT5 installation
  • πŸ”— File-Level Symbolic Links: Smart symbolic link management (not folder-level)
  • πŸ–₯️ VS Code Integration: Full IDE integration with one-click compilation
  • ⚑ Automated Compilation: Breakthrough solution using undocumented /portable flag
  • πŸ“š Comprehensive Documentation: Step-by-step guides and technical documentation
  • πŸ› οΈ PowerShell Automation: Complete toolkit for project management
  • πŸ§ͺ Testing Framework: Validation scripts and testing tools

πŸš€ Quick Start

Prerequisites

  • Windows 10/11 or Windows Server
  • PowerShell 5.1 or later
  • Visual Studio Code
  • MetaTrader 5 (portable installation)
  • Administrator privileges (for symbolic link creation)

1. Clone and Setup

git clone https://github.com/IanIT/PortableMT5Dev.git
cd PortableMT5Dev

2. Run Initial Setup

# Run as Administrator
.\setup\Initialize-Environment.ps1

3. Configure Your Project

# Customize for your project
.\setup\Configure-Project.ps1 -ProjectName "YourProject" -MT5Path "C:\MetaTrader 5"

4. Create Symbolic Links

# Create file-level symbolic links
.\tools\CreateFileSymlinks.ps1

5. Open in VS Code

# Open configured environment
code .

πŸ“ Repository Structure

PortableMT5Dev/
β”œβ”€β”€ πŸ“ setup/              # Initial setup scripts
β”œβ”€β”€ πŸ“ tools/              # PowerShell automation tools
β”œβ”€β”€ πŸ“ templates/          # Project templates
β”œβ”€β”€ πŸ“ vscode/             # VS Code configuration
β”œβ”€β”€ πŸ“ documentation/      # Comprehensive guides
β”œβ”€β”€ πŸ“ examples/           # Usage examples
β”œβ”€β”€ πŸ“ tests/              # Validation tests
└── πŸ“ .github/            # GitHub configuration

πŸ”§ Core Components

1. Portable MetaTrader 5 Configuration

  • Complete portable installation setup
  • Configuration file management
  • Path resolution solutions

2. Symbolic Link Management

  • File-level symbolic links (not folder-level)
  • Conflict prevention with naming conventions
  • Automatic link creation and validation

3. VS Code Integration

  • Task configuration for compilation
  • Status bar buttons for one-click actions
  • Problem matchers for error detection
  • Extension recommendations

4. Automated Compilation

  • Breakthrough discovery: Undocumented /portable flag
  • Reliable PowerShell compilation scripts
  • Error handling and logging
  • Output validation

🌟 Why This Approach?

File-Level vs Folder-Level Symbolic Links

❌ Folder-Level Symlinks (Common Approach)

  • Risk of entire folder conflicts
  • Difficult to manage multiple projects
  • Complex path resolution issues

βœ… File-Level Symlinks (Our Approach)

  • Precise control over individual files
  • Unique naming prevents conflicts
  • Clean, maintainable structure
  • Easy to debug and troubleshoot

Portable Installation Benefits

  • Complete isolation from system installations
  • Version control over MT5 environment
  • Team collaboration with consistent setups
  • No registry dependencies
  • Easy backup and migration

πŸ“š Documentation

Quick References

Technical Documentation

Best Practices

πŸ› οΈ Available Tools

Setup Tools

  • Initialize-Environment.ps1 - Complete environment setup
  • Configure-Project.ps1 - Project-specific configuration
  • Validate-Setup.ps1 - Environment validation

Symbolic Link Management

  • CreateFileSymlinks.ps1 - Create file-level symbolic links
  • ValidateSymlinks.ps1 - Verify symbolic link integrity
  • RemoveSymlinks.ps1 - Clean removal of symbolic links

Compilation Tools

  • Compile-MQL5.ps1 - Advanced compilation script
  • Build-Project.ps1 - Simple build script
  • Test-Compilation.ps1 - Compilation validation

VS Code Integration

  • Setup-VSCode.ps1 - VS Code configuration
  • Install-Extensions.ps1 - Extension management
  • Configure-Tasks.ps1 - Task setup

πŸ§ͺ Testing

Run the complete test suite to validate your setup:

# Run all tests
.\tests\Run-AllTests.ps1

# Run specific test categories
.\tests\Run-Tests.ps1 -Category "SymbolicLinks"
.\tests\Run-Tests.ps1 -Category "Compilation"
.\tests\Run-Tests.ps1 -Category "VSCodeIntegration"

🎯 Use Cases

MetaTrader 5 Development

  • MQL5 Expert Advisors
  • Custom Indicators
  • Trading Scripts
  • Libraries and Frameworks

Other Portable Applications

  • Portable development environments
  • Isolated testing environments
  • Team collaboration setups
  • Version-controlled configurations

🀝 Contributing

We welcome contributions! This project benefits from community input and improvements.

How to Contribute

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

Areas for Contribution

  • Other Application Support: Extend beyond MetaTrader 5
  • Platform Support: Linux/macOS adaptations
  • IDE Integration: Support for other IDEs
  • Language Support: Additional programming languages
  • Documentation: Translations and improvements
  • Testing: Additional test cases and validation

Contribution Guidelines

  • Follow existing code style and conventions
  • Add tests for new functionality
  • Update documentation for changes
  • Ensure all tests pass before submitting

πŸ“‹ Roadmap

Phase 1: Core Functionality βœ…

  • Portable MetaTrader 5 setup
  • File-level symbolic links
  • VS Code integration
  • Automated compilation
  • Comprehensive documentation

Phase 2: Extended Support πŸ”„

  • Support for other portable applications
  • Linux/macOS compatibility
  • Additional IDE integrations
  • Enhanced testing framework

Phase 3: Community Features πŸ“‹

  • Plugin system for extensions
  • Community template library
  • Automated setup wizard
  • Integration with CI/CD pipelines

πŸ“œ License

This project is licensed under the MIT License - see the LICENSE file for details.

πŸ™ Acknowledgments

  • MetaQuotes for MetaTrader 5 platform
  • Microsoft for Visual Studio Code
  • PowerShell Community for automation tools
  • Contributors who helped improve this project

πŸ“ž Support


⭐ If this project helps you, please give it a star! It helps others discover this solution.

Made with ❀️ by the community for the community.

About

A comprehensive template and toolkit for setting up a professional, portable MetaTrader 5 development environment with VS Code integration, automated compilation, and symbolic link management.

Topics

Resources

Contributing

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages