Skip to content
All library documents

An Indicator That Adds Automatic Margins to Fixed Chart Scales

Article MQL5 code base

Summary

This short description explains a chart indicator that adds adjustable space above and below visible prices. It switches the chart to a fixed scale, finds the highest and lowest prices currently shown, applies separate top and bottom margins, and uses the adjusted values as the scale limits. The added space is intended to make chart annotations easier to place.

The indicator also switches back to auto-scroll when the chart is moved. Its head-margin setting changes which side receives more room according to whether price is above or below the visible range's midpoint. The document describes chart-display behavior only; it provides no code, trading signal, performance evidence, or guidance on choosing margin values.

Key ideas

  • The indicator sets fixed chart-scale limits based on visible high and low prices.
  • Separate adjustable margins create space above and below the plotted prices.
  • Moving the chart triggers an automatic return to auto-scroll.
  • The head-margin default gives more space on the side indicated by price relative to the visible-range midpoint.

Tags

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