Skip to content
All library documents

Testing Candlestick Patterns with an OpenCL Backtester

Article MQL5 articles

Summary

This article builds a historical tester for four candlestick patterns: bullish and bearish pin bars and engulfing patterns. It first defines conditions for detecting each pattern on closed bars, then implements an MQL5 Expert Advisor that opens trades in the indicated direction and applies fixed take-profit, stop-loss, and holding-time rules. The same strategy is implemented with OpenCL to test parameter combinations in parallel, with results compared against MetaTrader’s built-in tester.

The reported comparisons cover EURUSD, GBPUSD, and USDJPY across multiple timeframes and test periods. They indicate that the OpenCL approach can greatly reduce optimization time in the described setup. The author frames it as a rough screening tool: testing uses one-minute OHLC data and omits swaps, commissions, trailing stops, and limits on concurrent positions. It also handles cross rates incorrectly, so its speed does not make its estimates suitable as a full trading simulation.

Key ideas

  • The strategy detects four pin bar and engulfing patterns using conditions on three closed candles.
  • Trade direction follows the detected pattern, with fixed stop loss, take profit, and maximum holding time.
  • The OpenCL tester evaluates pattern parameters in parallel and is compared with MetaTrader’s tester.
  • The performance examples span three forex pairs, multiple timeframes, and test periods.
  • One-minute OHLC modeling and omitted trading costs and constraints limit the accuracy of results.

Tags

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