Expand README with library features and setup guide

Added detailed library features and installation instructions.
This commit is contained in:
Matt
2026-05-19 22:04:46 +02:00
committed by GitHub
parent a6c3fbf042
commit 3d2b7d9812
+102 -49
View File
@@ -13,6 +13,26 @@ The library abstracts common functionality such as trade execution, risk managem
The primary goal is to reduce duplicated implementation, improve maintainability, and provide a modular foundation for building Expert Advisors and trading systems.
---
## 🧰 What the Library Provides
MT5 Quant Lib provides reusable infrastructure for common Expert Advisor development tasks.
The library includes utilities for:
- **Order management** — opening, modifying, and managing trade orders.
- **Position sizing** — calculating trade volume based on account risk, stop loss distance, and symbol properties.
- **Risk management** — applying consistent risk controls across trading systems.
- **Stop-loss management** — setting fixed, breakeven, trailing, and rule-based stop losses.
- **Take-profit handling** — supporting fixed targets and trade management rules.
- **Indicator access** — managing indicator handles and retrieving indicator buffer values.
- **Signal tracking** — maintaining signal state across symbols, bars, and strategy components.
- **Time/session filtering** — restricting logic to specific trading windows or market sessions.
- **Multi-symbol support** — helping Expert Advisors operate consistently across multiple instruments.
- **Backtesting support** — providing reusable utilities for testing and optimisation workflows.
The aim is to centralise common MT5 infrastructure so that strategy-specific code can stay focused on trading logic rather than repeated platform plumbing.
---
## 🎯 Engineering Focus
@@ -59,54 +79,60 @@ The library provides reusable modules including:
---
## 📈 Library Architecture
## 📂 Repository Structure
```mermaid
flowchart TD
```text
MT5-Quant-Lib/
A["Trade Execution"]
B["Risk Management"]
C["Indicator Management"]
D["Signal Tracking"]
E["Time Filters"]
F["Backtesting Utilities"]
G["Shared Helpers"]
H["MT5 Quant Lib"]
H --> A
H --> B
H --> C
H --> D
H --> E
H --> F
H --> G
├── Indicators/
├── Orders/
├── Utils/
├── BacktestUtils/
├── trend_following_ea.mq5
└── README.md
```
The library separates reusable infrastructure functionality into independent modules that can be combined as needed.
This approach improves:
- maintainability
- reusability
- modularity
- separation of concerns
- reduction of duplicated logic
Main modules:
- **Indicators/** — indicator wrappers and helper components
- **Orders/** — order execution and position management
- **Utils/** — shared utility classes and helper functions
- **BacktestUtils/** — optimisation and testing helpers
---
## 🧩 Example Application
## 🧩 Example Expert Advisor
The repository also contains a small example Expert Advisor demonstrating how library components can be integrated and used in a practical application.
The repository includes an example Expert Advisor demonstrating practical use of the library components within a complete multi-symbol trading workflow.
The example exists purely as a usage demonstration and is not the primary purpose of the repository.
The example EA illustrates how independent library modules can be composed into a larger application while keeping infrastructure concerns separated from strategy logic.
The example demonstrates:
- Multi-symbol processing across configurable instrument lists
- Event-driven execution using timer-based updates
- Signal construction using modular indicator components
- Composition of multiple entry conditions and trade rules
- Position sizing based on configurable risk settings
- Trade lifecycle management including entries, exits, and runners
- Trailing stop and breakeven management
- Signal memory and state tracking across bars
- Resource lifecycle management for indicator handles
- Train/test data separation for optimisation workflows
- Custom optimisation metrics through `OnTester()`
The example application intentionally keeps strategy logic modular by separating:
- signal generation
- trade execution
- risk calculations
- position management
- indicator handling
- state tracking
This demonstrates how reusable infrastructure components can support larger systems without tightly coupling implementation details.
[Example Expert Advisor](trend_following_ea.mq5)
---
@@ -120,16 +146,43 @@ The example exists purely as a usage demonstration and is not the primary purpos
---
## 🧠 Software Engineering Skills Demonstrated
## ⚙️ Installation
This project demonstrates:
Clone the repository:
```bash
git clone https://github.com/xMattC/mt5-quant-lib.git
```
Copy the library folder into your MetaTrader 5 `Include` directory:
```text
C:/Users/<YourUser>/AppData/Roaming/MetaQuotes/Terminal/<Terminal_ID>/MQL5/Include/
```
The final structure should look similar to:
```text
MQL5/
└── Include/
└── MyLibs/
├── Indicators/
├── Orders/
├── Utils/
├── BacktestUtils/
└── ...
```
The `Terminal_ID` directory is generated automatically by MetaTrader 5 and will vary between installations.
After copying the library, modules can be imported into Expert Advisors using:
```cpp
#include <MyLibs/Orders/EntryOrders.mqh>
#include <MyLibs/Orders/AdjustPosition.mqh>
EntryOrders entry_orders;
AdjustPosition adjust_pos;
```
- Reusable library design
- Object-oriented programming
- Modular architecture
- Infrastructure abstraction
- Risk-management implementation
- Multi-symbol systems
- Shared runtime development
- Separation of concerns
- Platform-specific software engineering