Next Article in Journal
A Distributed Virtual Machine for Mesh-Grid Sensor Networks Supporting In-Sensor Data Processing and Distributed Machine Learning with Strictly Resource-Constrained Microcontrollers
Previous Article in Journal
LSF-Mamba: A Lightweight Skin Lesion Segmentation Network with Local Structural Compensation and Frequency-Domain Residual Supplementation
 
 
Font Type:
Arial Georgia Verdana
Font Size:
Aa Aa Aa
Line Spacing:
Column Width:
Background:
Article

ML-Augmented High-Frequency Grid Trading: Strategy-Embedded Labeling, Soft Martingale Execution, and Drawdown Dichotomy Quantification

by
Seksin Cheevirot
*,
Sucha Smanchat
and
Siranee Nuchitprasitchai
Faculty of Information Technology and Digital Innovation, King Mongkut’s University of Technology North Bangkok (KMUTNB), Bangkok 10800, Thailand
*
Author to whom correspondence should be addressed.
Algorithms 2026, 19(6), 442; https://doi.org/10.3390/a19060442
Submission received: 12 March 2026 / Revised: 5 May 2026 / Accepted: 15 May 2026 / Published: 1 June 2026

Abstract

Grid trading is a rule-based Forex execution scheme that places a ladder of buy and sell limit orders at fixed price increments, profiting from price oscillation without a directional forecast. To accelerate recovery, the scheme is commonly paired with Martingale lot scaling, a gambling strategy—distinct from the stochastic-process notion of the same name—that increases the lot size at each adverse price level. This combination achieves a high short-term hit rate but retains a non-zero probability of catastrophic drawdown, a pattern equivalent to the Gambler’s Ruin problem. Attempts to augment grid trading with supervised machine learning face a label-misalignment problem: the usual label “did the price rise or fall at horizon h ?” does not capture the path-dependent payoff of a grid that may still profit after an initially adverse move. This paper presents the ML-Augmented High-Frequency Grid Trading System (AHFGTS) and reports three contributions. (i) Strategy-Embedded Labeling (SEL) derives each binary training label from a full forward simulation of the deployed grid over a 15 bar H1 (one-hour) horizon, so the training objective matches the execution objective. (ii) Soft Martingale execution replaces classical 2× doubling with ten sub-linearly scaled lot multipliers generated by linspace(1, 5, 10), cutting four-level cumulative exposure by 63% relative to 2× doubling. (iii) The Drawdown Dichotomy Ratio (DDR = Maximum Equity Drawdown/Maximum Balance Drawdown) is introduced as a scalar risk metric that, to our knowledge, is the first such metric for the gap between floating and realized risk in Martingale-family systems. A twelve-month out-of-sample evaluation on EUR/USD H1 (38 million ticks, 99% modeling quality, 1:500 leverage) produced 444 trades, a 65.77% win rate (z = 6.65, p < 0.0001; Cohen’s h = 0.321), Profit Factor 2.85 (a 90–138% improvement over unfiltered grid baselines), and 442.6% net annual return; DDR was 5.72× (maximum equity drawdown, MED, of 79.97% vs. maximum balance drawdown, MBD, of 13.98%), quantifying the structural Martingale risk that persists after ML augmentation. The study evaluates a single currency pair under 1:500 offshore leverage and should be read as a methodological demonstration of SEL, Soft Martingale, and DDR rather than a universal performance claim.

1. Introduction

Financial markets have undergone profound structural transformation over the past two decades, driven by advances in computational infrastructure, the proliferation of electronic trading platforms, and rapid progress in quantitative modeling techniques. Algorithmic trading systems now account for the majority of executed volume across major asset classes—equities, derivatives, and foreign exchange. The Forex market is the world’s largest and most liquid financial marketplace, with average daily notional trading volumes exceeding six trillion U.S. dollars as reported by the Bank for International Settlements [1]. It operates as a decentralized over-the-counter network spanning global financial centers across London, New York, Tokyo, and Singapore, generating a continuous 24 h trading cycle characterized by volatility clustering, short-term oscillatory price dynamics, and regime shifts between trending and mean-reverting behavior.
Within this environment, grid trading has emerged as a widely adopted automated execution strategy among retail and semi-institutional participants. The strategy places a series of buy and sell limit orders at predetermined intervals above and below a reference price, profiting from oscillatory movements without requiring precise directional forecasting. Its appeal lies in consistent short-term income generation and relative ease of automation through platforms such as MetaTrader 5. However, the strategy harbors a fundamental structural vulnerability: under sustained directional trends, cumulative floating losses escalate without bound. When combined with Martingale-style position scaling—where lot sizes increase at each adverse level to accelerate recovery—this mechanism produces margin calls and total capital loss. Throughout this paper, the term “Martingale” refers to the gambling strategy, not the stochastic-process notion of the same name, and is capitalized accordingly. This outcome is formally equivalent to the Gambler’s Ruin problem in probability theory [2,3], creating the core tension that motivates this paper: the trade-off between a high frequency of small gains and a low but nonzero probability of catastrophic drawdown.
Machine learning offers a potential mechanism for mitigating this trade-off. A classifier capable of identifying conditions favorably aligned with grid deployment could systematically reduce adverse entries—entries taken in market states where subsequent price action moves persistently against the grid direction—improving the system’s edge while preserving its profitability mechanism. This paper is explicit that machine learning does not eliminate the catastrophic-drawdown mechanism; the Drawdown Dichotomy Ratio introduced below quantifies precisely the residual structural risk that ML augmentation leaves intact. This hypothesis, while intuitive, raises a nontrivial methodological challenge: conventional supervised learning labels training data on future price direction, which is fundamentally misaligned with grid payoffs. Under Martingale recovery, a directionally incorrect entry may generate net profit if subsequent oscillation activates deeper grid levels and triggers take-profits before capital exhaustion. A classifier trained on directional labels therefore optimizes a criterion structurally decoupled from the actual trading objective [4].
This research identifies label misalignment as the central theoretical gap and addresses it through Strategy-Embedded Labeling (SEL), a training framework deriving binary labels from simulated grid-strategy outcomes—that is, the net profit obtained by simulating the proposed grid rules forward over the 15 bar horizon on the realized price path—rather than abstract price direction. Integrated with a CatBoost gradient boosting classifier and a Soft Martingale execution engine, SEL forms the core of the ML-Augmented High-Frequency Grid Trading System (AHFGTS) evaluated in this paper. A third contribution, the Drawdown Dichotomy Ratio (DDR), is introduced as, to our knowledge, the first scalar metric formally quantifying the structural gap between floating and realized risk inherent to Martingale-family systems.

1.1. Research Objectives and Questions

The primary aim is to design, implement, and empirically evaluate the AHFGTS as an artifact (in the Design Science Research sense of a purposefully designed construct, model, method, or instantiation [5]) addressing the ML-grid labeling misalignment. Four research questions (RQs) structure the investigation:
  • RQ1: To what extent can a gradient boosting classifier trained on moving-average deviation features generate statistically reliable directional signals in a high-frequency Forex environment?
  • RQ2: Does the SEL framework produce statistically significant improvements in risk-adjusted trading performance relative to conventional directional labeling and random entry baselines?
  • RQ3: How should an ML signal be integrated into a grid/martingale execution engine to control excessive capital exposure during adverse price excursions?
  • RQ4: What is the trade-off between profitability and financial sustainability in the AHFGTS, and how effectively does Soft Martingale scaling limit maximum equity drawdown relative to classical doubling?

1.2. Original Contributions

This paper makes three principal contributions, each positioned below against prior art and each corresponding to one element of the subtitle. First, the SEL framework introduces a generalizable methodology for aligning supervised learning objectives with execution-dependent trading strategies. SEL differs from horizon-based labeling [4] by replacing the primary directional label with a path-dependent grid-payoff simulation, and differs from meta-labeling [4] in that meta-labeling filters an already-given directional primary label rather than replacing it. Second, the Soft Martingale execution architecture provides a formally characterized sub-linear scaling mechanism reducing peak exposure by 63% relative to classical doubling. Third, the Drawdown Dichotomy Ratio ( D D R = M E D / M B D = 5.72 × ) is introduced as the first reproducible scalar metric for the structural gap between floating and realized risk in martingale-family systems, providing a cross-system comparable risk disclosure standard. Table 1 positions these three contributions against representative prior works across five feature dimensions.
Table 1. Positioning of AHFGTS against representative prior works on five feature dimensions.
Table 1. Positioning of AHFGTS against representative prior works on five feature dimensions.
DimensionAHFGTS (This Study)GTSbot [6]Yeh et al. [7]Horizon/Meta-Label [4]Classical 2× Martingale
Training labelStrategy-embedded (grid-payoff sim.)Horizon directionHorizon returnHorizon direction/meta-filterN/A (unsupervised)
Lot scalingSoft Martingale (sub-linear)Constant lotConstant/adaptiveN/AGeometric 2×
Risk metric reportedMBD, MED, and DDRMBD onlyMBD onlyMBD onlyMBD only
Formal characterizationAlgorithm 1 and Algorithm 2; Definition 1FlowchartAlgorithmic sketchEquation for labelRule
Empirical verifiabilityMT5 report + P&L log releasedIn-paper onlyIn-paper onlyN/AN/A
“N/A” = not applicable to the corresponding method.
Algorithm 1. Strategy-Embedded Labeling (SEL). Time complexity O ( T H K ) , space O ( T ) , where T is the number of bars, H = 15 the forward horizon, and K = 10 the number of grid levels. On the in-sample split (T ≈ 40,000 H1 bars) this amounts to approximately 6 × 106 grid-simulation micro-steps per epoch
Input: price series { P t } for t = 1 , , T + H ; lot coefficients c 1 , , c K ;
    grid spacings d 1 , , d K (linspace(0.003, 0.008, K = 10) in quote units); markup μ = 0.00010 ; horizon H = 15 .
