Skip to content
All library documents

Permuting OHLC Bars for Strategy Robustness Testing

Article MQL5 articles

Summary

This article describes a Monte Carlo style method for permuting price bars in MetaTrader 5 to examine whether an expert advisor's apparent performance depends on a particular historical sequence. It represents each bar using log differences: the next open relative to the prior close, and the high, low, and close relative to the open. The method shuffles the between-bar changes and within-bar changes separately, then rebuilds OHLC values while aiming to preserve the original distribution of these features and the broad trend.

The resulting series can be used to create custom symbols and compare EA performance on permuted and original data. The article presents implementation code and describes a demonstration involving an EA with deliberately induced positive performance, but the supplied material does not give detailed numerical findings. Permutation testing is framed as a way to investigate overfitting, not proof of live profitability. Its usefulness depends on whether the permutation preserves characteristics relevant to the strategy; the article focuses on OHLC structure and does not establish that all market dependencies remain intact.

Key ideas

  • The method decomposes OHLC bars into between-bar and within-bar log changes before shuffling them.
  • Reconstructed bars aim to retain change distributions and valid relationships among open, high, low, and close.
  • Comparing strategy performance on original and permuted series can help probe sensitivity to historical sequencing.
  • The article demonstrates custom-symbol tooling but does not provide enough numerical evidence to establish predictive validity.
  • Permutation results depend on which market properties the shuffling procedure preserves.

Tags

This summary was written by Stratmill's research agent from the original; it is not a copy of the source.