ScalerByLeo is a library for preprocessing data for ML models using scalers such as maxmin, robust, standard scaler, and also OpenCL can be used for bulk data scaling.
| Images | ||
| Src | ||
| Test | ||
| LICENSE.md | ||
| README.md | ||
| requirements.txt | ||
| ScalerByLeo.mqproj | ||
Build trading systems with automatic data scaling, 5 scaler types, and GPU support via OpenCL — all from MQL5.
Features
5 scaler types
// Base
MaxMinScaler scaler;
RobustScaler scaler;
StandardizationScaler scaler;
// With OpenCL (T = [uint or ulong])
MaxMinScalerCL<T> scaler;
StandardizationScalerCL<T> scaler;
Matrix scaling
void OnStart()
{
matrix mtx;
mtx.Resize(16000, 16000);
mtx.Random(0, 20.0);
MaxMinScaler scaler;
scaler.fit_transform(mtx, false);
}
Direct CSV scaling
#define FILE_NAME "TestScalerFiles\\file.csv"
void OnStart()
{
MaxMinScaler scaler;
Print(scaler.fit_transform_file(FILE_NAME, ',', FILE_COMMON, true));
}
GPU version via OpenCL (~4x faster)
// GPU
MaxMinScalerCL<uint> scalerGPU;
scalerGPU.fit_transform(matrix, false);
// Time: ~7,013,641 microseconds
// CPU (same dataset)
MaxMinScaler scalerCPU;
scalerCPU.fit_transform(matrix, false);
// Time: ~28,766,984 microseconds
Benchmark run on a 16,000 × 16,000 matrix using GPU
AMD Radeon GPU Iceland.
Quick Start
1. Install repository
See Instalation section.
2. Include the scaler in your script
// Relative rute (Only if the repo is located in Shared Projects and your project is also in Shared Projects)
#include "..\\ScalerByLeo\\Src\\ScalerBase.mqh"
void OnStart()
{
matrix data;
data.Resize(100, 10);
data.Random(0, 100.0);
MaxMinScaler scaler;
scaler.fit_transform(data, false); // true = by rows, false = by columns
Print("Scaling complete. Sample value: ", data[0][0]);
}
3. Verify the installation
Run any script from the Test/ folder in the MetaTrader 5 Editor. If no errors appear in the log, you're all set.
GPU version MaxMinScalerCL<T> - StandardizationScalerCL<T>
Same interface as MaxMinScaler - StandardizationScaler, with OpenCL acceleration.
Requires an OpenCL-compatible GPU with double. The available device is selected automatically.
Repository Structure
ScalerByLeo/
├── Src/ # Scaler source code and OpenCL kernels
├── Test/ # Test scripts and benchmarks
└── Images/ # Repository banner
Requirements
See the requirements.txt file.
Installation
- Clone the git repository into shared projects via cmd.
- Contact me privately on MQL5 chats (user: nique_372) to be added as a collaborator with your MQL5 nickname (read-only access), which will make the repository automatically appear in your Shared Projects folder.
- Fork the repository.
Disclaimer
Trading involves substantial risk of loss.
- This software is a technical tool, not financial advice
- Past performance does not guarantee future results
- You are solely responsible for your trading decisions
- Always test thoroughly before deploying with real capital
- Apply appropriate risk management at all times
The authors assume no liability for trading losses, system failures, or any damages arising from the use of this software.
License
Contact
- Platform: MQL5 Community
- Profile: https://www.mql5.com/es/users/nique_372/news
Copyright © 2026 Nique-Leo.