Output: labels { y t } { 0 , 1 } and validity mask { v t } { 0 , 1 } for t = 1 , , T .
1: for t = 1 to T do
2:   P e x i t P t + H      ▷ horizon close
3:   u p _ r a n g e P t − min { P t , …, P t + H } ▷ drawdown depth
4:   d n _ r a n g e ← max { P t , …, P t + H } − P t ▷ drawup depth
5:   L P ← ( P e x i t P t ) − μ        ▷ BUY market-order P&L seed
6:   S P ← ( P t P e x i t ) − μ        ▷ SELL market-order P&L seed
7:   u ← 0; n L ← 0              ▷ cumulative depth & BUY fills
8:   v ← 0; n S ← 0              ▷ cumulative depth & SELL fills
9:  for k = 1 to K do
10:   if u + d k u p _ r a n g e then ▷ BUY pending k fills
11:     u u + d k ; n L n L + 1
12:     L P L P + ( P e x i t P t + u ) · c n _ L μ · c n _ L
13:   end if
14:   if v + d k d n _ r a n g e then ▷ SELL pending k fills
15:     v v + d k ; n S n S + 1
16:     S P S P + ( P t P e x i t + v ) · c n _ S μ · c n _ S
17:   end if
18:  end for
19:  if L P > S P L P > 0 then y t ← 0; v t ← 1 ▷ Long-grid preferred
20:  else if S P > L P S P > 0 then y t ← 1; v t ← 1 ▷ Short-grid preferred
21:  else y t ← ∅; v t ← 0              ▷ excluded from training
22: end for
23: return ( y , v )
Algorithm 2. Soft Martingale Execution per H1 bar with cumulative grid construction
Input: bar open price P t ; classifier f ; b a s e _ l o t = 0.04 ;
     lot coefficients c 1 , , c K from linspace(1, 5, K = 10 );
     grid distances d 1 , , d K from linspace(0.003, 0.008, K = 10 ) quote units.
Output: one market order and up to K pending orders submitted at bar t .
1: if not i s N e w B a r ( ) then return
2: π f ( x t )            ▷ P(label = 1), i.e., Short-grid
3: if π < 0.5 then d i r ← BUY else d i r ← SELL
4: if E x i s t i n g G r i d D i r e c t i o n d i r then
5:    C l o s e A l l A c t i v e A n d P e n d i n g O r d e r s ( )    ▷ signal-driven reversal
6: end if
7: if not C h e c k M o n e y F o r T r a d e ( b a s e _ l o t ) then return
8: S u b m i t M a r k e t O r d e r ( d i r , l o t = b a s e _ l o t , p r i c e = P t )
9: u ← 0                ▷ cumulative-distance anchor
10: for k = 1 to K do
11:   u u + d k           ▷ cumulative depth from P t
12:   p r i c e k P t u if d i r = BUY else P t + u
13:   l o t k ← round_to_step( b a s e _ l o t · c k , 0.01)
14:   S u b m i t P e n d i n g O r d e r ( d i r , l o t = l o t k , p r i c e = p r i c e k )
15: end for

1.3. Scope and Delimitations

This study focuses on one major Forex currency pair (EUR/USD) selected for its exceptional liquidity, narrow bid-ask spread, well-documented mean-reverting H1 (one-hour timeframe) properties, and the richest historical tick data record among global currency pairs. The in-sample period spans January 2018–June 2024 (6.5 years); the out-of-sample testing period is 20 November 2024–19 November 2025. Features are limited to price-based moving-average deviation signals. The system is evaluated under 1:500 leverage, reflecting conditions available through ASIC-regulated offshore brokerages. Generalizability to alternative pairs, asset classes, and timeframes is identified as a future research direction.

1.4. Paper Organization

Section 2 reviews related literature across five domains. Section 3 presents the complete system architecture and methodology. Section 4 reports empirical results addressing all four RQs. Section 5 provides theoretical discussion and comparative analysis. Section 6 concludes with future research directions.

2. Related Work

2.1. Market Efficiency and Forex Predictability

The Efficient Market Hypothesis (EMH) [8] posits that prices fully reflect all available information, rendering technical analysis ineffective under its strict interpretation [9]. In the semi-strong form most relevant to retail Forex trading, prices instantly adjust to all public information. Meese and Rogoff [10] reinforced this view by showing that structural exchange rate models fail to outperform a random walk at short horizons. However, Lo and MacKinlay [11] documented statistically significant return predictability at intraday and short-term horizons, directly challenging strict EMH, and Lo, Mamaysky, and Wang [12] provided rigorous statistical foundations demonstrating that technical analysis patterns contain genuine predictive information. The systematic review by Ayitey Junior et al. [13], covering 74 ML Forex forecasting studies (2010–2021), found that ML models consistently outperform naive benchmarks, with the studied pair appearing in 42 of 60 primary studies.
These findings align with Lo’s Adaptive Markets Hypothesis (AMH) [14], which frames efficiency as a dynamic evolutionary condition: exploitable patterns may exist at specific time horizons where liquidity provision, herding, and information asymmetries create transient inefficiencies amenable to algorithmic exploitation. The empirical result of 65.77% directional accuracy with z = 6.65 ( p < 0.0001 ) reported in this paper is consistent with the AMH framework.

2.2. Machine Learning in Forex Algorithmic Trading

Machine learning has been extensively applied to directional Forex forecasting. Guyard and Deriaz [15] conducted a systematic comparison of classification algorithms for EUR/USD daily directional prediction, finding that gradient boosting and ensemble methods consistently outperformed single-model baselines. Yildirim et al. [16] demonstrated that LSTM (Long Short-Term Memory) networks augmented with macroeconomic indicators significantly improved directional accuracy over price-only models. Nguyen et al. [17] achieved a 29% MAE (Mean Absolute Error) reduction using dual-input deep learning architectures integrating technical and fundamental features.
Machine learning has also been applied to limit order book mid-price prediction [18], demonstrating that feature-engineered inputs substantially improve directional accuracy. A cross-currency comparison across eight major pairs over 2018–2023 [13] found gradient boosting methods achieving outperformance rates exceeding 75% across all pairs. The gradient boosting approach adopted in AHFGTS offers competitive accuracy with the decisive practical advantage of native MetaTrader 5 integration without external runtime dependencies.

2.3. Gradient Boosting: Foundations and Algorithm Selection

Gradient boosting was formalized by Friedman [19] as function-space optimization: each new weak learner is fitted to the negative gradient of the loss function, performing steepest-descent optimization in function space. XGBoost [20] extended this with second-order Taylor expansion and ℓ1/ℓ2 regularization. LightGBM [21] introduced Gradient-based One-Side Sampling (GOSS) and Exclusive Feature Bundling (EFB) achieving up to 20× training speedup. CatBoost [22] introduced two innovations critical for financial time series: Ordered Target Statistics (OTS) for principled categorical encoding and Ordered Boosting to prevent prediction shift—a subtle in-sample bias that arises when the same non-i.i.d. sequential observations contribute to both gradient computation and model fitting—which explicitly addresses the stationarity violation inherent in financial data. CatBoost provides native C++ model export enabling direct compilation within MQL5 trading agents, eliminating external Python 3.9.7 runtime dependencies and achieving sub-millisecond inference. Table 2 summarizes the comparative analysis of these gradient boosting frameworks.

2.4. Grid Trading Theory and Martingale Risk

Grid trading is an execution strategy placing buy and sell limit orders at regular price intervals, profiting from oscillatory price behavior. Taranto and Khan [2] provided the first rigorous academic treatment via the bi-directional grid constrained (BGC) framework. Their central finding is the Sustainability Paradox: grid trading generates superior short-term returns, but the probability of account ruin approaches one almost surely in the long run. Subsequent work [3] extended this via stochastic differential equations. This paradox maps directly onto the Gambler’s Ruin result [23,24]. The Soft Martingale modification in AHFGTS addresses this by substituting linearly scaled lot multipliers for classical 2.0× doubling.

2.5. Risk Management and Sustainability in Algorithmic Trading

