Profile Ledge Detector
Every profile tool in this catalogue already finds the point of control - the single busiest price. A ledge is a different shape entirely: not a spike, a plateau. This scans the merged tick-volume profile of a chosen broker-time session across InpLookbackDays calendar days for runs of consecutive buckets whose volume stays within InpFlatnessRatio of each other (the run's own highest bucket divided by its lowest stays under that ratio), extending each run as far as it can while that flatness test still holds. A flat run only counts as a genuine ledge once it is at least InpMinLedgeBuckets wide AND the bucket immediately outside at least one end falls to no more than InpDropRatio times the run's own average volume - the abrupt drop-off that distinguishes a real ledge from merely where the profile happens to taper off gradually or where the scanned range simply ends. Buckets are weighted by tick volume using the standard bar-overlap spread used throughout this catalogue, since MT4 has no true per-price-level volume to read directly. Each qualifying ledge draws as a shaded box across its price range, with a dashed line marking whichever edge (or edges) showed the abrupt drop - the wall a market-profile trader would read as support or resistance built from where trade concentrated and then sharply thinned out. Notes and limitations - Every volume figure is MT4 tick volume (price update count), never real traded contracts or lots. - A ledge at either extreme of the scanned price range is only checked against its one existing neighbour; reaching the edge of the scanned range itself also counts as a qualifying "drop" there, which can occasionally mark the very top or bottom bucket of a session as a ledge even without a true volume cliff. - Rebuilds once per new bar, not every tick; a large InpLookbackDays on a low timeframe increases rebuild cost accordingly. - No trade or stop-loss logic - visual analysis only.
Indicator · MT4 · v1.0 · Free
About Profile Ledge Detector
Profile Ledge Detector is an indicator for MetaTrader 4. It has 10 settings, such as Session start hour, Session end hour and Lookback days. MQL source code included.
Files in the download: ProfileLedgeDetector.mq4, ProfileLedgeDetector.txt.
Settings
| Setting | Default | What it does |
|---|---|---|
| Session start hour | 8 | Session start hour (broker time, 0-23) |
| Session end hour | 16 | Session end hour (broker time, 0-23) |
| Lookback days | 10 | Calendar days of session instances merged into the profile |
| Bucket pips | 4.0 | Bucket width, in pips |
| Max buckets | 250 | Hard cap on bucket count (performance guard) |
| Min ledge buckets | 3 | Minimum consecutive buckets to call a run a ledge |
| Flatness ratio | 1.35 | Max(volume)/min(volume) allowed inside a ledge run |
| Drop ratio | 0.45 | Neighbour bucket must fall to at most this fraction of the ledge average |
| Ledge color | clrGoldenrod | Ledge box colour |
| Drop edge color | clrRed | Drop-off edge line colour |
How to install
- Download the ZIP from your PolyMaria library and unzip it.
- In MetaTrader 4 open File → Open Data Folder, then go to MQL4 → Indicators.
- Copy the .mq4 file(s) there. Put any .mqh files in MQL4 → Include.
- Open the .mq4 file in MetaEditor and press Compile (F7) if MetaTrader does not show it.
- Drag the indicator from the Navigator onto a chart and adjust the settings.
Tags: Volume · Trading Sessions · MT4 Indicator · MQL4 Source Code