docs: Add technical and how-to-run documentation

This commit is contained in:
Ash
2025-10-23 23:14:15 +01:00
parent 1e16b161c4
commit 5600035f3c
2 changed files with 78 additions and 0 deletions
+44
View File
@@ -0,0 +1,44 @@
# How to Run
## Prerequisites
* MetaTrader 5 terminal installed.
* Python 3.x installed.
* The following Python libraries installed: `pandas`, `scikit-learn`, `skl2onnx`, `onnxruntime`.
## Installation
1. Clone the repository to your local machine.
2. Install the required Python libraries using pip:
```bash
pip install pandas scikit-learn skl2onnx onnxruntime
```
## Running the project
1. **Export Price Data**:
* Open the MetaEditor in your MetaTrader 5 terminal.
* Open the `Export_EURUSD_History.mq5` file.
* Compile the script.
* Run the script on a EUR/USD chart. This will create a `raw_price_data.csv` file in the `MQL5/Files` directory of your MetaTrader 5 installation.
* Copy the `raw_price_data.csv` file to the root of the project directory.
2. **Train the Models**:
* Run the `create_benchmark_model.py` script to create the benchmark model.
```bash
python create_benchmark_model.py
```
* Run the `Model_Development.py` script to train the neural network model.
```bash
python Model_Development.py
```
3. **Run the Expert Advisors**:
* Copy the `Benchmark_Model_EA.mq5` and `Neural_Network_Trader_EA.mq5` files to the `MQL5/Experts` directory of your MetaTrader 5 installation.
* Copy the `benchmark_logistic_model.onnx` and `trading_neural_network_model.onnx` files to the `MQL5/Files` directory of your MetaTrader 5 installation.
* Open the MetaEditor and compile the EAs.
* Attach the EAs to a EUR/USD chart in your MetaTrader 5 terminal.
+34
View File
@@ -0,0 +1,34 @@
# Technical Documentation
## Project Overview
This project is a trading bot for MetaTrader 5 that uses a machine learning model to make trading decisions. The project consists of MQL5 scripts for interacting with the MetaTrader 5 terminal and Python scripts for developing and training the machine learning model.
## Technology Stack
* **MQL5**: Used to create the Expert Advisors (EAs) that run in the MetaTrader 5 terminal.
* **Python**: Used for data analysis, machine learning model development, and training.
* **Pandas**: Used for data manipulation and analysis.
* **scikit-learn**: Used for creating and training the machine learning models.
* **ONNX**: Used to export the trained models to a format that can be used by the MQL5 EAs.
* **skl2onnx**: Used to convert scikit-learn models to ONNX format.
## File Descriptions
* `Export_EURUSD_History.mq5`: An MQL5 script that exports historical price data for the EUR/USD pair to a CSV file.
* `Model_Development.py`: A Python script that loads the exported price data, performs feature engineering, and trains a neural network model. The trained model is then exported to an ONNX file.
* `create_benchmark_model.py`: A Python script that creates and trains a simple logistic regression model to be used as a benchmark. The model is exported to an ONNX file.
* `Benchmark_Model_EA.mq5`: An MQL5 Expert Advisor that uses the benchmark logistic regression model to make trading decisions.
* `Neural_Network_Trader_EA.mq5`: An MQL5 Expert Advisor that uses the trained neural network model to make trading decisions.
* `raw_price_data.csv`: A CSV file containing historical price data for the EUR/USD pair.
* `benchmark_logistic_model.onnx`: The exported benchmark logistic regression model in ONNX format.
* `trading_neural_network_model.onnx`: The exported trained neural network model in ONNX format.
* `MT5-PY-AI-Tbot`: A file containing the concatenated code of all the project files.
* `separate_codes/`: A directory containing the individual project files.
## Model
The project uses two machine learning models:
1. **Benchmark Model**: A simple logistic regression model that predicts the direction of the next day's price change based on the previous day's price change.
2. **Neural Network Model**: A multi-layer perceptron (MLP) classifier that predicts the direction of the next day's price change based on the previous day's price change. The model is trained using hyperparameter tuning with `RandomizedSearchCV` and `TimeSeriesSplit` to find the best parameters.