The sustainability of an algorithmic trading system is determined not only by long-run expected return but equally by its capacity to survive adverse market regimes without catastrophic capital loss. We organize the relevant literature under three themes. (i) Foundational optimal-portfolio theory. Merton [25] established the foundational continuous-time framework for optimal portfolio choice, formulating the agent’s problem as maximizing the expected total utility of intermediate consumption plus a terminal bequest subject to a stochastic budget constraint—not, as frequently misquoted in the literature, the expected utility of terminal wealth alone. (ii) Empirical evidence for technical trading rules. Brock, Lakonishok, and LeBaron [26] documented that simple moving-average trading rules generate returns statistically distinguishable from random-walk behavior on U.S. equity indices; Chong and Ng [27] extended this evidence to U.K. equities under MACD and RSI rules; these results motivate the MA-deviation feature family used in Section 3.4 as an evidence-backed feature choice rather than an ad hoc engineering decision. (iii) Practical risk-management mechanisms. Risk management in algorithmic grid systems is typically implemented through four mechanisms: leverage constraints, position depth limits, equity-based kill switches, and dynamic lot sizing. Kelly [28], working from information-theoretic principles, prescribes the optimal capital fraction
f = p b q b
to risk per round, where p is the win probability, q = 1 − p, and b is the average win/average loss ratio; this rule maximizes long-run geometric mean return while avoiding capital exhaustion. A worked Kelly calculation using the empirical parameters of the present study is provided in Section 6.
The standard reporting of only maximum balance drawdown conceals a structural risk that this paper terms the Drawdown Dichotomy. Bollinger [29] formalized volatility-adaptive band-based mean-reversion indicators. Hastie et al. [30] provide the statistical learning theory foundations for the regularized gradient boosting estimators employed in AHFGTS. Sullivan et al. [31] demonstrated that rule-based trading systems require walk-forward validation to avoid data-snooping bias. Hamilton [32] provides the canonical reference for regime-switching analysis, to which the descriptive “regime” language in Section 3.6.2 is anchored; Cohen [33] provides the effect-size thresholds used in Section 4.3 and the Sharpe-ratio acceptability heuristic in Section 3.8.

2.6. ML-Grid Integration: Prior Work and Identified Gaps

Rundo et al. [6] introduced the Grid Trading System Robot (GTSbot), demonstrating that trend classification prior to grid activation reduces drawdown. Rodriguez-Gonzalez et al. [34] demonstrated that combining neural networks with technical analysis signals substantially improves trading system performance. However, GTSbot used a simple neural network with horizon-based directional labels. Yeh et al. [7] combined FNN (Feed-forward Neural Network)/LSTM with Simplified Swarm Optimization but retained fixed-horizon return labels. Murphy [35] provides the canonical reference for technical indicator construction; Friedman [36] extended stochastic gradient boosting with subsampling regularization.
This study extends the author’s prior doctoral work [37] by formalizing and empirically validating the three contributions identified therein. Four specific research gaps motivate this study: (1) no published work evaluates gradient boosting with ordered boosting for grid signal generation under strategy-embedded labeling; (2) SEL has not been formalized as a generalizable ML framework; (3) no production-ready MetaTrader 5 implementation with native C++ gradient boosting inference has been documented; and (4) the structural divergence between floating and realized drawdown has not been formally defined as a scalar risk metric.

3. System Architecture and Methodology

3.1. Research Paradigm: Design Science Research

This study adopts Design Science Research (DSR) [5] as its methodological framework. DSR frames the research process around purposeful artifact creation and its rigorous evaluation. The DSR cycle here comprises three phases: (1) Awareness of the ML-grid labeling misalignment; (2) Design and Development of the AHFGTS incorporating SEL, Soft Martingale execution, and DDR quantification; and (3) Evaluation through out-of-sample forward simulation reported in Section 4.
Strategy-Embedded Labeling is the signal generation layer. Soft Martingale Execution is the risk control layer. Drawdown Dichotomy Quantification is the evaluation framework layer. Together these three layers constitute a complete, reproducible artifact addressing the ML-grid integration problem. Figure 1 illustrates the complete system architecture.

3.2. Mathematical Problem Formulation

The trading problem is formalized as supervised binary classification. Let D = x t , y t for t = 1 , , T denote the historical dataset where x t is the feature vector and y t is the binary outcome label. The objective is to learn f : R 14 0 , 1 approximating P y t = 1 | x t . The feature vector encodes 14 moving-average deviation signals:
x t = P t M A P , w k k = 1 , , 14
where P t is the closing price at bar t , M A P , w k is the simple moving average over window w k , and W = 5 , 25 , 55 , 75 , 100 , 125 , 150 , 200 , 250 , 300 , 350 , 400 , 450 , 500 periods. The execution policy converts model output to a trading action:
a t = B U Y G R I D   i f   f x t < 0.5 ;   a t = S E L L G R I D   i f   f x t 0.5
Here y t ∈ {0, 1} under the SEL convention defined in Section 3.5.2 (0 = Long-grid preferred; 1 = Short-grid preferred), and f ( x t ) 0.5 triggers a Short grid. The threshold 0.5 is used without a hysteresis band; a two-valley robustness check confirmed that labels in the band 0.5 ± 0.02 (the predicted-probability uncertainty zone) account for only ≈4.1% of all predictions in the out-of-sample window, so hysteresis is considered an engineering refinement and is deferred to future work (Section 6). Margin-based uncertainty is reported in Section 4.9 as 1 | f ( x t ) 0.5 | .

3.3. Data Collection and Temporal Partitioning

Forex H1 OHLCV and tick data were sourced from Pepperstone Group Limited (ASIC-regulated) via the MetaTrader 5 API. The H1 timeframe balances intrabar movement sufficient for grid activation against microstructure noise. Tick-level data at 99% modeling quality is essential for grid strategies where pending-order triggering is sensitive to exact intrabar tick sequences. A uniform 1.0 pip markup is applied to all simulated trades.
Dataset partitioning follows strict temporal separation. The in-sample training period spans January 2018–June 2024. The out-of-sample test period covers 20 November 2024–19 November 2025. A five-month temporal gap prevents seasonal boundary effects. No feature values, model parameters, or threshold choices were informed by test-period data.

3.4. Feature Engineering: Multi-Scale MA Deviation Framework

Financial price series are inherently non-stationary; raw price levels are unsuitable as ML inputs. The MA deviation transformation applies a high-pass filter:
D k , t = P t M A P , w k = P t 1 w k i = 0 w k 1 P t i
removing the trend component and retaining the mean-reverting residual. We do not assert strict (wide-sense) stationarity of the deviation series. Rather, D k , t is a first-order detrending filter: the moving-average subtraction removes slow drift so that the residual deviation is approximately stationary over windows of length w = 450 and w = 500 (the training fold lengths, Section 3.5.1). We verified this operational assumption by running Augmented Dickey–Fuller (ADF) and KPSS tests on the 14 deviation series over a sliding 1000 bar window: >92% of windows reject the unit-root null at p < 0.05 under ADF, and <7% reject stationarity under KPSS. The gradient boosting model is therefore trained on residuals that behave as locally stationary, while acknowledging that the assumption is not strict. The resulting features are conceptually aligned with grid trading: the sign and magnitude of the MA deviation indicate whether price is above or below its moving average, directly relevant for predicting the direction and depth of short-term mean reversion. The 14 windows span multiple time scales: short-term (5–55 periods), medium-term (75–200 periods), and long-term (250–500 periods). Multi-scale convergence is hypothesized to signal elevated mean-reversion probability favorable for grid deployment, a hypothesis validated by the 65.77% win rate and significant z-test reported in Section 4.

3.5. Strategy-Embedded Labeling (SEL)

3.5.1. Motivation

Conventional financial ML assigns labels based on price direction at a fixed horizon. This is structurally misaligned with grid payoffs: a grid may profit even from an initially adverse move, as mean reversion activates deeper levels and generates profit across the grid range. SEL resolves this by labeling observations based on simulated grid strategy profitability rather than abstract price direction.

3.5.2. Labeling Algorithm

For each bar t in the training set, two grid simulations execute over the 15 bar forward price path. Long and Short grid profits are computed:
L P t = P t + 15 P t μ + k A P t + 15 P t + s k · c k μ · c k
where μ = 1.0 pip markup, s k is adverse depth to level k , c k is the lot coefficient, and A is the set of activated levels. Short profit S P t is computed symmetrically. Labels are assigned:
y t = 0 L o n g   i f   L P t > S P t   a n d   L P t > 0
y t = 1 S h o r t   i f   S P t > L P t   a n d   S P t > 0
Timestamps where neither strategy is profitable are excluded (~15% of all bars), ensuring the classifier trains only on observations with a meaningful directional choice.

3.6. Gradient Boosting Model and GMM Augmentation

3.6.1. Algorithm Selection

CatBoost [22] is selected for three domain-specific reasons: (i) Ordered Boosting prevents prediction shift on sequential non-i.i.d. financial data; (ii) native C++ model export enables direct integration within MQL5 without external Python runtime; and (iii) symmetric tree architecture provides robustness to heterogeneous feature magnitudes.

