Skip to content
All library documents

Detecting and Displaying Price Gaps Between Adjacent Bars

Article MQL5 code base

Summary

The indicator detects gaps between the high and low prices of neighboring bars. It marks upward and downward gaps with directional arrows, can shade each gap region with a rectangle, and draws upper and lower boundary lines that an Expert Advisor can access. Users can set a minimum gap size in points, toggle gap-area rectangles, and choose separate colors for upward and downward gaps.

A gap on the current bar appears immediately. If price later closes the gap, the arrows and boundary lines are removed, while the colored rectangle remains as a historical visual marker. The document explains the display behavior and configurable inputs, but does not define a trading strategy, discuss market-specific interpretation, or provide tests or performance evidence. Its use is therefore descriptive and charting-oriented.

Key ideas

  • The indicator identifies gaps between the high and low prices of consecutive bars.
  • Directional arrows distinguish upward gaps from downward gaps.
  • Optional rectangles show gap regions, and boundary lines expose the gap levels to an Expert Advisor.
  • A minimum size threshold and display colors can be configured.
  • When price fills a gap, the arrows and lines disappear while the rectangle remains.

Tags

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