Loading…

Candle Anatomy Teacher

Candlestick education material almost always shows one idealised doji, one idealised hammer, drawn to look clean and unambiguous. Real price bars are messier, and what counts as a "small body" or a "long wick" is not the same fraction of a bar's range on every symbol and timeframe - a small body on an index CFD is not the same proportion as a small body on a JPY cross, and neither is fixed across timeframes on the same symbol. This script measures the actual body, upper wick, lower wick and full range of a window of this symbol's own closed bars, computes averages in both price units and points, and reports what fraction of bars qualify as a doji under a configurable body/range threshold. It also buckets every bar's body-to-range ratio into five bands (0-20% through 80-100%) and prints a simple text-bar histogram, so the shape of the real distribution is visible at a glance rather than described only in numbers. Every measurement is defined once, in one function, and reused everywhere it is needed, so "doji" and "body size" mean exactly the same thing throughout the report - there is no second, slightly different definition hiding in the histogram code. Notes and limitations - Requires enough loaded chart history for the requested window; if fewer than 10 closed bars are available the script reports this and exits rather than producing statistics from an unreasonably small sample. - This is a descriptive statistics tool, not a pattern-recognition or signal-generation tool - it does not claim any bucket or doji count predicts future price movement. - The five-bucket histogram resolution is fixed at five bands for readability; it will not show finer structure within a single band.

Script · MT5 · v1.0 · Free

About Candle Anatomy Teacher

Candle Anatomy Teacher is a script for MetaTrader 5. It marks candlestick patterns. It has 2 settings, such as Bars to analyse and Doji body ratio. MQL source code included.

Files in the download: CandleAnatomyTeacher.ex5, CandleAnatomyTeacher.mq5, CandleAnatomyTeacher.txt.

Settings

SettingDefaultWhat it does
Bars to analyse500How many closed bars to analyse (shift 1 .. N)
Doji body ratio0.10Body/range ratio at or below which a bar counts as a doji

How to install

  1. Download the ZIP from your PolyMaria library and unzip it.
  2. In MetaTrader 5 open File → Open Data Folder, then go to MQL5 → Scripts.
  3. Copy the .mq5 file(s) there. Put any .mqh files in MQL5 → Include.
  4. Open the .mq5 file in MetaEditor and press Compile (F7) if MetaTrader does not show it.
  5. Drag the script onto a chart to run it once.

Download the PDF guide

Tags: Candlestick Patterns · MT5 Script · MQL5 Source Code

MQL4 & MQL5 scripts · PolyMaria