3.6.2. Class Imbalance and GMM Augmentation

SEL exclusion reduces effective training sample size and may exacerbate class imbalance. A Gaussian Mixture Model with K = 75 components and full covariance matrices is fitted to the labeled feature-label joint distribution. The choice K = 75 was obtained by minimizing the Bayesian Information Criterion (BIC) over a grid K { 25 , 50 , 75 , 100 , 125 , 150 } using a held-out last-year slice; the BIC curve is flat between 50 and 100 (difference < 2 units), so the choice is robust within that range. The word “regime” is used here in a descriptive, not model-based, sense: the GMM clusters 8-dimensional return distributions, not a two-state Markov chain, and we do not claim a separate regime-switching model in the sense of Hamilton [32]. During each training iteration, 10,000 synthetic samples are drawn from the GMM, augmenting the real training data and smoothing class distribution across market regimes.

3.6.3. Hyperparameters and Model Selection

Training configuration: 500 boosting iterations, tree depth 6, learning rate 0.01, log-loss objective. Early stopping with 25-round patience monitors a 50–50 GMM train–validation split. Model selection employs 10 independent training runs on independently sampled GMM datasets, selecting the highest out-of-time R-squared model. A full theoretical convergence-rate analysis for gradient boosting on SEL labels is beyond the scope of the present empirical paper and is identified as future work in Section 6.

3.7. Soft Martingale Execution Architecture

3.7.1. MetaTrader 5 Agent Design

The MQL5 trading agent integrates the compiled gradient boosting model as a C++ inference header file. The OnTick() event-driven architecture generates signals exactly once per H1 bar open via the isNewBar() detection function. A CheckMoneyForTrade() validation gate prevents order placement when free margin is insufficient.

3.7.2. Grid Structure and Lot Scaling

Each signal triggers one market order at base lot (0.04) and up to 10 pending limit orders. The market order always uses the unscaled base lot. Soft Martingale lot sizes for the 10 pending orders follow:
l o t k = b a s e _ l o t × l i n s p a c e 1 , 5 , 10 k ,         k = 0 , 1 , , 9
Before broker-level rounding the raw multiplier sequence is [1.000, 1.444, 1.889, 2.333, 2.778, 3.222, 3.667, 4.111, 4.556, 5.000], giving raw lots [0.0400, 0.0578, 0.0756, 0.0933, 0.1111, 0.1289, 0.1467, 0.1644, 0.1822, 0.2000]. Half-to-even rounding to the broker’s 0.01 minimum lot step produces the deployed pending order sequence [0.04, 0.06, 0.08, 0.09, 0.11, 0.13, 0.15, 0.16, 0.18, 0.20] lots (half-to-even dominates the eighth element 0.1644 → 0.16 rather than 0.17). The complete position includes the market order (0.04) followed by these pending orders. When four levels activate (one market order plus three pending orders), Soft Martingale accumulates 0.04 + 0.04 + 0.06 + 0.08 = 0.22 lots, versus 0.04 + 0.08 + 0.16 + 0.32 = 0.60 lots under classical 2.0× Martingale—a 63% reduction. Grid spacing expands linearly:
g r i d _ d i s t i = l i n s p a c e 0.003 , 0.008 , 10 ,         i = 1 , , 10
from 30 pips at level 1 to 80 pips at level 10. Here g r i d _ d i s t i denotes the incremental step between consecutive levels; the grid is constructed cumulatively from P t so that the deepest pending level lies at a cumulative distance Σ g r i d _ d i s t i 550 pips from the market-order entry. Expanding spacing reflects decreasing probability of increasingly large adverse moves, balancing capital commitment against.
Definition 1 (Soft Martingale Scaling). 
A lot-scaling schedule { l o t 0 , l o t 1 , …, l o t K 1 } is a Soft Martingale schedule if it satisfies (i)–(iii): (i) l o t 0 = b a s e _ l o t > 0 ; (ii) l o t k < 2 · l o t k 1 for all k 1 (strict sub-doubling); (iii) l o t k l o t k 1 for all k 1 (non-decreasing). The classical 2× Martingale violates (ii) with equality; constant-lot sizing satisfies (ii) strictly but violates strict monotonicity in (iii) (permitted via the non-strict ≥). Schedules meeting (i)–(iii) cap the four-level cumulative exposure sublinearly in K while preserving recovery capacity. Table 3 compares five lot-scaling schemes across four cumulative grid levels.

3.8. Evaluation Methodology and Baselines

Six KPIs are used: Profit Factor (PF); Win Rate (WR); Sharpe Ratio (SR); Net Annual Return; Maximum Balance Drawdown (MBD); and Maximum Equity Drawdown (MED). The Drawdown Dichotomy Ratio D D R = M E D / M B D is the primary risk analysis metric. Evaluation uses 99% tick-quality forward simulation, 1:500 leverage, 1.0 pip uniform spread, and a USD 1000 initial deposit. There are two baselines: (1) Random Entry Grid and (2) unfiltered static grid literature benchmark PF 1.2–1.5 [3,6].
The Sharpe Ratio is computed from the trade-level profit and loss (P&L) series as reported by the MetaTrader 5 Strategy Tester. Specifically, let r i denote the P&L of the i -th closed trade. The annualized Sharpe Ratio is:
S R = ¯ r σ · N
where ¯ r is the mean P&L per trade, σ is the standard deviation of the trade P&L series, and N is the total number of trades within the evaluation year. A zero risk-free rate is assumed given the short holding periods characteristic of intraday grid positions.
In the Sharpe-ratio equation, r ¯ denotes the sample mean P&L per trade and σ denotes the sample (not population) standard deviation s 2 ; in the wider finance literature r is conventionally the risk-free rate, whereas our r ¯ specifically denotes sample mean trade P&L, and the two should not be conflated. An acceptable-strategy heuristic of S R > 1.0 is used here following [4,33], with S R > 2.0 considered strong and S R > 3.0 excellent. A pip (percentage in point) is the smallest conventional price increment for a Forex pair; for EUR/USD one pip equals 0.0001 of the quote price.

3.9. Grid Size Calibration and Market Microstructure

The grid interval is the most critical parameter governing grid trading performance. Too small an interval results in excessive trade frequency and transaction cost drag; too large an interval reduces trade frequency below the threshold for consistent returns. Taranto and Khan [2] derived that expected profit is maximized when the grid interval is calibrated to the characteristic price oscillation amplitude. The Average True Range (ATR) introduced by Wilder [38] directly measures expected short-horizon price range. The 30–80 pip range used in AHFGTS is calibrated against the empirical 14-period ATR distribution of EUR/USD H1 during the in-sample period (median ≈ 42 pips, 5th–95th percentile 18–94 pips). The deployed grid thus spans approximately one median ATR at the innermost level to the upper tail of hourly excursions at the outermost level—a principled, data-driven choice rather than a free parameter.
Market microstructure interaction further constrains grid sizing. The minimum price increment is one pip and the bid-ask spread for major pairs during peak liquidity is typically 0.5–1.5 pips. The 30–80 pip range in AHFGTS substantially exceeds the uniform 1.0 pip markup, providing adequate transaction cost headroom. Yeh et al. [7] demonstrated that volatility-adaptive grid spacing outperforms fixed intervals across diverse regimes, motivating the ATR-adaptive extension proposed in Section 6.

3.10. Computational Architecture and MQL5 Deployment

Training and deployment use different toolchains by design: model training is performed in Python (CatBoost) for flexibility and ecosystem support, whereas inference is executed in C++ for latency-critical on-bar prediction. This two-language split is standard practice in production ML systems. The solution leverages CatBoost’s model export capability, serializing the complete trained model as a self-contained C++ header file. The catboost_model() function accepts the 14 MA deviation features as a C-style array, executes the tree traversal computation, and returns a sigmoid-transformed probability in 0 , 1 . The complete inference computation executes in under one millisecond.

4. Empirical Results

4.1. Simulation Configuration

The AHFGTS was evaluated using MetaTrader 5 Strategy Tester at 99% tick-modeling quality. The evaluation processed all 38 million ticks across 261 trading days (20 November 2024–19 November 2025) without exclusions. Initial deposit USD 1000, leverage 1:500, uniform 1.0 pip spread. The twelve-month window encompasses three macro-economic sub-regimes. The complete trade-by-trade output of this evaluation, including all 444 trades and the full set of performance statistics reported in Table 4, Table 5, Table 6, Table 7 and Table 8, is provided in the Supplementary Materials (Strategy Tester Report).

4.2. Aggregate Financial Performance

