Fibonacci Retracement Hold Rate Study
Fibonacci retracement levels are drawn on charts constantly, but "price tends to hold at 61.8%" is rarely checked against the instrument's own swing history. This script finds real swings automatically and measures, level by level, what actually happened. Swings are located with a percentage zigzag: the running high or low extends until price reverses by at least a configurable percentage, at which point a pivot is registered and the search flips direction. This scales the swing size to the instrument's own volatility rather than using a fixed bar count, which would find very different "swings" on a quiet pair versus a volatile one. For each impulse leg (pivot A to pivot B) followed by a pullback leg (pivot B to pivot C), the pullback's depth is expressed as a fraction of the impulse leg's size. That fraction is then bucketed against the five standard fib levels (23.6%, 38.2%, 50%, 61.8%, 78.6%): a level is "tested" only if the pullback actually retraced at least that deep, and among tested cases, a level counts as "held" if the pullback reversed before piercing through to the next deeper standard level. A level that the pullback never came close to reaching is correctly excluded from both counts rather than being counted as a trivial "hold". Notes and limitations - "Tested" counts only pullbacks that actually retraced at least that deep - a level with a small Tested count was rarely reached at all, and its Hold Rate is a thin sample regardless of how high the percentage reads. Read the Tested column before trusting the Hold Rate column. - "Held" means the pullback reversed before reaching the next deeper standard level, not that price touched the exact fib price to the pip - this is a zone-based definition, not a tick-precision one. - The percentage zigzag swing finder is a practical approximation, not the platform's built-in ZigZag indicator; results will differ slightly from a chart-drawn ZigZag with different settings. - This reports a historical base rate, not a trading signal, and makes no claim about profitability after spread and slippage.
Script · MT5 · v1.0 · Free
About Fibonacci Retracement Hold Rate Study
Fibonacci Retracement Hold Rate Study is a script for MetaTrader 5. It can alert you with a pop-up, sound, email or push message. It has 5 settings, such as Symbol, Timeframe and Max bars. MQL source code included.
Files in the download: FibHoldRateStudy.ex5, FibHoldRateStudy.mq5, FibHoldRateStudy.txt.
Settings
| Setting | Default | What it does |
|---|---|---|
| Symbol | Symbol to study, blank = this chart's symbol | |
| Timeframe | PERIOD_H1 | Timeframe whose swings are studied |
| Max bars | 5000 | Most recent bars to scan for swings |
| Min swing percent | 0.5 | Minimum reversal, percent of price, to register a new swing pivot |
| Save csv | true | Write the per-level hold-rate table to a CSV file |
How to install
- Download the ZIP from your PolyMaria library and unzip it.
- In MetaTrader 5 open File → Open Data Folder, then go to MQL5 → Scripts.
- Copy the .mq5 file(s) there. Put any .mqh files in MQL5 → Include.
- Open the .mq5 file in MetaEditor and press Compile (F7) if MetaTrader does not show it.
- Drag the script onto a chart to run it once.
Tags: Fibonacci · ZigZag · Alerts · MT5 Script · MQL5 Source Code