Skip to content
All library documents

Detecting Nested Inside Bar Patterns and Displaying Them on Charts

Article MQL5 articles

Summary

This article extends a trading library to find and display Price Action patterns, focusing on the two-bar Inside Bar formation. It distinguishes a mother bar from one or more smaller defining bars contained within its range, allowing nested formations to share the same mother bar. The implementation records the mother bar's opening time so the full span of a nested pattern can be identified and outlined. It also adds pattern-type flags to bar objects, enabling a bar to store multiple detected formations and support sorting and retrieval by pattern type.

The article describes changes to library classes and chart graphics, including bitmap objects used to draw frames around pattern bars, and explains how information panels can show detected patterns when the user hovers over a bar. A test run is reported to display nested patterns and overlapping Pin Bar and Inside Bar labels as intended. This is a software and visualization demonstration; the text does not evaluate whether Inside Bar patterns predict market direction or produce profitable trades, and it notes that bitmap drawing may introduce delays.

Key ideas

  • An Inside Bar formation compares two adjacent bars: a mother bar and a defining bar contained within it.
  • Nested formations can share one mother bar while having multiple defining bars.
  • Recording the mother bar's opening time helps identify and frame the full span of a nested pattern.
  • Pattern-type flags let a bar store multiple detected patterns and support filtering or sorting by pattern.
  • The demonstration confirms chart display behavior, but does not test the pattern's predictive value or profitability.

Tags

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