Table 4 presents the full performance summary. The AHFGTS executed 444 trades, achieving USD 4425.78 net profit, a 442.6% annual return on USD 1000 initial capital. P F = 2.85 , exceeding both the commercially viable threshold of 1.5 and the robust edge threshold of 2.0.
The annualized Sharpe Ratio, computed from the 444-trade P&L series with mean trade profit ¯ r = U S D   9.97 and trade P&L standard deviation σ = U S D   175.0 , yields S R = 9.97 175.0 · 444 = 0.0570 × 21.07 = 1.20 . This exceeds the threshold of 1.0 indicating acceptable risk-adjusted return.
Table 4. Aggregate financial performance (12-month out-of-sample).
Table 4. Aggregate financial performance (12-month out-of-sample).
MetricValueBenchmark/Interpretation
Initial DepositUSD 1000Starting capital
Total Net ProfitUSD 4425.78442.6% annualized return
Ending BalanceUSD 5425.785.43× capital growth
Profit Factor2.85≥2.0: robust edge
Overall Win Rate65.77%292 of 444 trades
Total Trades444~1.7 per trading day
Gross ProfitUSD 6823.95Cumulative winner P&L
Gross LossUSD −2398.17Cumulative loser P&L
Sharpe Ratio1.20Acceptable risk-adjusted return
Max. Balance DD (MBD)13.98%Realized equity peak-to-trough
Max. Equity DD (MED)79.97%Floating equity incl. open positions
DDR5.72×MED/MBD structural risk metric
Leverage Applied1:500Offshore broker condition

4.3. Directional Signal Accuracy (RQ1)

The aggregate win rate of 65.77% represents a 15.77 percentage point advantage over the 50% random walk null. The one-sample binomial proportion z-test:
z o b s = p ^ p 0 p 0 1 p 0 n = 0.6577 0.50 0.25 444 = 6.65
exceeds z = 3.29 (critical value at α = 0.001 ), rejecting the random walk null with p < 0.0001 . Cohen’s h effect size:
h = 2 · a r c s i n 0.6577 2 · a r c s i n 0.50 = 0.321
exceeds h = 0.20 [Cohen’s [33] conventional small-effect threshold]. The null hypothesis of random-walk directional accuracy is therefore rejected at the p < 0.0001 level, addressing RQ1. Table 5 reports the directional classification accuracy and the associated statistical tests.
Table 5. Directional Classification Accuracy and Statistical Tests (RQ1).
Table 5. Directional Classification Accuracy and Statistical Tests (RQ1).
DirectionTradesWonWin Ratevs. 50%
Long (Buy Grid)23816971.01%+21.01%
Short (Sell Grid)20612359.71%+9.71%
Overall44429265.77%Z = 6.65, p < 0.0001
The Long-Short asymmetry (71.01% vs. 59.71%) reflects macro-economic conditions during the evaluation period. Both directional win rates significantly exceed 50%, confirming that MA deviation features encode genuine predictive information across both orientations.

4.4. SEL Efficacy (RQ2)

The SEL framework produced P F = 2.85 , a 90–138% improvement over the unfiltered grid baseline of 1.2–1.5 [3,6]. The critical differentiator is objective alignment: SEL trains the classifier on grid execution profitability. The PF improvement, in conjunction with the directional-accuracy z-test in Section 4.3, exceeds the no-improvement null by a margin large enough to reject it under the same significance level, addressing RQ2. Table 6 summarizes the comparison between SEL and conventional horizon labeling.
Table 6. SEL vs. Conventional Horizon Labeling (RQ2).
Table 6. SEL vs. Conventional Horizon Labeling (RQ2).
CriterionSEL (This Study)Horizon Labeling [4]
Label SourceSimulated 15 bar grid P&LPrice return sign at horizon h
Execution AlignmentDirect: full payoff encodedIndirect: directional proxy only
Ambiguous Label ExclusionYes (~15% bars excluded)No: all bars labeled
Profit Factor Achieved2.851.20–1.50 (lit. baseline)
Improvement vs. Baseline+90% to +138%Reference (0%)

4.5. Soft Martingale and Adaptive Exposure Control (RQ3)

Table 7 reconstructs the 6–18 December 2024 trade sequence illustrating Soft Martingale vs. classical 2.0× Martingale across four activated levels during a 121.7-pip adverse move. Soft Martingale accumulated 0.22 lots vs. 0.60 lots classical, a 63% reduction.
Table 7. Soft vs. Classical Martingale Grid Reconstruction, 6–18 December 2024 (RQ3).
Table 7. Soft vs. Classical Martingale Grid Reconstruction, 6–18 December 2024 (RQ3).
LevelEntry PriceSoft LotsClassic LotsReduction
01.05497 (Market)0.040.04-
11.05141 (−35.6 pips)0.04 (1.00×)0.08 (2.00×)−50%
21.04753 (−74.4 pips)0.06 (1.50×)0.16 (2.00×)−62%
31.04280 (−121.7 pips)0.08 (1.33×)0.32 (2.00×)−75%
Total (4 levels) 0.22 lots0.60 lots−63%
RQ3 is addressed empirically as follows: the proposed integration of Soft Martingale scaling coupled with signal-driven position reversal effectively controls capital exposure without eliminating the mean-reversion recovery mechanism, as shown by the 63% reduction in four-level cumulative exposure relative to classical 2× doubling.

4.6. Financial Sustainability and Leverage Analysis (RQ4)

Under 1:500 leverage, four activated levels at 0.22 lots requires USD 46.20 margin. Under ESMA 1:30, seven activated levels at 0.55 lots requires USD 1925.00, exceeding the USD 1000 starting capital. The AHFGTS survived the full twelve-month evaluation without a margin call under 1:500, addressing RQ4 within the stated leverage regime. Table 8 details the leverage feasibility analysis across both regimes.
Table 8. Sustainability Analysis: Leverage Feasibility (RQ4).
Table 8. Sustainability Analysis: Leverage Feasibility (RQ4).
DimensionAHFGTS ResultBenchmark
Max. Balance Drawdown13.98%<20% (low risk)
Max. Equity Drawdown79.97%≤30% (fund-halt)
Drawdown Dichotomy (DDR)5.72×≤1.5× (non-martingale)
Net Annual Return442.6%20–40% (systematic funds)
Margin 1:500 at 4 levelsUSD 46.20 (viable)Reference
Margin 1:30 ESMA at 4 levelsUSD 1925 (margin call)Not viable retail

4.7. Comparative Performance Benchmark

AHFGTS achieves higher PF and net return across all grid-based comparators while maintaining lower balance drawdown. The equity drawdown, while extreme, is lower than the random entry grid floor. The ML-only directional strategy achieves the most favorable equity profile at substantially lower returns, confirming the fundamental amplification trade-off. Table 9 presents the full comparative performance matrix.

4.8. The Drawdown Dichotomy: Floating vs. Realized Risk in Martingale Systems

The D D R = 5.72 × quantifies the structural gap between floating and realized risk that conventional maximum drawdown reporting conflates. For an investor observing only balance statements ( M B D = 13.98 % ), the true floating risk ( M E D = 79.97 % ) would be significantly underestimated. Table 10 decomposes the structural risk underlying the Drawdown Dichotomy.

4.9. Feature Importance and Signal Quality

Post-training feature importance analysis revealed that medium-term MA deviation features (windows 75–200 periods) consistently ranked as the most predictive inputs. Short-term features contributed secondary predictive value, while long-term features provided the weakest individual contributions but important regime context. Ordered Boosting’s non-linear interaction learning captured convergent signals as particularly strong predictors.

4.10. Adaptive Grid Reversal Dynamics

A notable execution characteristic documented in the deal logs is systematic cancelation of unactivated pending grid orders when the classifier issues a directional reversal signal. Signal-driven cancelation eliminates opposing directional exposure risk while simultaneously preserving free margin for the new opposing grid.

4.11. Cross-Regime Performance Decomposition

Three macro-economic sub-regimes were identified within the twelve-month evaluation period. During the post-election USD strength phase (November–December 2024), the AHFGTS maintained net positive performance. During the ECB rate adjustment period (January–April 2025), elevated volatility produced somewhat reduced trade frequency. The mid-year range-bound consolidation (May–November 2025) produced the highest trade frequency and Profit Factor, confirming that the Soft Martingale architecture performs as theoretically expected under mean-reverting conditions.

4.12. Failure Modes and Black-Swan Stress Analysis

Beyond the aggregate MED of 79.97%, it is instructive to enumerate the specific market conditions under which AHFGTS would breach the 80% equity-drawdown boundary and progress to total capital loss. Table 11 enumerates four calibrated failure scenarios using the deployed grid parameters (10 pending levels with cumulative reach ≈ 550 pips; lot schedule total 1.24 lots across market + 10 pendings). The dominant failure mode is the combination of deep one-way trend and discontinuous price action; we recommend pairing AHFGTS with an equity-based kill switch to enforce a hard loss bound below the structural MED.

5. Discussion

5.1. The Probability-Structure Trade-Off

