Price Action Scanner is a free, instant-download MT4 indicator that automatically scans your chart history and draws colored rectangles around eleven distinct candlestick price-action setups, so you don’t have to eyeball every bar manually. Each pattern family has its own toggle and its own color, which makes it as much a screening tool as a plotting one.
What It Actually Detects
The indicator works down through candidate patterns in a fixed priority order — the first one that matches a bar wins, so overlapping setups on the same bar don’t get double-tagged. The pattern families, based directly on the detection functions in the code, are:
- Pin Bar — requires a body that closes very near the candle’s high or low (within
closeToHighLowPoints), a shadow at leastshadowToBodyKoeftimes the body size, and a nose that pokes at leastnoseOutsidePercent% beyond the prior bar’s extreme. - Wide Range Bar (WRB) — a three-candle setup where the middle bar’s body is at least
BodyRatiotimes larger than both neighbors, with a minimumHighLowClearance% gap between the outer bars’ high and low. - PPR — a three-candle reversal where the current close breaks the prior bar’s opposite extreme, the middle bar makes a lower low (or higher high) than both its neighbors, and the third bar closes against the reversal direction.
- OVB (outside/engulfing bar) — the current bar’s high and low both exceed the prior bar’s range, with its body direction and close confirming the same side.
- Rails — two consecutive candles with similarly sized but opposite-colored bodies (within
bodyGreatPercents% of each other) where each body is at leastbodyToHeightPercents% of its own candle’s total range. - TB (twin bar high/low) — a directional bar followed by a run of bars with equal highs (or lows) within
equalPipsTBpoints. - DB (double top/bottom) — similar equal-high/equal-low run logic to TB, gated by
equalPipsDB, triggered off a directional close through the prior bar’s extreme.
Each detected pattern is stored in an internal array and drawn once as a filled or outlined rectangle (ShowRectangle()) spanning from the pattern’s start bar to its end bar, using the low/high of the pattern’s range.
How to Read the Chart
Each pattern family has its own bull/bear color pair, so you can tell at a glance which setup and which direction triggered just from the rectangle’s color and the input labeled for that family. By default (OverlapingPattern = NO) the scanner won’t draw a new rectangle over a time range that’s already occupied by a previously plotted pattern, which keeps the chart from becoming a wall of overlapping boxes.
Key Inputs
- indBarsCount (default 1000) — how many bars of history the scanner processes.
- OverlapingPattern (default NO) — whether a new pattern is allowed to draw over a time range already claimed by an earlier one.
- equalPipsDB / equalPipsTB (default 3 each) — the point tolerance for two highs or lows to count as “equal” for the DB and TB patterns.
- bodyGreatPercents (default 10) — maximum percentage difference allowed between two candle bodies for the Rails pattern.
- bodyToHeightPercents (default 20) — minimum ratio of a candle’s body to its full high-low range, required for Rails.
- closeToHighLowPoints (default 3) — how close (in points) the close must sit to the candle’s high or low for a Pin Bar.
- shadowToBodyKoef (default 3.0) — minimum shadow-to-body ratio required for a Pin Bar.
- noseOutsidePercent (default 75.0) — how far the Pin Bar’s shadow must extend past the prior bar’s extreme.
- BodyRatio (default 1.5) — how much larger the middle candle’s body must be versus its neighbors for a Wide Range Bar.
- HighLowClearance (default 20) — minimum clearance percentage between the outer bars for a Wide Range Bar.
Each pattern family also has its own bull/bear color inputs (for example colorBullsPINBAR/colorBearsPINBAR, colorBullsRails/colorBearsRails) so every rectangle can be recolored independently.
Repaint Behavior
The scanner is non-repainting. Its pattern-matching function is only ever invoked on bars that have already fully closed (the recalculation loop deliberately starts at index 1, skipping the still-forming current bar), and every comparison it makes looks at that bar plus older, already-settled bars — never a bar that hasn’t printed yet. Once a rectangle is drawn, its object name is generated from the pattern’s fixed timestamp, and the drawing function explicitly checks whether that name already exists before creating anything, so a pattern is never silently redrawn, moved, or reclassified after the fact.
Limitations
- This is a screening/marking tool, not a signal generator — it doesn’t rank patterns by quality or tell you which one is the highest-probability setup, and it fires on every historical instance meeting the geometric rules, valid or not.
- With
OverlapingPattern = NO, an earlier lower-priority pattern can block a later, arguably more relevant pattern from being drawn on the same bars. - The pattern-priority order is fixed in code (Pin Bar first, then WRB, PPR, OVB, Rails, TB, DB) — you can’t reorder which pattern wins on a contested bar without editing the source.
- Some threshold defaults (e.g. a 3-point equality tolerance) are tuned to a specific broker’s point size and spread; they may need adjusting for 5-digit brokers or wider-spread symbols.

