Part 33 of the MQL5 series delves into integrating the Google Generative AI API with MetaTrader 5. This tutorial covers sending text-based queries, receiving intelligent responses, and managing API limits like queries per minute, requests per day, and tokens per minute.
Understanding rate limits in API usage is crucial. Requests per Minute (RPM) limit the number of API calls in a minute. Requests per Day (RPD) constrain daily interactions, while Tokens per Minute (TPM) track the computational cost per request. Strategies to optimize usage and maintain smooth performance include request bundling and response caching.
Generating an API key is essential before using the API. The key identifies your application and controls access, ensuring secure interaction with Google's servers.
Enable WebRequest in MetaTrader 5 by adding the API URL to the settings, allowing y...
π Read | CodeBase | @mql5dev
#MQL5 #MT5 #AI
Understanding rate limits in API usage is crucial. Requests per Minute (RPM) limit the number of API calls in a minute. Requests per Day (RPD) constrain daily interactions, while Tokens per Minute (TPM) track the computational cost per request. Strategies to optimize usage and maintain smooth performance include request bundling and response caching.
Generating an API key is essential before using the API. The key identifies your application and controls access, ensuring secure interaction with Google's servers.
Enable WebRequest in MetaTrader 5 by adding the API URL to the settings, allowing y...
π Read | CodeBase | @mql5dev
#MQL5 #MT5 #AI
β€59β10π€―2π1
Part 34 extends the WebRequest-to-Generative-AI work by adding an on-chart control panel, so prompts can be typed, sent, and responses viewed without leaving MetaTrader 5.
The article uses the Dialog control framework: include the Dialog library, create a global CAppDialog container, then build the panel with a chart ID, unique name, window index, pixel offsets, and size. Calling Run() is required for the panel to process user interactions.
It also covers lifecycle safety. On recompiles or timeframe changes, the EA reloads and the panel must be explicitly cleaned up via Destroy() in OnDeinit to prevent instability.
User input is captured with an editable text control: include the edit control header, create the input field, set dimensions, and attach it to the dialog so backend API code can consume the typed prompt.
π Read | Docs | @mql5dev
#MQL5 #MT5 #AI
The article uses the Dialog control framework: include the Dialog library, create a global CAppDialog container, then build the panel with a chart ID, unique name, window index, pixel offsets, and size. Calling Run() is required for the panel to process user interactions.
It also covers lifecycle safety. On recompiles or timeframe changes, the EA reloads and the panel must be explicitly cleaned up via Destroy() in OnDeinit to prevent instability.
User input is captured with an editable text control: include the edit control header, create the input field, set dimensions, and attach it to the dialog so backend API code can consume the typed prompt.
π Read | Docs | @mql5dev
#MQL5 #MT5 #AI
β€40π8π₯3β2π2
Transformers replace step-by-step recurrence with self-attention, enabling parallel training and better handling of long-range dependencies than classic RNN/LSTM pipelines. For market forecasting, the focus is the Temporal Fusion Transformer: a hybrid that combines LSTM sequence modeling with attention for multi-horizon, interpretable predictions.
The workflow pulls OHLCV data from MetaTrader 5, engineers time, trend, momentum, and volatility features, then builds a PyTorch Forecasting TimeSeriesDataSet with a strict time_idx and returns as the target. Training uses PyTorch Lightning with learning-rate search and validation against a naive βlast valueβ baseline.
Deployment wraps feature generation, training, and inference into a bot that retrains on schedule and trades from fresh predictions. Key trade-offs: GPU-friendly but compute-heavy, data-hungry, and ...
π Read | Forum | @mql5dev
#MQL5 #MT5 #AI
The workflow pulls OHLCV data from MetaTrader 5, engineers time, trend, momentum, and volatility features, then builds a PyTorch Forecasting TimeSeriesDataSet with a strict time_idx and returns as the target. Training uses PyTorch Lightning with learning-rate search and validation against a naive βlast valueβ baseline.
Deployment wraps feature generation, training, and inference into a bot that retrains on schedule and trades from fresh predictions. Key trade-offs: GPU-friendly but compute-heavy, data-hungry, and ...
π Read | Forum | @mql5dev
#MQL5 #MT5 #AI
β€40π2π2
Backtests were run on H1 for XAUUSD (01/03/2025β20/01/2026) and EURUSD (01/03/2025β21/01/2026) using a hybrid system: an ONNX market-structure classifier combined with deterministic execution and risk rules.
On each new bar, six ATR-normalized and context features are fed into the model: momentum change, distance to 50-bar swing high/low, relative tick volume vs 20-bar average, candle body strength, and hour-of-day. The model returns a structure label plus probability, with signals accepted only above a 0.65 confidence threshold.
Trade direction is filtered by a 50-period SMA: longs only above, shorts only below. Entries are placed as pending limits at a Fibonacci retracement level (default 61.8%) between detected pivots, with SL beyond structure invalidation, TP at 1:2 RR, and order expiry. Exposure is capped to one position or one pending order. Trailing ...
π Read | VPS | @mql5dev
#MQL5 #MT5 #AI
On each new bar, six ATR-normalized and context features are fed into the model: momentum change, distance to 50-bar swing high/low, relative tick volume vs 20-bar average, candle body strength, and hour-of-day. The model returns a structure label plus probability, with signals accepted only above a 0.65 confidence threshold.
Trade direction is filtered by a 50-period SMA: longs only above, shorts only below. Entries are placed as pending limits at a Fibonacci retracement level (default 61.8%) between detected pivots, with SL beyond structure invalidation, TP at 1:2 RR, and order expiry. Exposure is capped to one position or one pending order. Trailing ...
π Read | VPS | @mql5dev
#MQL5 #MT5 #AI
β€51β14β‘2
A computer-vision pipeline is built around MetaTrader 5 data to predict EURUSD direction without hand-crafted indicators. The system pulls ~2,000 H1 bars, converts rolling 48-candle OHLC windows into normalized multi-channel βimages,β and labels each sample by the move 24 bars ahead.
A Keras Functional CNN (two Conv blocks with batch normalization, then dense layers) is trained with early stopping to reduce overfitting. Functional design also enables introspection.
Interpretability is treated as a core feature: intermediate feature maps are visualized alongside candlesticks, and an attention-style heatmap highlights the chart regions driving the decision, often aligning with reversals and key levels.
Outputs are presented as both direction and probability, supporting confidence-based position sizing and server-side execution via headless plotting.
π Read | Quotes | @mql5dev
#MQL5 #MT5 #AI
A Keras Functional CNN (two Conv blocks with batch normalization, then dense layers) is trained with early stopping to reduce overfitting. Functional design also enables introspection.
Interpretability is treated as a core feature: intermediate feature maps are visualized alongside candlesticks, and an attention-style heatmap highlights the chart regions driving the decision, often aligning with reversals and key levels.
Outputs are presented as both direction and probability, supporting confidence-based position sizing and server-side execution via headless plotting.
π Read | Quotes | @mql5dev
#MQL5 #MT5 #AI
β€41π3π1
Cluster-based classification can be applied to indicator slope to separate flat markets from trending phases using numeric thresholds rather than visual judgment.
An MQL-style HalfTrend example evaluates only x[iB] - x[iB+1], normalized to _Point for cross-symbol comparability. With a two-buffer line (up/down), the active buffer value becomes the source series, and fabs(delta) avoids duplicating clusters by sign.
Instead of k-means with prohibitive cost at scale, the approach uses incremental weighted mean and variance (Finch) in a single pass, enabling fast categorization over full history. Clustering is isolated in ClusterTrend.mqh, controlled by NumValues, and benchmarked in milliseconds on multi-thousand bar datasets.
π Read | Quotes | @mql5dev
#MQL5 #MT5 #AI
An MQL-style HalfTrend example evaluates only x[iB] - x[iB+1], normalized to _Point for cross-symbol comparability. With a two-buffer line (up/down), the active buffer value becomes the source series, and fabs(delta) avoids duplicating clusters by sign.
Instead of k-means with prohibitive cost at scale, the approach uses incremental weighted mean and variance (Finch) in a single pass, enabling fast categorization over full history. Clustering is isolated in ClusterTrend.mqh, controlled by NumValues, and benchmarked in milliseconds on multi-thousand bar datasets.
π Read | Quotes | @mql5dev
#MQL5 #MT5 #AI
β€59π₯4π4π2
ATR Strength Index implements an RSI-style oscillator where the input series is ATR delta rather than price change. Each bar computes diff between consecutive iATR values, splits it into positive and negative components, and applies Wilder smoothing over RSI_period via PosBuffer and NegBuffer.
An Invert switch flips the diff sign so the oscillator aligns with standard RSI direction conventions. Output is clamped to 0..100 with neutral handling when both smoothed legs are zero.
The indicator draws in a separate window, limits processing via NumberOfBars, and adds adjustable upper/lower horizontal levels with custom colors using OBJ_HLINE.
π Read | NeuroBook | @mql5dev
#MQL4 #MT4 #AI
An Invert switch flips the diff sign so the oscillator aligns with standard RSI direction conventions. Output is clamped to 0..100 with neutral handling when both smoothed legs are zero.
The indicator draws in a separate window, limits processing via NumberOfBars, and adds adjustable upper/lower horizontal levels with custom colors using OBJ_HLINE.
π Read | NeuroBook | @mql5dev
#MQL4 #MT4 #AI
β€47π₯4π2π2
High-Performance JSON v3.5.0 targets low-latency JSON workloads in MT5 environments running LLM function-calling flows. Community JSON libraries showed two recurring constraints: frequent allocations and high serialisation latency, with recursion and temporary strings causing terminal stalls under load.
The library is rebuilt around a zero-allocation approach: parsing uses a tape backed by a contiguous long[] buffer, with direct serialisation into uchar[] to reduce intermediates. It adds hybrid numeric parsing using long accumulation and static Exp10 lookup tables, an iterative state machine to avoid recursion and stack overflow, plus SWAR scanning to process 8 bytes per cycle when skipping whitespace and long strings.
On x64 hardware with a 50,000-node payload, benchmark results report 137 ms parse vs 1540 ms, 264 ms serialisation vs 568 ms, and 401 ms ...
π Read | Docs | @mql5dev
#MQL5 #MT5 #AI
The library is rebuilt around a zero-allocation approach: parsing uses a tape backed by a contiguous long[] buffer, with direct serialisation into uchar[] to reduce intermediates. It adds hybrid numeric parsing using long accumulation and static Exp10 lookup tables, an iterative state machine to avoid recursion and stack overflow, plus SWAR scanning to process 8 bytes per cycle when skipping whitespace and long strings.
On x64 hardware with a 50,000-node payload, benchmark results report 137 ms parse vs 1540 ms, 264 ms serialisation vs 568 ms, and 401 ms ...
π Read | Docs | @mql5dev
#MQL5 #MT5 #AI
β€21β‘3π2π2π1
DADA targets time-series anomalies in markets without retraining per instrument by avoiding fixed autoencoder compression and learning robust structure via masked reconstruction.
Its core is an adaptive bottleneck: a router selects among multiple latent sizes so clean signals keep detail while noisy regimes are compressed harder. Two decoders split responsibilities: one reconstructs normal behavior; the other is trained adversarially on synthetic anomalies injected into data, improving separation and reducing false alerts. In production, only the normal decoder runs; large reconstruction error flags anomalies.
An MQL5 implementation focuses on an efficient adaptive module using a multi-window convolution layer, pushed into OpenCL kernels for forward pass, backprop, and Adam updates with shared weights across multivariate series.
π Read | CodeBase | @mql5dev
#MQL5 #MT5 #AI
Its core is an adaptive bottleneck: a router selects among multiple latent sizes so clean signals keep detail while noisy regimes are compressed harder. Two decoders split responsibilities: one reconstructs normal behavior; the other is trained adversarially on synthetic anomalies injected into data, improving separation and reducing false alerts. In production, only the normal decoder runs; large reconstruction error flags anomalies.
An MQL5 implementation focuses on an efficient adaptive module using a multi-window convolution layer, pushed into OpenCL kernels for forward pass, backprop, and Adam updates with shared weights across multivariate series.
π Read | CodeBase | @mql5dev
#MQL5 #MT5 #AI
β€35β1β‘1π1π€1
Batch Normalization is added to an MT5 OpenCL neural-network library to reduce internal covariate shift, stabilizing layer-to-layer data distributions and enabling higher learning rates without slowing training.
The article implements a CNeuronBatchNormOCL layer that keeps per-neuron statistics plus trainable scale/shift (gamma, beta). To cut memory and compute overhead, moving mean/variance are approximated with exponential averages, avoiding full-batch storage.
Feed-forward runs an OpenCL kernel per neuron: compute EMA mean/variance, normalize, apply gamma/beta, then optionally apply activation (with guidance on placing normalization before or after activations). Backprop updates gamma/beta and propagates gradients through normalization and activation, with special handling to bypass work when batch size is 1.
π Read | Docs | @mql5dev
#MQL5 #MT5 #AI
The article implements a CNeuronBatchNormOCL layer that keeps per-neuron statistics plus trainable scale/shift (gamma, beta). To cut memory and compute overhead, moving mean/variance are approximated with exponential averages, avoiding full-batch storage.
Feed-forward runs an OpenCL kernel per neuron: compute EMA mean/variance, normalize, apply gamma/beta, then optionally apply activation (with guidance on placing normalization before or after activations). Backprop updates gamma/beta and propagates gradients through normalization and activation, with special handling to bypass work when batch size is 1.
π Read | Docs | @mql5dev
#MQL5 #MT5 #AI
β€63π10π5π4π1
ASQ NeuralNet provides a neural network stack implemented entirely in native MQL5, with no external dependencies. It targets building, training, and running feedforward models directly in MetaTrader 5, including mini-batch training, shuffling, and epoch logging.
Core components include a dense matrix engine with 40+ operations and NaN checks, 13 activation functions with analytical derivatives, dense layers with backpropagation, dropout, and gradient clipping, plus optimizers (SGD with momentum, Adam, AdamW). Learning rate scheduling covers Constant, Step, Exponential, Cosine Annealing, Linear, ReduceOnPlateau, Warmup, and Cyclic.
Loss functions include MSE, MAE, Huber, Cross-Entropy, and Binary Cross-Entropy. Reported characteristics include sub-0.1 ms inference for small models, fixed inference allocation behavior, safe Softmax, and initialization via ...
π Read | NeuroBook | @mql5dev
#MQL5 #MT5 #AI
Core components include a dense matrix engine with 40+ operations and NaN checks, 13 activation functions with analytical derivatives, dense layers with backpropagation, dropout, and gradient clipping, plus optimizers (SGD with momentum, Adam, AdamW). Learning rate scheduling covers Constant, Step, Exponential, Cosine Annealing, Linear, ReduceOnPlateau, Warmup, and Cyclic.
Loss functions include MSE, MAE, Huber, Cross-Entropy, and Binary Cross-Entropy. Reported characteristics include sub-0.1 ms inference for small models, fixed inference allocation behavior, safe Softmax, and initialization via ...
π Read | NeuroBook | @mql5dev
#MQL5 #MT5 #AI
β€30π1
DADA (Adaptive Bottlenecks + Dual Adversarial Decoders) targets time-series anomaly detection with adaptive compression, dual reconstructions for normal vs anomalous regimes, and patching/masking to reduce noise and improve generalization.
The Adaptive Bottlenecks block is implemented as CNeuronAdaBN inheriting CNeuronMoE. It reuses top-k gating and expert routing, but populates experts with autoencoders at multiple latent sizes. A convolution stage produces a latent vector whose segments map to each autoencoder, followed by multi-window conv, tensor transpositions, and per-autoencoder decoder weights.
Instead of a monolith, the system is assembled from library components into three jointly trained models: a state encoder autoencoder with patching/masking and AdaBN, an Actor replacing the anomalous decoder for action selection, and a direction predictor as a deci...
π Read | Calendar | @mql5dev
#MQL5 #MT5 #AI
The Adaptive Bottlenecks block is implemented as CNeuronAdaBN inheriting CNeuronMoE. It reuses top-k gating and expert routing, but populates experts with autoencoders at multiple latent sizes. A convolution stage produces a latent vector whose segments map to each autoencoder, followed by multi-window conv, tensor transpositions, and per-autoencoder decoder weights.
Instead of a monolith, the system is assembled from library components into three jointly trained models: a state encoder autoencoder with patching/masking and AdaBN, an Actor replacing the anomalous decoder for action selection, and a direction predictor as a deci...
π Read | Calendar | @mql5dev
#MQL5 #MT5 #AI
β€39π2π2β‘1
AI agents expanded quickly in early 2026, with mature automation on the crypto side. MetaTrader 5 remains largely unsupported by agent toolchains, despite visible demand in OpenClaw feature requests and trader forums.
A practical approach is an MCP (Model Context Protocol) server that bridges AI clients to MT5 via stdio. MCP standardizes tool discovery and typed calls, avoiding per-client plugin formats while keeping execution local.
The proposed Python design uses the official MetaTrader5 library plus FastMCP, exposing 14 tools across account, market data, positions, orders, and history. A wrapper layer manages initialization, login checks, timeouts, constant mapping, and order request normalization for mt5.order_send().
π Read | VPS | @mql5dev
#MQL5 #MT5 #AI
A practical approach is an MCP (Model Context Protocol) server that bridges AI clients to MT5 via stdio. MCP standardizes tool discovery and typed calls, avoiding per-client plugin formats while keeping execution local.
The proposed Python design uses the official MetaTrader5 library plus FastMCP, exposing 14 tools across account, market data, positions, orders, and history. A wrapper layer manages initialization, login checks, timeouts, constant mapping, and order request normalization for mt5.order_send().
π Read | VPS | @mql5dev
#MQL5 #MT5 #AI
β€28π3π2
Distance-based trailing stops process every tick and remain memoryless, which increases sensitivity to micro-noise and CPU load on lower timeframes. High-frequency bar/tick loops can also limit the feasibility of heavier models due to latency and terminalβserver desync risk.
A proposed MQL5 trailing module, CTrailingBloomRNN (inherits CExpertTrailing), adds a dual-gate path: an O(1) Bloom filter for price deduplication using a packed uchar bitset, then a lightweight RNN with persistent hidden state for sequence-aware moderation. Unique prices update m_hidden_state via tanh(0.5*h + 0.5*normalized_input).
Trailing overrides (CheckTrailingStopLong/Short) early-return on duplicate ticks, then apply an optional RNN threshold before computing broker-compliant stop levels and NormalizeDouble rounding.
π Read | AppStore | @mql5dev
#MQL5 #MT5 #AI
A proposed MQL5 trailing module, CTrailingBloomRNN (inherits CExpertTrailing), adds a dual-gate path: an O(1) Bloom filter for price deduplication using a packed uchar bitset, then a lightweight RNN with persistent hidden state for sequence-aware moderation. Unique prices update m_hidden_state via tanh(0.5*h + 0.5*normalized_input).
Trailing overrides (CheckTrailingStopLong/Short) early-return on duplicate ticks, then apply an optional RNN threshold before computing broker-compliant stop levels and NormalizeDouble rounding.
π Read | AppStore | @mql5dev
#MQL5 #MT5 #AI
β€29β‘6π3β1π1
GPT is broken down into a decoder-only Transformer: stacked blocks with multi-head self-attention and a two-layer feed-forward module, trained via large-scale unsupervised pretraining and smaller supervised fine-tuning. The key constraint is compute and memory, which shapes implementation choices.
The article implements a flexible GPT-style block for MetaTrader 5 using OpenCL. It replaces hard-coded attention threads with parameterized heads and layers, stores Q/K/V in a single combined tensor, and parallelizes all heads inside kernels to scale without rewriting code.
The feed-forward path is organized as a top-level loop over blocks, calling helper kernels for QKV projection, score computation with causal restriction, attention output folding, residual connections, and normalization, then a 2-layer feed-forward stage. Practical focus: managing GPU objects and bu...
π Read | Calendar | @mql5dev
#MQL5 #MT5 #AI
The article implements a flexible GPT-style block for MetaTrader 5 using OpenCL. It replaces hard-coded attention threads with parameterized heads and layers, stores Q/K/V in a single combined tensor, and parallelizes all heads inside kernels to scale without rewriting code.
The feed-forward path is organized as a top-level loop over blocks, calling helper kernels for QKV projection, score computation with causal restriction, attention output folding, residual connections, and normalization, then a 2-layer feed-forward stage. Practical focus: managing GPU objects and bu...
π Read | Calendar | @mql5dev
#MQL5 #MT5 #AI
β€55π5π3β‘2π2
MAPIE (Model Agnostic Prediction Interval Estimator) is an open-source Python library for uncertainty quantification via conformal prediction, using a dedicated calibration set. It supports prediction intervals for regression and prediction sets for classification and time series, with scikit-learn API compatibility and wrappers for TensorFlow and PyTorch models.
The core property is finite-sample, distribution-free coverage under exchangeability. This is relevant for financial data where heavy tails and non-stationarity make classical interval assumptions unreliable. Output shifts from point labels to set-valued decisions, enabling explicit βact / reduce / abstainβ rules based on set size.
MAPIE exposes multiple conformity scores and modes, including LAC, APS, RAPS, and Mondrian variants for class-conditional coverage, addressing imbalance in buy/sell styl...
π Read | VPS | @mql5dev
#MQL5 #MT5 #AI
The core property is finite-sample, distribution-free coverage under exchangeability. This is relevant for financial data where heavy tails and non-stationarity make classical interval assumptions unreliable. Output shifts from point labels to set-valued decisions, enabling explicit βact / reduce / abstainβ rules based on set size.
MAPIE exposes multiple conformity scores and modes, including LAC, APS, RAPS, and Mondrian variants for class-conditional coverage, addressing imbalance in buy/sell styl...
π Read | VPS | @mql5dev
#MQL5 #MT5 #AI
β€34π3π2
Gaussian Process Regression (GPR) models a distribution over functions, not just a best-fit curve. That produces forecasts with calibrated uncertainty via posterior mean and covariance, letting trading systems reason about confidence intervals instead of relying on point signals.
Kernel choice defines behavior (smooth RBF, linear trend, periodic cycles) and kernels can be combined to capture mixed market structure. With Gaussian observation noise, the model smooths rather than interpolates, and distinguishes uncertainty of the latent function f* from uncertainty of future observations y*.
Accuracy depends on tuning kernel hyperparameters and noise variance by minimizing negative log marginal likelihood. The implementation avoids costly matrix inversion using Cholesky decomposition, and optimizes parameters with ALGLIB, making GPR practical to run from MQL5.
π Read | Forum | @mql5dev
#MQL5 #MT5 #AI
Kernel choice defines behavior (smooth RBF, linear trend, periodic cycles) and kernels can be combined to capture mixed market structure. With Gaussian observation noise, the model smooths rather than interpolates, and distinguishes uncertainty of the latent function f* from uncertainty of future observations y*.
Accuracy depends on tuning kernel hyperparameters and noise variance by minimizing negative log marginal likelihood. The implementation avoids costly matrix inversion using Cholesky decomposition, and optimizes parameters with ALGLIB, making GPR practical to run from MQL5.
π Read | Forum | @mql5dev
#MQL5 #MT5 #AI
β€51π5β‘1
ML in MetaTrader 5 becomes practical when the entire preprocessing pipeline is rebuilt inside MQL5, not split across Python and the terminal. Feature generation, scaling, redundancy removal, and model input formatting are linear-algebra steps that must match training exactly, or inference runs in a different data space and signals get distorted.
The article organizes features into an X matrix and uses MQL5 vectors/matrices for consistent normalization and PCA projection. Keeping these transforms in MQL5 makes them testable in the Strategy Tester and adjustable when symbol/timeframe distributions shift, without retraining the network.
Python is used only to train (LSTM with dropout, batched DataLoader, MSE/Adam), compute normalization/PCA parameters, then export to ONNX. In MQL5, initialization loads stats and PCA matrices once; the per-bar loop rebuilds the sam...
π Read | AppStore | @mql5dev
#MQL5 #MT5 #AI
The article organizes features into an X matrix and uses MQL5 vectors/matrices for consistent normalization and PCA projection. Keeping these transforms in MQL5 makes them testable in the Strategy Tester and adjustable when symbol/timeframe distributions shift, without retraining the network.
Python is used only to train (LSTM with dropout, batched DataLoader, MSE/Adam), compute normalization/PCA parameters, then export to ONNX. In MQL5, initialization loads stats and PCA matrices once; the per-bar loop rebuilds the sam...
π Read | AppStore | @mql5dev
#MQL5 #MT5 #AI
β€59π11π10π5π2
System summary: MQL5 EA streams a 50-tick bid window plus RSI to a local Flask endpoint. The server computes Shannon entropy and related volatility/trend features, runs a PyTorch classifier, then returns probability, regime, confidence, and risk multipliers.
Entropy drives LOW/NORMAL/HIGH/EXTREME regime detection using rolling thresholds, plus momentum and percentiles. Regime and entropy deltas adjust entry thresholds, stop-loss, take-profit, and position size.
Training uses MT5 historical data, windowed feature extraction, future-move labeling, StandardScaler normalization, and a PyTorch MLP with batch norm and dropout. Dropout remains active for uncertainty estimation via multiple forward passes.
Execution is tick-based with throttling, cooldowns, max-position checks, and optional reversal logic. Orders are placed through CTrade after broker volume and stop-le...
π Read | Calendar | @mql5dev
#MQL5 #MT5 #AI
Entropy drives LOW/NORMAL/HIGH/EXTREME regime detection using rolling thresholds, plus momentum and percentiles. Regime and entropy deltas adjust entry thresholds, stop-loss, take-profit, and position size.
Training uses MT5 historical data, windowed feature extraction, future-move labeling, StandardScaler normalization, and a PyTorch MLP with batch norm and dropout. Dropout remains active for uncertainty estimation via multiple forward passes.
Execution is tick-based with throttling, cooldowns, max-position checks, and optional reversal logic. Orders are placed through CTrade after broker volume and stop-le...
π Read | Calendar | @mql5dev
#MQL5 #MT5 #AI
β€32π4
Financial ML pipelines leak information because labels overlap in time and regimes change, so classic train/validate/test splits overstate performance. This design blocks leakage with a strict 60/20/20 temporal partition: an outer-training zone for all iteration, an inner-validation checkpoint for accept/reject, and a final test opened exactly once via a programmatic gate.
Hyperparameters are chosen inside nested CV using PurgedWalkForwardCV (purging + embargo) and Mastersβ 1-SE rule, selecting the simplest configuration statistically tied with the best. The outer loop then estimates performance on folds the search never sees, supporting both walk-forward and CPCV, with careful index handling.
Probability calibration is done correctly using out-of-fold predictions generated after selection, fitting isotonic calibration only on predictions from models that never t...
π Read | AlgoBook | @mql5dev
#MQL5 #MT5 #AI
Hyperparameters are chosen inside nested CV using PurgedWalkForwardCV (purging + embargo) and Mastersβ 1-SE rule, selecting the simplest configuration statistically tied with the best. The outer loop then estimates performance on folds the search never sees, supporting both walk-forward and CPCV, with careful index handling.
Probability calibration is done correctly using out-of-fold predictions generated after selection, fitting isotonic calibration only on predictions from models that never t...
π Read | AlgoBook | @mql5dev
#MQL5 #MT5 #AI
β€38π11π2π1