Skip to content
All library documents

Measuring Price Gaps Between the Current Open and Previous Close

Article MQL5 code base

Summary

The document presents a custom chart indicator that measures the difference between each bar’s opening price and the preceding bar’s close. It converts that difference into points by dividing by the instrument’s point size, then places positive and negative readings in separate histogram buffers with different colors. This provides a simple visual measure of the direction and size of gaps between adjacent bars.

The code defines the gap as open minus prior close, so the two plotted series distinguish the signs of that difference. It does not describe a trading rule, explain how to interpret gap size, or provide tests showing that gaps predict subsequent returns. The calculation compares consecutive bars, which may represent different time intervals depending on the chart, and it does not account for spread, liquidity, or other execution costs. The source is a compact indicator implementation rather than a strategy evaluation.

Key ideas

  • The indicator measures the current bar’s open relative to the previous bar’s close.
  • It expresses the gap in points by dividing the price difference by the instrument’s point size.
  • Positive and negative gaps are displayed in separate histogram buffers.
  • The document provides indicator code but no signal rules or performance evidence.
  • Gap readings alone do not account for execution conditions or costs.

Tags

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