Loading…

Order Block Respect Rate Study

"Order block" gets used loosely across trading content, usually without a precise, testable definition. This script uses one fixed rule: an impulsive move is a run of InpImpulseBars consecutive bars whose net displacement is at least InpImpulseMultiplier times the average single-bar range of the InpAvgRangePeriod bars immediately before it. The order block is the nearest candle of the OPPOSITE colour found by scanning backward from the impulse's start, up to InpBlockSearchBars bars - the last down candle before an impulsive up move, or the last up candle before an impulsive down move. Its own high/low range is the block's zone. Impulsiveness is measured against the instrument's OWN recent volatility, never a fixed pip count, so the same inputs behave sensibly on a quiet pair and on a fast-moving index without retuning per symbol. The study then scans forward from the impulse for the FIRST bar whose range overlaps the block zone at all - a wick reaching back in counts as a return visit, since that is the market physically revisiting the zone. A fixed number of bars after that visit, the close is checked: still on the impulse side of the block by a threshold (respected), or closed through the far side by that threshold (failed). Results are reported separately for bullish and bearish blocks, with the sample size that was actually revisited shown alongside the respect percentage. Notes and limitations - A block with no qualifying opposite-colour candle within InpBlockSearchBars is skipped rather than forced onto a same-colour bar. - Blocks never revisited within InpReturnScanBars bars are excluded from the respect percentage but are still written to the CSV as "unvisited" if InpSaveCsv is on. - This is a descriptive study, not a trading signal, and not the only possible order-block definition - it is one concrete, reproducible rule chosen so results can be checked and reproduced, not the industry's only interpretation of the term. - It does not account for spread or slippage, and small revisited-sample sizes should be treated with appropriate scepticism.

Script · MT5 · v1.0 · Free

About Order Block Respect Rate Study

Order Block Respect Rate Study is a script for MetaTrader 5. It can alert you with a pop-up, sound, email or push message. It has 12 settings, such as Symbol, Timeframe and Max bars. MQL source code included.

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

Settings

SettingDefaultWhat it does
SymbolSymbol to study, blank = this chart's symbol
TimeframePERIOD_H1Timeframe to study
Max bars6000Most recent bars to include
Impulse bars3Bars spanning one impulsive move
Impulse multiplier2.5Net displacement required, as a multiple of the average single-bar range
Avg range period20Bars used to compute the average single-bar range baseline
Block search bars5Bars searched backward from the impulse for the opposite-colour candle
Return scan bars500Bars forward searched for the first return visit to the block
Reaction bars5Bars after the return visit checked for the outcome
Fail threshold pips5.0Close distance past the block's far side needed to call it "failed"
Save csvtrueWrite every order block event to a CSV file
DelimiterDelimiterCommaCSV column separator

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: Smart Money (SMC / ICT) · Alerts · MT5 Script · MQL5 Source Code

MQL4 & MQL5 scripts · PolyMaria