The empirical results address all four research questions as follows: RQ1 ( z = 6.65 , p < 0.0001 ); RQ2 ( P F = 2.85 , 90–138% improvement); RQ3 (Soft Martingale with signal-driven cancelation); and RQ4 ( D D R = 5.72 × ). These results illuminate a fundamental principle: machine learning (SEL) improves probability; position sizing structure (Soft Martingale) extends survival; and Drawdown Dichotomy Quantification (DDR) measures precisely how much structural risk remains.
The gradient boosting classifier raised the directional win rate from 50% to 65.77%, translating into P F = 2.85 . Yet this probability enhancement did not eliminate structural equity risk ( M E D = 79.97 % ). This is consistent with Gambler’s Ruin theory [23,24]. The current AHFGTS implements finite game horizon and positive EV per round but not the third avoidance condition: risk-proportional position sizing via Kelly Criterion. The D D R = 5.72 × quantifies the consequence of this omission.

5.2. SEL as a Generalizable ML Methodology

The 90–138% Profit Factor improvement validates SEL as a methodological contribution beyond this specific application. The core insight is that a conventional horizon label is fundamentally different information from whether a Long or Short grid strategy generates superior net profitability. SEL encodes the path-dependent payoff structure by replacing the binary label “did the price rise or fall at t + h ?” with the answer to the strategy-conditional question “if we deploy the proposed grid at t , which direction produces the larger forward profit along the realized price path?” Because the latter is computed by full forward simulation of the execution engine—including partial fills across K grid levels, expanding grid distances, and lot coefficients c k —the label carries information about the execution geometry that a horizon-return label cannot. The generalization extends to any supervised learning application with non-linear or path-dependent payoffs: options strategies, statistical arbitrage pairs, and multi-order execution systems. SEL thus extends Lopez de Prado’s meta-labeling framework [4].

5.3. Drawdown Dichotomy Quantification as a Risk Disclosure Standard

The D D R = M E D / M B D = 5.72 × provides a dimensionless, cross-system comparable metric for structural leverage concentration in Martingale-family systems. In the limit, non-Martingale systems whose equity and balance coincide exhibit D D R 1.0 × ; while pure Martingale systems in which deep floating drawdowns never translate to closed losses can in principle produce D D R . D D R differs from Value-at-Risk and from the Ulcer/Pain Index family because the latter are magnitude- or path-integrated statistics computed on a single equity series, whereas D D R is a ratio of two drawdown definitions; D D R therefore targets a disclosure gap those metrics cannot close. The DDR is recommended as a disclosure element alongside MBD for any algorithm employing Martingale-family scaling.

5.4. Regulatory Bifurcation and Applicability Domain

The leverage analysis establishes a regulatory bifurcation confining the AHFGTS to offshore trading environments. Three adaptation pathways exist: (1) Capital upscaling: approximately USD 17,000 for ESMA 1:30 compliance; (2) Grid depth reduction to 3–4 levels; and (3) Kelly Criterion dynamic lot sizing. Each pathway represents a formally characterizable design-space trade-off.

5.5. Limitations and Threats to Validity

Four limitations warrant acknowledgment as explicit threats to external validity. First, the twelve-month evaluation window provides one path realization of a stochastic process; walk-forward validation across three to five non-overlapping annual windows is recommended. Second, single-pair focus limits generalizability claims, and a small-scale replication on GBP/USD and AUD/USD is identified as a priority future-work item (Section 6). Third, the 1:500 leverage assumption excludes the majority of global retail participants operating under ESMA, FCA, or NFA regulations. Fourth, the one-sample z-test used for RQ1 assumes independence across trades; because consecutive trades on EUR/USD H1 are not strictly independent, the reported z value should be interpreted as an approximate rather than exact significance test, and the analysis does not correct for multiple testing across the four RQs.

5.6. Implications for the ML-Grid Research Agenda

Three empirical findings directly anchor the next generation of ML-grid research. On Strategy-Embedded Labeling: the 15.77 pp win rate advantage establishes SEL as the methodologically critical innovation. On Soft Martingale Execution: the 63% exposure reduction demonstrates that sub-linear scaling materially extends survival headroom. On Drawdown Dichotomy Quantification: the D D R = 5.72 × formally establishes that the Sustainability Paradox cannot be resolved through improved entry quality alone.

5.7. Ethical Considerations

The documented D D R = 5.72 × carries significant ethical implications for retail deployment. While the balance curve suggests manageable risk ( M B D = 13.98 % ), the floating equity exposure ( M E D = 79.97 % ) represents near-total capital jeopardy during peak grid depth. Three ethical obligations arise from this structural characteristic.
First, risk communication: any deployment of AHFGTS or similar Martingale-family systems must prominently disclose both MBD and MED to prospective users, as reporting balance drawdown alone systematically understates true risk. Concretely: advertising a strategy on MBD alone is a disclosure failure for Martingale-family systems. In our evaluation, MBD = 13.98% is what a retail customer typically sees on a tear-sheet, while the floating risk MED = 79.97% is what the account peaks at during deep grid activation; DDR supplies the scalar that makes this disclosure gap visible. Second, the system’s exclusive viability under 1:500 offshore leverage raises regulatory jurisdiction concerns; retail traders operating under ESMA (1:30) or NFA (1:50) regulations cannot deploy the system as evaluated. Any commercial promotion must clearly specify this constraint. Third, the single-pair, single-year evaluation does not constitute sufficient evidence for production deployment recommendations; the system should be regarded as a research artifact demonstrating methodological contributions rather than a turnkey commercial trading solution.
The authors further note that high-frequency algorithmic trading systems may contribute to short-term market microstructure effects including liquidity fragmentation during stress events. However, the AHFGTS’s modest position sizes (base lot 0.04, equivalent to approximately 4000 units of notional exposure) render its individual market impact negligible relative to institutional order flow.

6. Conclusions

This paper presented the ML-Augmented High-Frequency Grid Trading System (AHFGTS), demonstrating that gradient boosting-based directional filtering materially improves grid trading performance while formally quantifying the structural risk boundary that ML augmentation alone cannot resolve. Three original contributions were reported. The empirical results address all four research questions, with the important caveat that they are based on a single currency pair over a single twelve-month out-of-sample window: RQ1, the random-walk null was rejected at the p < 0.0001 level ( z = 6.65 ,   p < 0.0001 ); RQ2 validated SEL’s 90–138% Profit Factor improvement; RQ3 demonstrated effective capital exposure control; and RQ4 established D D R = 5.72 × .
The first contribution, Strategy-Embedded Labeling, addresses a specific label-objective misalignment in financial ML for grid trading: conventional directional labels do not capture the path-dependent grid payoff, and SEL replaces them with a label derived from full forward execution simulation. The 90–138% Profit Factor improvement supports the claim that label alignment between training objective and execution payoff consistently improves system performance.
The second contribution, Soft Martingale Execution, provides the first formally characterized sub-linear lot-scaling architecture for ML-augmented grid trading, reducing peak capital exposure by 63% relative to classical 2.0× doubling while preserving the mean-reversion recovery mechanism.
The third contribution, Drawdown Dichotomy Quantification, introduces D D R = M E D / M B D = 5.72 × as the first scalar metric for the structural gap between floating and realized risk in martingale-family systems.
The central finding is that machine learning is a demonstrably effective signal enhancer for high-frequency grid trading, raising the directional win rate from 50% to 65.77% and Profit Factor from ~1.2 to 2.85, yet the D D R = 5.72 × formally establishes that ML augmentation cannot resolve the structural Sustainability Paradox imposed by martingale position sizing.
Five research directions extend the present contributions: (1) Execution-aware Deep Reinforcement Learning for adaptive exit policy design. (2) Kelly Criterion dynamic lot sizing targeting DDR reduction toward 1.5×. Using the empirical parameters of this study ( p = 0.6577 , q = 0.3423 , average-win/average-loss ratio b 0.81 from the 444-trade P&L series) the Kelly fraction is f = ( p · b q ) / b ( 0.533 0.342 ) / 0.81 0.24 ; we recommend half-Kelly in practice following [4,33], so a Kelly-sized b a s e _ l o t would materially reduce peak MED for the same per-trade edge. (3) An ATR-adaptive grid spacing formula enabling cross-asset deployment. (4) A multi-pair portfolio ensemble (GBP/USD, AUD/USD) for portfolio-level DDR diversification, framed as priority future work (Section 5.5) because a matched 99% tick-quality data pipeline is required. (5) A hysteresis-banded decision rule (e.g., [0.45, 0.55]) combined with a full SHAP-based interaction analysis (summary plot, dependence plots for the top-3 features, SHAP interaction values, and waterfall plots) to further characterize the multi-scale feature interaction hypothesized in Section 4.9, plus a full theoretical convergence-rate analysis for gradient boosting on SEL labels.
  • Formal Risk Disclosure.
  (i) The reported Profit Factor of 2.85 and the 442.6% annualized return are structurally coupled with the risk quantified by DDR = 5.72× (MED = 79.97% on USD 1000 starting equity); they are not achievable in isolation from that structural risk. (ii) The reported profitability is conditional on 1:500 leverage, market continuity (no price gaps or flash crashes that skip grid levels), and persistence of the EUR/USD H1 mean-reverting regime; under ESMA 1:30 or similar constraints the system is not retail-deployable as evaluated. (iii) The system as presented is a research demonstration of the SEL, Soft Martingale, and DDR methodologies; it is not a turnkey trading solution. (iv) DDR is proposed as a disclosure element for Martingale-family systems alongside, not instead of, MBD.

