136 lines
5.4 KiB
Markdown
136 lines
5.4 KiB
Markdown
# Article-22342-Liquidity-Spectrum-Volume-Profile-Indicator
|
|
|
|
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
|
|
|
|
This project documents and reconstructs the MQL5 indicator described in the article about building a Liquidity Spectrum Volume Profile for MetaTrader 5.
|
|
|
|
The indicator analyzes a configurable lookback window, splits the observed price range into equal bins, accumulates volume into those bins based on candle close prices, normalizes the result, and draws:
|
|
|
|
- volume profile rectangles,
|
|
- Point of Control (POC) / liquidity lines,
|
|
- supporting chart objects positioned using bar-offset to datetime conversion.
|
|
|
|
The article emphasizes deterministic data access through `Copy*` functions and object lifecycle management via a dedicated prefix.
|
|
|
|
## Original Article
|
|
|
|
- **Article ID:** 22342
|
|
- **Title:** Liquidity Spectrum Volume Profile Indicator
|
|
- **Author:** Israel Pelumi Abioye
|
|
- **Publication date:** 2026.05.01
|
|
- **Category:** Trading / Indicators
|
|
- **URL:** https://www.mql5.com/en/articles/22342
|
|
|
|
## Repository Purpose
|
|
|
|
This repository should be treated as a reference/reconstruction project derived from the article text and code excerpts.
|
|
|
|
Its purpose is to preserve the implementation approach described in the article:
|
|
|
|
- stable lookback data retrieval with `CopyHigh`, `CopyLow`, `CopyClose`, `CopyTime`, and volume copy functions,
|
|
- price-range segmentation into bins,
|
|
- close-price-based volume assignment,
|
|
- normalization of bin intensity,
|
|
- chart-object rendering for profile boxes and POC lines,
|
|
- cleanup of indicator-created objects using a fixed prefix.
|
|
|
|
## Key Concepts
|
|
|
|
- Volume profile over a fixed lookback
|
|
- Equal-width price binning
|
|
- Volume assignment by candle close price
|
|
- Tick volume preferred, real volume fallback
|
|
- Normalization against the maximum bin volume
|
|
- Profile width scaling with a fixed maximum width
|
|
- POC detection using a threshold on normalized bin strength
|
|
- Chart rendering with `OBJ_RECTANGLE`, `OBJ_TREND`, `OBJ_VLINE`, `OBJ_TEXT`
|
|
- Object namespace isolation with `OBJ_PREFIX`
|
|
- Conversion from bar offsets to `datetime` for drawing placement
|
|
|
|
## Algorithm / Architecture Summary
|
|
|
|
1. **Input handling**
|
|
- User inputs include lookback length and toggles for profile and liquidity lines.
|
|
- The article also references configurable constants such as number of bins, maximum profile width, object prefix, and POC threshold.
|
|
|
|
2. **Data acquisition**
|
|
- Historical data is copied explicitly using terminal copy functions rather than relying only on `OnCalculate` arrays.
|
|
- Arrays are configured as series.
|
|
- Volume retrieval prefers tick volume and falls back to real volume.
|
|
|
|
3. **Range detection**
|
|
- Highest high and lowest low over the lookback define the analyzed price range.
|
|
- The implementation aborts if the range is invalid.
|
|
|
|
4. **Bin construction**
|
|
- The range is divided into `N_BINS` equal price intervals.
|
|
- A `bins[]` array stores accumulated volume for each interval.
|
|
|
|
5. **Volume accumulation**
|
|
- For each bin, all candles in the lookback are scanned.
|
|
- A candle contributes its volume to a bin when its close price falls within the bin range, with a one-step overlap (`lower - step` to `upper + step`) described in the article.
|
|
|
|
6. **Normalization**
|
|
- The maximum bin volume is detected.
|
|
- Each bin width is scaled relative to that maximum using `MAX_BAR_WIDTH`.
|
|
|
|
7. **Drawing**
|
|
- Boxes are drawn with helper functions that create-or-update chart objects.
|
|
- POC lines are drawn for bins above `POC_THRESHOLD`.
|
|
- Time placement uses a `BarsAgoToTime(...)` utility to support offsets both inside and beyond copied history, including limited future projection.
|
|
|
|
8. **Lifecycle**
|
|
- Recalculation is triggered on initialization and on new bars.
|
|
- All indicator-created objects are removed on deinitialization via prefix filtering.
|
|
|
|
## Mentioned or Attached Files
|
|
|
|
### Explicitly attached files
|
|
|
|
No attached source files were available in the processed input.
|
|
|
|
### Files only mentioned in text
|
|
|
|
The article provides inline MQL5 code fragments for an indicator implementation, including functions and structures such as:
|
|
|
|
- `RecalcVolumeProfile()`
|
|
- `RecalcVolumeProfile(bool &need_redraw)`
|
|
- `DeleteAllObjects()`
|
|
- `BarsAgoToTime(...)`
|
|
- `DrawBox(...)`
|
|
- `DrawTrend(...)`
|
|
- `OnInit()`
|
|
- `OnDeinit(...)`
|
|
- `OnCalculate(...)`
|
|
|
|
Because no standalone file list was provided, the exact repository filenames are unknown.
|
|
|
|
## Statistics
|
|
|
|
- **Article ID:** 22342
|
|
- **Language:** en
|
|
- **Sections identified:** 4
|
|
- **Code examples present:** Yes
|
|
- **Images/figures referenced:** Yes
|
|
|
|
## Tags
|
|
|
|
`mql5`, `metatrader-5`, `indicator`, `volume-profile`, `liquidity-spectrum`, `poc`, `chart-objects`, `tick-volume`
|
|
|
|
## Difficulty
|
|
|
|
Intermediate
|
|
|
|
## Limitations
|
|
|
|
- The full original source code was not provided as attached repository files in the processed input.
|
|
- The README is based on article text and embedded code excerpts only.
|
|
- Author, publication date, and category were not available in the provided input and therefore cannot be stated with certainty.
|
|
- Exact final file names, folder structure, and any additional helper modules are unknown.
|
|
- Some examples in the article appear incremental and demonstrative; they may not represent a single final compilable source file without integration work.
|
|
|
|
## Reference
|
|
|
|
Original article: https://www.mql5.com/en/articles/22342
|