forked from rosh/MQL5Book
108 lines
4.7 KiB
Markdown
108 lines
4.7 KiB
Markdown
# MQL5 Programming for Traders
| |
| |
Examples from the book [MQL5 Programming for Traders](https://www.mql5.com/en/book) - author [Stanislav Korotky](https://www.mql5.com/en/users/marketeer/publications)
| |
| |
The repository is organized into the [standard `MQL5/` directory structure](https://www.metatrader5.com/en/metaeditor/help/structure) (Scripts / Experts / Indicators / Include / Files, etc.) and grouped by book sections (**p1 … p7**) to make it easy to:
| |
- open the project in MetaEditor,
| |
- compile examples as you progress through the book,
| |
- run them in MetaTrader 5 and in the Strategy Tester.
| |
| |
| |

| |
| |
## Links
| |
| |
- Book (online): https://www.mql5.com/en/book
| |
- Repository (Algo Forge): https://forge.mql5.io/rosh/MQL5Book
| |
| |
CodeBase publications with source examples by part:
| |
- Part 1: https://www.mql5.com/en/code/45590
| |
- Part 2: https://www.mql5.com/en/code/45591
| |
- Part 3: https://www.mql5.com/en/code/45592
| |
- Part 4: https://www.mql5.com/en/code/45593
| |
- Part 5: https://www.mql5.com/en/code/45594
| |
- Part 6: https://www.mql5.com/en/code/45595
| |
- Part 7: https://www.mql5.com/en/code/45596
| |
| |
## Contents in Parts
| |
| |
> A brief overview of each section to help you quickly locate examples and understand what to practice.
| |
| |
- **Part 1 — [Introduction to MQL5 and development environment](https://www.mql5.com/en/book/intro) (p1)**
| |
Getting started with MetaEditor: editing, compiling, and running code; basic types and variables; expressions; arrays; debugging; and outputting data.
| |
| |
- **Part 2 — [Fundamentals of MQL5 programming](https://www.mql5.com/en/book/basis) (p2)**
| |
Core building blocks of the language: data types, identifiers, variables, operators, expressions, statements, and procedural logic construction.
| |
| |
- **Part 3 — [Object-oriented programming in MQL5](https://www.mql5.com/en/book/oop) (p3)**
| |
OOP examples for managing complexity: classes/objects, templates, and code structuring techniques.
| |
| |
- **Part 4 — [Common MQL5 APIs](https://www.mql5.com/en/book/common) (p4)**
| |
Working with built-in terminal functions (API) from the most basic and useful to more specialized subsystems.
| |
| |
- **Part 5 — [Creating applications in MQL5](https://www.mql5.com/en/book/applications) (p5)**
| |
Practical tasks: data analysis and processing, chart visualization, task automation, and interactive user interfaces.
| |
| |
- **Part 6 — [Automating trading](https://www.mql5.com/en/book/automation) (p6)**
| |
Everything needed for trading robots: trading environment (instruments/accounts), trading structures and functions, event handling, and strategy testing.
| |
| |
- **Part 7 — [Advanced MQL5 tools](https://www.mql5.com/en/book/advanced) (p7)**
| |
Advanced APIs and integrations: custom tools, economic calendar, network and database access, cryptography, and more.
| |
| |
| |
| |
## Repository Structure
| |
| |
The folders follow the standard MetaTrader 5 data directory layout (`…/MQL5/`):
| |
| |
```text
| |
MQL5Book/
| |
├─ Experts/ # Expert Advisors (EAs) — grouped by parts (p5, p6, p7)
| |
├─ Indicators/ # Indicators — by parts (p5, p6, p7)
| |
├─ Scripts/ # Scripts — by parts (p1 … p7) + Python examples
| |
│ ├─ p1/
| |
│ ├─ p2/
| |
│ ├─ p3/
| |
│ ├─ p4/
| |
│ ├─ p5/
| |
│ ├─ p6/
| |
│ ├─ p7/
| |
│ └─ Python/
| |
├─ Services/ # Services (p4, p5, p7)
| |
├─ Include/ # .mqh: helper classes/utilities used in examples
| |
├─ Libraries/ # example libraries (.mq5)
| |
├─ Files/ # data files for examples (read/write, resources, etc.)
| |
├─ Web/ # html/css/js used by certain examples
| |
├─ Presets/ # .set parameter presets (for indicators/EAs)
| |
└─ MQL5Book.mqproj # MetaEditor project file
| |
````
| |
| |
| |
| |
| |
| |
| |
## Notes
| |
| |
- All examples are intended for learning and experimentation.
| |
Always test thoroughly in the
| |
[Strategy Tester](https://www.metatrader5.com/en/automated-trading/strategy-tester)
| |
or on a demo account before using real funds.
| |
| |
- The `Scripts/Python` folder contains examples for integrating MetaTrader 5 with Python.
| |
Make sure to enable the appropriate [terminal settings](https://www.metatrader5.com/en/terminal/help/startworking/settings#ea):
| |
| |
| |
| |
## License and Usage
| |
| |
All materials are part of the book "MQL5 Programming for Traders" and the MQL5/MetaTrader 5 ecosystem.
| |
Please respect copyright and the MQL5.com/MetaQuotes terms when distributing or reusing code.
| |
| |
| |
| |
## Contributing
| |
| |
* Bugs/improvements: use [**Issues**](https://forge.mql5.io/rosh/MQL5Book/issues).
| |
* Pull Requests: welcome. Submit changes by part (p1…p7) for easier review and alignment with the book.
| |
|