Supplementary Materials

The following supporting information can be downloaded at: https://www.mdpi.com/article/10.3390/a19060442/s1.

Author Contributions

Conceptualization, S.C.; methodology, S.C.; software, S.C.; validation, S.C., S.S. and S.N.; formal analysis, S.C.; investigation, S.C.; resources, S.C.; data curation, S.C.; writing—original draft preparation, S.C.; writing—review and editing, S.S. and S.N.; visualization, S.C.; supervision, S.S. and S.N.; project administration, S.S. All authors have read and agreed to the published version of the manuscript.

Funding

This work was supported by the Faculty of Information Technology and Digital Innovation, King Mongkut’s University of Technology North Bangkok, under the Graduate Research Scholarship Program.

Data Availability Statement

The data presented in this study were sourced from Pepperstone Group Limited via the MetaTrader 5 API; restrictions apply to the redistribution of raw tick data due to the data provider’s terms of service. The complete MetaTrader 5 Strategy Tester tick-level backtest report is released as Supplementary Material, enabling direct verification of every numerical result in Table 4, Table 5, Table 6, Table 7 and Table 8 at the trade level. The training and inference source code is available from the corresponding author upon reasonable request for qualified academic researchers, subject to institutional approval and the completion of ongoing graduate-thesis commitments [37].

Conflicts of Interest

The authors declare no conflicts of interest.

Abbreviations

The following abbreviations are used in this manuscript:
AbbreviationDefinition
AHFGTSML-Augmented High-Frequency Grid Trading System
AMHAdaptive Markets Hypothesis
ATRAverage True Range
DDRDrawdown Dichotomy Ratio
DSRDesign Science Research
EMHEfficient Market Hypothesis
GMMGaussian Mixture Model
MAMoving Average
MBDMaximum Balance Drawdown
MEDMaximum Equity Drawdown
PFProfit Factor
SELStrategy-Embedded Labeling
SRSharpe Ratio
ADFAugmented Dickey–Fuller (unit-root test)
BGCBi-directional Grid Constrained (framework)
BICBayesian Information Criterion
EFBExclusive Feature Bundling (LightGBM)
FNNFeed-forward Neural Network
GOSSGradient-based One-Side Sampling (LightGBM)
KPSSKwiatkowski–Phillips–Schmidt–Shin (stationarity test)
LSTMLong Short-Term Memory
MAEMean Absolute Error
OTSOrdered Target Statistics (CatBoost)
SHAPSHapley Additive exPlanations

References

  1. Bank for International Settlements. Triennial Central Bank Survey: OTC Foreign Exchange Turnover in April 2022; BIS: Basel, Switzerland, 2022. [Google Scholar]
  2. Taranto, A.; Khan, S. Gambler’s Ruin Problem and Bi-directional Grid Constrained Trading and Investment Strategies. Investig. Manag. Finan. Innov. 2020, 17, 54–66. [Google Scholar] [CrossRef]
  3. Taranto, A.; Khan, S. Application of Bi-directional Grid Constrained Stochastic Processes to Algorithmic Trading. J. Math. Stat. 2021, 17, 22–29. [Google Scholar] [CrossRef]
  4. López de Prado, M. Advances in Financial Machine Learning; Wiley: Hoboken, NJ, USA, 2018. [Google Scholar]
  5. Hevner, A.R.; March, S.T.; Park, J.; Ram, S. Design Science in Information Systems Research. MIS Q. 2004, 28, 75–105. [Google Scholar] [CrossRef]
  6. Rundo, F.; Trenta, F.; di Stallo, A.L.; Battiato, S. Grid Trading System Robot (GTSbot): A Novel Mathematical Algorithm for Trading FX Market. Appl. Sci. 2019, 9, 1796. [Google Scholar] [CrossRef]
  7. Yeh, W.-C.; Hsieh, Y.-H.; Hsu, K.-Y.; Huang, C.-L. ANN and SSO Algorithms for a Newly Developed Flexible Grid Trading Model. Electronics 2022, 11, 3259. [Google Scholar] [CrossRef]
  8. Malkiel, B.G.; Fama, E.F. Efficient Capital Markets: A Review of Theory and Empirical Work. J. Financ. 1970, 25, 383–417. [Google Scholar] [CrossRef]
  9. Fama, E.F. Efficient Capital Markets: II. J. Financ. 1991, 46, 1575–1617. [Google Scholar] [CrossRef]
  10. Meese, R.A.; Rogoff, K. Empirical Exchange Rate Models of the Seventies: Do They Fit Out of Sample? J. Int. Econ. 1983, 14, 3–24. [Google Scholar] [CrossRef]
  11. Lo, A.W.; MacKinlay, A.C. Stock Market Prices Do Not Follow Random Walks: Evidence from a Simple Specification Test. Rev. Financ. Stud. 1988, 1, 41–66. [Google Scholar] [CrossRef]
  12. Lo, A.W.; Mamaysky, H.; Wang, J. Foundations of Technical Analysis. J. Financ. 2000, 55, 1705–1765. [Google Scholar] [CrossRef]
  13. Ayitey Junior, M.; Appiahene, P.; Appiah, O.; Bombie, C.N. Forex Market Forecasting Using Machine Learning: Systematic Literature Review and Meta-Analysis. J. Big Data 2023, 10, 9. [Google Scholar] [CrossRef]
  14. Lo, A.W. The Adaptive Markets Hypothesis: Market Efficiency from an Evolutionary Perspective. J. Portf. Manag. 2004, 30, 15–29. [Google Scholar] [CrossRef]
  15. Guyard, K.C.; Deriaz, M. Predicting Foreign Exchange EUR/USD Direction Using Machine Learning. In Proceedings of the 7th International Conference on Machine Learning and Machine Intelligence (MLMI), Osaka, Japan, 2–4 August 2024; pp. 1–14. [Google Scholar] [CrossRef]
  16. Yildirim, D.C.; Toroslu, I.H.; Fiore, U. Forecasting Directional Movement of Forex Data Using LSTM with Technical and Macroeconomic Indicators. Financ. Innov. 2021, 7, 1. [Google Scholar] [CrossRef]
  17. Nguyen, P.D.; Thao, N.N.; Kim Chi, D.T.; Nguyen, H.-C.; Mach, B.-N.; Nguyen, T.Q. Deep learning-based predictive models for forex market trends: Practical implementation and performance evaluation. Sci. Prog. 2024, 107, 00368504241275370. [Google Scholar] [CrossRef] [PubMed]
  18. Ntakaris, A.; Kanniainen, J.; Gabbouj, M.; Iosifidis, A. Mid-price prediction based on machine learning methods with technical and quantitative indicators. PLoS ONE 2020, 15, e0234107. [Google Scholar] [CrossRef]
  19. Friedman, J.H. Greedy Function Approximation: A Gradient Boosting Machine. Ann. Stat. 2001, 29, 1189–1232. [Google Scholar] [CrossRef]
  20. Chen, T.; Guestrin, C. XGBoost: A Scalable Tree Boosting System. In Proceedings of the 22nd ACM SIGKDD, San Francisco, CA, USA, 13–17 August 2016; pp. 785–794. [Google Scholar] [CrossRef]
  21. Ke, G.; Meng, Q.; Finley, T.; Wang, T.; Chen, W.; Ma, W.; Ye, Q.; Liu, T.-Y. LightGBM: A Highly Efficient Gradient Boosting Decision Tree. In Advances in Neural Information Processing Systems 30; Neural Information Processing Systems Foundation, Inc.: San Diego, CA, USA, 2017; Volume 30, pp. 3149–3157. [Google Scholar]
  22. Prokhorenkova, L.; Gusev, G.; Vorobev, A.; Dorogush, A.V.; Gulin, A. CatBoost: Unbiased Boosting with Categorical Features. In Advances in Neural Information Processing Systems 31; Neural Information Processing Systems Foundation, Inc.: San Diego, CA, USA, 2018; Volume 31, pp. 6639–6649. [Google Scholar]
  23. Edwards, A.W.F. Pascal’s Problem: The ‘Gambler’s Ruin’. Int. Stat. Rev. 1983, 51, 73–79. [Google Scholar] [CrossRef]
  24. Shoesmith, E. Huygens’ Solution to the Gambler’s Ruin Problem. Hist. Math. 1986, 13, 157–164. [Google Scholar] [CrossRef]
  25. Merton, R.C. Optimum Consumption and Portfolio Rules in a Continuous-Time Model. J. Econ. Theory 1971, 3, 373–413. [Google Scholar] [CrossRef]
  26. Brock, W.; Lakonishok, J.; LeBaron, B. Simple Technical Trading Rules and the Stochastic Properties of Stock Returns. J. Financ. 1992, 47, 1731–1764. [Google Scholar] [CrossRef]
  27. Chong, T.T.-L.; Ng, W.-K. Technical Analysis and the London Stock Exchange: Testing the MACD and RSI Rules Using the FT30. Appl. Econ. Lett. 2008, 15, 1111–1114. [Google Scholar] [CrossRef]
  28. Kelly, J.L., Jr. A New Interpretation of Information Rate. Bell Syst. Tech. J. 1956, 35, 917–926. [Google Scholar] [CrossRef]
  29. Bollinger, J.A. Bollinger on Bollinger Bands; McGraw-Hill: New York, NY, USA, 2002. [Google Scholar]
  30. Hastie, T.; Tibshirani, R.; Friedman, J. The Elements of Statistical Learning, 2nd ed.; Springer: New York, NY, USA, 2009. [Google Scholar]
  31. Sullivan, R.; Timmermann, A.; White, H. Data-Snooping, Technical Trading Rule Performance, and the Bootstrap. J. Financ. 1999, 54, 1647–1691. [Google Scholar] [CrossRef]
  32. Hamilton, J.D. A New Approach to the Economic Analysis of Nonstationary Time Series and the Business Cycle. Econometrica 1989, 57, 357–384. [Google Scholar] [CrossRef]
  33. Cohen, J. Statistical Power Analysis for the Behavioral Sciences, 2nd ed.; Lawrence Erlbaum Associates: Hillsdale, NJ, USA, 1988. [Google Scholar]
  34. Rodriguez-Gonzalez, A.; Garcia-Crespo, A.; Colomo-Palacios, R.; Guldrís Iglesias, F.; Gomez-Berbís, J.M. CAST: Using Neural Networks to Improve Trading Systems Based on Technical Analysis by Means of the RSI Financial Indicator. Expert Syst. Appl. 2011, 38, 11489–11500. [Google Scholar] [CrossRef]
  35. Murphy, J.J. Technical Analysis of the Financial Markets; NYIF: New York, NY, USA, 1999. [Google Scholar]
  36. Friedman, J.H. Stochastic Gradient Boosting. Comput. Stat. Data Anal. 2002, 38, 367–378. [Google Scholar] [CrossRef]
  37. Cheevirot, S. A Machine Learning Algorithm for High-Frequency Grid Trading in Foreign Exchange Market. Ph.D. Thesis, Department of Information Technology and Digital Innovation, King Mongkut’s University of Technology North Bangkok, Bangkok, Thailand, 2026. [Google Scholar]
  38. Wilder, J.W. New Concepts in Technical Trading Systems; Trend Research: Greensboro, NC, USA, 1978. [Google Scholar]
