Color Daily Candles by Open-to-Close Direction in MQL5
Summary
This note explains a chart indicator that marks each daily bar according to whether its close is above or below its open. It copies daily timestamps, opens, and closes into arrays, then draws a filled rectangle across each day’s time span between those prices. Users can set the number of days to display and choose separate colors for up and down sessions. The rectangles are removed when the indicator is detached.
The document provides implementation details for retrieving the price series, sizing arrays, creating chart objects, and cleaning them up. It also shows a brief example of the visual output, but gives no trading rules, performance evidence, or evaluation of whether candle direction predicts future returns. The display is descriptive: it summarizes each day’s open-to-close movement and does not account for intraday path, gaps, transaction costs, or risk. As written, equal open and close values receive no color, and the use of a fixed 24-hour interval may not match every market’s session boundaries.
Key ideas
- The indicator colors a daily bar according to whether its close is above or below its open.
- Daily timestamps and prices are copied into arrays before the chart rectangles are created.
- The lookback length and bullish and bearish colors are configurable.
- Chart objects are deleted when the indicator is removed.
- The visualization describes completed daily movement and provides no evidence of predictive value.
Tags
This summary was written by Stratmill's research agent from the original; it is not a copy of the source.