You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
Feature Engineering for ML (Part 9): Structural Break Tests in Python
The preceding articles in this Feature Engineering for ML series built features from the structure of time itself: Part 1 established fractional differentiation as a way to preserve long memory in a stationary series; Part 3 embedded the trading calendar into Fourier coordinates; and Part 5 compressed tick-level order flow into bar-indexed microstructural statistics. This article builds features from a qualitatively different question: not what the current bar looks like, but whether the data-generating process that produced it has recently changed.
Feature Engineering for ML (Part 10): Structural Break Tests in MQL5
Part 9 of this series implemented the structural break test suite from AFML Chapter 17 in Python, covering the Chu-Stinchcombe-White CUSUM test, the Chow-Type Dickey-Fuller test, SADF across six regression models, and two robustifying variants (QADF and CADF). This article ports the three core tests — CSW, Chow, and SADF — to MQL5 as a single include file, CStructuralBreaks.mqh, placed in MQL5/Include/StructuralBreaks/. The sub- and super-martingale tests (SM-Exp and SM-Power) are included as well, rounding the suite to five statistics per bar.
The MQL5 implementation departs from the Python version in one structural decision that is worth stating immediately: SADF uses a rolling lookback window rather than a full expanding window. In Python, the expanding window is viable because the computation runs once offline on a fixed dataset. In an EA that recalculates on each new bar, an expanding window scales as O(T²) with the number of completed bars. At T = 1,000 bars — a modest two-year daily series — the expanding window performs 15× more inner-loop operations than a 252-bar rolling window. At T = 5,000 bars it performs 400× more. The rolling window is not a compromise; it changes the interpretation of the statistic slightly, and that change is documented in Section 6.
Feature Engineering for ML (Part 11): Fractal Features in Python
The preceding articles in this Feature Engineering for ML series derived features from price geometry (Part 1), from the trading calendar (Part 3), from the bid-ask spread and price impact (Parts 5–6), from the information content of the trade-direction sequence (Part 7), and, most recently, from the timing of regime changes themselves (Part 10). This eleventh installment returns to price geometry, but at a coarser structural level: the swing highs and swing lows that define support, resistance, and trend.
Working with ONNX Models in MQL5 (Part 1): Decoding the Model File with a Protobuf Parser
MetaTrader 5 can load a trained neural network and run it. Pass the model file path to the ONNX (Open Neural Network Exchange) API, feed a tensor, and receive predictions. The terminal does not reveal what the ONNX file contains: the layer count, required input shape, or which weights were saved. When outputs look wrong, you cannot quickly tell whether the issue is in the features, tensor shapes, or the file itself, because the model is treated as an opaque binary. This article targets MetaQuotes Language 5 (MQL5) developers and algorithmic traders who train models elsewhere and want to inspect them inside the terminal, without leaving MetaTrader 5 and without a single external library.
Python-MetaTrader 5 Strategy Tester (Part 06): MQL5-Style Backtesting for Python Expert Advisors
When you are developing trading robots for MetaTrader 5 in Python and face a familiar split: for live trading you call the MetaTrader5 package, while for backtesting you must build and maintain a separate tester layer with different initialization, data sources and APIs. The result is duplicated logic, brittle synchronization between two code paths, and wasted time every time you change your strategy. What we want instead is an MQL5-like workflow in Python: a single EA-style main() (OnTick) implementing trading logic once, and the ability to run that same code against historical data or in the live market without rewriting it.
This article shows how the StrategyTester5 framework achieves that: it provides a VirtualMetaTrader5 that mirrors the MetaTrader5 API, a simple mt5 variable swap to switch environments, and a run_backtesting() function that replays market data and returns a TesterStats object. The goal is practical: write your strategy once, then choose whether to run it on history or on a live account.
Forum on trading, automated trading systems and testing trading strategies
MetaTrader5 Python history_orders_get/history_deals_get — authoritative time semantics
Alain Verleyen, 2026.09.25 15:05
Forum on trading, automated trading systems and testing trading strategies
MetaTrader5 Python history_orders_get/history_deals_get — authoritative time semantics
Savane Oumar, 2026.09.25 13:10
Thank you, this is very important.
To make sure I understand correctly, does your statement also apply specifically to history_orders_get() and history_deals_get() , including date_from , date_to , ORDER_TIME_SETUP , ORDER_TIME_DONE , DEAL_TIME and the corresponding *_MSC fields?
Also, do you know whether date_to is inclusive or exclusive, and at what precision?
Finally, since you reported the datetime/timezone documentation issue to MetaQuotes, is there any official MetaQuotes ticket, updated documentation page, or confirmation that can be cited?
Thank you.
The same applies to the whole API.
You need to use UTC timezone in your parameters, and the returned data are broker server time.
Working with ONNX Models in MQL5 (Part 2): Drawing the Model Graph on an Interactive Chart Panel