Figure 1. AHFGTS architecture. Three contribution layers map directly to the paper’s subtitle: Strategy-Embedded Labeling (signal generation), Soft Martingale Execution (risk control), and Drawdown Dichotomy Quantification (evaluation framework). Variables used in Figure 1: w denotes the moving-average window length (the 14 values of Equation (1)); x denotes the 14-dimensional feature vector of MA deviations supplied to the classifier; f ( x ) denotes the classifier probability output used for the Buy-Grid/Sell-Grid decision under the 0.5 threshold (Section 3.2).
Figure 1. AHFGTS architecture. Three contribution layers map directly to the paper’s subtitle: Strategy-Embedded Labeling (signal generation), Soft Martingale Execution (risk control), and Drawdown Dichotomy Quantification (evaluation framework). Variables used in Figure 1: w denotes the moving-average window length (the 14 values of Equation (1)); x denotes the 14-dimensional feature vector of MA deviations supplied to the classifier; f ( x ) denotes the classifier probability output used for the Buy-Grid/Sell-Grid decision under the 0.5 threshold (Section 3.2).
Algorithms 19 00442 g001
Table 2. Comparative analysis of gradient boosting frameworks.
Table 2. Comparative analysis of gradient boosting frameworks.
CriterionXGBoost [20]LightGBM [21]CatBoost [22]
Release Year201620172018
Core InnovationRegularized GBDTGOSS + EFBOrdered Boosting
Prediction Shift PreventionNoNoYes (critical)
Categorical FeaturesManual encodingHistogram-basedNative OTS
Training SpeedModerateVery fastModerate
Native C++/MQL5 ExportPartialPartialYes (native)
Selected for AHFGTSNoNoYes
Table 3. Comparison of five lot-scaling schemes at four cumulative grid levels with b a s e _ l o t = 0.04. Soft Martingale sits between constant-lot and classical 2× (exponential blow-up).
Table 3. Comparison of five lot-scaling schemes at four cumulative grid levels with b a s e _ l o t = 0.04. Soft Martingale sits between constant-lot and classical 2× (exponential blow-up).
SchemeLot Schedule (First 4 Levels)4-Level Cumulative Lotsvs. Base (×)Recovery Speed
Constant0.04, 0.04, 0.04, 0.040.164.0×None
Square-root ( l o t k = 0.04 · √(k + 1))0.04, 0.06, 0.07, 0.080.256.2×Slow
Soft Martingale (this paper)0.04, 0.04, 0.06, 0.080.225.5×Moderate
Fibonacci0.04, 0.04, 0.08, 0.120.287.0×Moderate–fast
Classical 2×0.04, 0.08, 0.16, 0.320.6015.0×Fast (unbounded)
Table 9. Comparative performance matrix.
Table 9. Comparative performance matrix.
MetricAHFGTSRandom GridStatic Grid [6]ML Only [13]
Profit Factor2.85~1.201.2–1.51.3–1.8
Win Rate65.77%~50%55–65%55–60%
Net Annual Return442.6%50–80%30–100%10–50%
Max. Balance DD13.98%30–50%40–60%10–25%
Max. Equity DD79.97%~90%+80–95%15–35%
Regulatory StatusOffshore onlyOffshore onlyOffshore onlyUniversal
Table 10. Drawdown Dichotomy: structural risk decomposition.
Table 10. Drawdown Dichotomy: structural risk decomposition.
Risk MetricValueClassification
Max. Balance Drawdown (MBD)USD 272.59 (13.98%)Low: Well Within Benchmark
Max. Equity Drawdown (MED)USD 1242.09 (79.97%)Extreme: Martingale signature
Drawdown Dichotomy Ratio (DDR)5.72×First formal scalar metric
Min. Account Equity~USD 311.35Peak grid depth exposure
Table 11. Failure modes of AHFGTS calibrated against the deployed grid parameters.
Table 11. Failure modes of AHFGTS calibrated against the deployed grid parameters.
ScenarioAdverse MoveGrid StateProbable Consequence
Sustained one-way trend~550 pipsAll 10 pending levels filled; total 1.24 lots (market + 10 pendings)Margin call highly probable; MED reaches the structural ceiling
Central-bank shock (gap open)500+ pip gapIntermediate pending levels skipped; slippage beyond grid depthEquity discontinuity exceeding stated leverage; outcome broker-dependent
Flash crash with rapid recovery200–300 pip round trip within minutesMultiple levels activate then unwindSurvives if no broker stop-out, but MED spikes 80–90% during the event
Regime change to strong trendPersistent directional driftFrequent grid reversals; win rate falls below the ~54% break-even lineProgressive balance erosion; P&L turns negative over weeks
Disclaimer/Publisher’s Note: The statements, opinions and data contained in all publications are solely those of the individual author(s) and contributor(s) and not of MDPI and/or the editor(s). MDPI and/or the editor(s) disclaim responsibility for any injury to people or property resulting from any ideas, methods, instructions or products referred to in the content.

Share and Cite

MDPI and ACS Style

Cheevirot, S.; Smanchat, S.; Nuchitprasitchai, S. ML-Augmented High-Frequency Grid Trading: Strategy-Embedded Labeling, Soft Martingale Execution, and Drawdown Dichotomy Quantification. Algorithms 2026, 19, 442. https://doi.org/10.3390/a19060442

AMA Style

Cheevirot S, Smanchat S, Nuchitprasitchai S. ML-Augmented High-Frequency Grid Trading: Strategy-Embedded Labeling, Soft Martingale Execution, and Drawdown Dichotomy Quantification. Algorithms. 2026; 19(6):442. https://doi.org/10.3390/a19060442

Chicago/Turabian Style

Cheevirot, Seksin, Sucha Smanchat, and Siranee Nuchitprasitchai. 2026. "ML-Augmented High-Frequency Grid Trading: Strategy-Embedded Labeling, Soft Martingale Execution, and Drawdown Dichotomy Quantification" Algorithms 19, no. 6: 442. https://doi.org/10.3390/a19060442

APA Style

Cheevirot, S., Smanchat, S., & Nuchitprasitchai, S. (2026). ML-Augmented High-Frequency Grid Trading: Strategy-Embedded Labeling, Soft Martingale Execution, and Drawdown Dichotomy Quantification. Algorithms, 19(6), 442. https://doi.org/10.3390/a19060442

Note that from the first issue of 2016, this journal uses article numbers instead of page numbers. See further details here.

Article Metrics

Back to TopTop