Article-24683-Creating-Cust.../README.md

151 lines
No EOL
6.8 KiB
Markdown

# Article-24683-Creating-Custom-Indicators-MQL5-Volume-Profile-Heatmap
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.
![Article preview](https://c.mql5.com/2/277/24683-creating-custom-indicators-in-mql5-part-12-mapping-liquidity_1200x628.jpg)
## Overview
This repository is derived from the MQL5 article about building a custom MetaTrader 5 indicator that maps liquidity using a volume profile heatmap. The article explains how to bin volume by price across a rolling window, render the result as heat-colored cells behind candles, and expose computed levels such as point of control and value area through indicator buffers.
The project serves as a reference for developers who want to study chart-side volume-at-price visualization, canvas-based rendering in MQL5, and the design of custom indicators that combine computation, overlays, alerts, and reusable output buffers.
## Original Article
- **Article ID:** 24683
- **Title:** Creating Custom Indicators in MQL5 (Part 12): Mapping Liquidity with a Volume Profile Heatmap
- **Author:** Allan Munene Mutiiria
- **Publication date:** Not available
- **Categories:** Indicators, Examples Indicators
- **Article URL:** https://www.mql5.com/en/articles/24683
- **Author URL:** https://www.mql5.com/en/users/29210372
## Repository Purpose
This repository exists to preserve and organize the technical ideas presented in the source article in a repository-friendly form.
A reader can use it to:
- understand how a volume profile heatmap indicator can be structured in MQL5
- learn how rolling window volume-at-price aggregation works
- study point of control and value area extraction from binned volume
- examine canvas-based rendering patterns for custom chart overlays
- reuse the article as a design reference for related custom indicators or trading tools
Because the repository is article-derived, its completeness depends on the files actually attached by the article author and the processed input available here.
## Key Concepts
- Indicators
- Example Indicators
- Volume Profile
- Liquidity Mapping
- Volume at Price
- Point of Control
- Value Area
- Canvas Rendering
- Indicator Buffers
- Tick Volume and Real Volume
## Algorithm / Architecture Summary
The article describes a custom indicator architecture with both analytical and rendering components.
1. **Define indicator structure**
- The indicator works in the chart window.
- It uses six buffers to publish derived values for other programs.
- It includes a canvas-based drawing layer for custom rendering.
2. **Choose volume source and visual settings**
- The indicator can use either tick volume or real volume.
- Inputs control profile depth, bin count, value area percentage, heat opacity, side profile placement, level visibility, and alerts.
3. **Build a rolling volume profile**
- For each processed bar, the indicator looks back over a configured rolling window.
- It finds the high and low of that window.
- The full price range is divided into horizontal bins.
4. **Distribute volume into bins**
- In the main mode, each bar’s volume is spread across the bins touched by its high-low range, proportionally to overlap.
- An alternative mode places volume around the close rather than fully across the range.
5. **Find the point of control**
- After all bars in the window contribute to the profile, the indicator identifies the bin with the highest accumulated volume.
- This bin becomes the point of control.
6. **Compute the value area**
- Starting from the point of control, the indicator expands upward or downward by choosing the larger neighboring bin each step.
- Expansion continues until the configured share of total volume is covered.
7. **Split liquidity above and below price**
- The profile is divided relative to a reference price, typically the bar close.
- This produces above/below liquidity percentages and an imbalance value.
8. **Store historical heat columns**
- Closed bars are reduced to precomputed cell colors and stored in a ring buffer.
- This limits memory growth and speeds up redraws.
9. **Render the heatmap**
- Historical columns are painted behind visible candles.
- Cell color depends on relative volume strength, side of current price, and candle visibility rules.
10. **Render live overlays**
- A live side profile is drawn to the right of the current bar.
- Point of control and value area lines are shown with tags.
- Readouts display liquidity above/below current price and imbalance.
11. **Optimize redraw behavior**
- A cached base layer stores the expensive historical heatmap.
- Overlay-only redraws are used when only live elements change.
- Full redraws occur when chart scaling, scrolling, or sizing changes.
12. **Publish outputs and alerts**
- Buffers expose point of control, value area high/low, liquidity below, liquidity above, and imbalance.
- Optional alerts trigger when a close enters the point-of-control bin.
## Mentioned or Attached Files
### Explicitly attached files
- An attached ZIP archive is available: https://www.mql5.com/en/articles/download/24683_275964.zip?s=ec3545da496794b81a3ce7fda38f52c6c9a1eb17a51f806f8da9c60ee09a86b7&t=1792497555
- The processed input does not provide the internal file list of the ZIP archive.
### Files mentioned in the article text
- `Volume Profile Heatmap.mq5`
- `Canvas/Canvas.mqh`
## Statistics
- **Word count:** Not available
- **Reading time:** Not available
- **Image count:** Not available
- **Code block count:** Not available
- **File count:** Not available
## Tags
- mql5
- metatrader-5
- indicators
- examples-indicators
- difficulty-advanced
## Difficulty
**Advanced**
Reason: the article combines nontrivial volume-at-price aggregation, value area logic, ring-buffer state management, custom canvas rendering, alpha blending, redraw optimization, and full event-driven indicator lifecycle handling in MQL5.
## Limitations
- The repository is derived from article content and may not represent the full original project unless the attached ZIP contents are present and extracted.
- The processed input confirms that a ZIP archive exists, but its internal file list was not provided here.
- Implementation completeness depends on files actually attached or supplied by the article author.
- This should be treated as a technical reference or reconstruction project unless verified source files are included in the repository.
- The article describes rendering behavior and architecture in detail, but production readiness should not be assumed from the article alone.
## Reference
- Original article: https://www.mql5.com/en/articles/24683
- Author profile: https://www.mql5.com/en/users/29210372