This repository is an article-derived reference project based on the original MQL5 article. It does not claim to reproduce the full original source code unless files are explicitly attached.
## Overview
Reference repository for an MQL5 chart-object detection framework that converts manually drawn analytical objects into structured data consumable by Expert Advisors.
The article describes a lightweight detector built around raw MQL5 chart-object APIs such as `ObjectsTotal()`, `ObjectName()`, `ObjectGetInteger()`, and `ObjectGetDouble()`. It focuses on detecting analytical objects like trendlines, rectangles, channels, horizontal lines, vertical lines, and selected Fibonacci objects, then normalizing their coordinates into a single structure.
## Original Article
- Article ID: 22540
- Author: Clemence Benjamin
- Publication date: 2026.05.17
- Category: Trading Systems
- URL: https://www.mql5.com/en/articles/22540
## Repository Purpose
- Preserve the article’s described implementation as a reusable reference.
- Provide a compact reconstruction target for:
-`CChartObjectDetector`
-`SChartObjectInfo`
- a simple polling-based test EA
- Help developers integrate manually drawn chart objects into algorithmic logic for alerts, validation, or trading decisions.
## Key Concepts
- Iteration over all chart objects via object index
- Filtering analytical objects from non-analytical UI/chart elements
- Normalization of heterogeneous object geometries into one structure
- Use of indexed properties:
-`OBJPROP_TIME`
-`OBJPROP_PRICE`
- Support for multiple object classes:
-`OBJ_TREND`
-`OBJ_RECTANGLE`
-`OBJ_CHANNEL`
-`OBJ_HLINE`
-`OBJ_VLINE`
-`OBJ_FIBO` and related Fibonacci variants in extraction logic
- Periodic polling from an EA using `OnTick()` with throttling
## Algorithm / Architecture Summary
The article presents a three-stage pipeline:
1.**Filter**
- Enumerate all chart objects on a target chart.
- Keep only supported analytical object types.
2.**Extract**
- Read time/price anchors using raw property access.
- Use indexed access for multi-point objects.
- Handle object-type-specific extraction rules:
- trend/channel/rectangle: two anchors
- horizontal line: price only
- vertical line: time only
- Fibonacci: anchor points only in this version
3.**Store**
- Populate a normalized `SChartObjectInfo` record with:
- object name
- numeric type
- readable type name
-`time1`, `time2`
-`price1`, `price2`
The detector is encapsulated in `CChartObjectDetector`, with an `Init()` method for chart binding and a `Detect()` method returning an array of normalized objects.
The test EA initializes the detector on the current chart and logs detected objects every 5 seconds.
## Mentioned or Attached Files
### Explicitly attached files
-`ChartObjectDetector.mqh` — include file containing the detection class and normalized object structure
-`ObjectDetectionTestEA.mq5` — test Expert Advisor that polls detection results and prints them to the Experts log
### Files mentioned in text
-`MQL5/Include/ChartObjectsAlgorithms/ChartObjectDetector.mqh` — target include path referenced by the article
-`MQL5/Experts/ObjectDetectionTestEA.mq5` — target EA path referenced by the article
- The full original repository structure is not available unless the article attachments are separately provided in this project.
- This is an article-derived reference/reconstruction project.
- Fibonacci handling is incomplete in the described version:
- anchor points are read
- level extraction is deferred to a later part
- The detector uses polling and does not yet react to chart object events automatically.
- Non-analytical objects such as labels, buttons, and other UI elements are intentionally ignored.
- The article text shows a minor inconsistency between extraction logic and filtering scope for some Fibonacci variants; implementation should follow the actual attached code if present.
## Reference
Original MQL5 article: https://www.mql5.com/en/articles/22540