Impulse Retrace Ratio
- Indicators
- Version: 1.0
- Activations: 5
# Impulse Retrace Ratio - Impulse size versus retracement size
*Category: Momentum | Difficulty: intermediate | Window: separate window below the chart | Markets: Universal (Forex, indices, commodities, crypto, stocks) | Suggested timeframes: M15, M30, H1, H4, D1*
## Short description
> Groups consecutive same sign changes into runs and compares the average size of bullish runs with that of bearish ones. It measures whether impulses are larger, not more numerous.
### Overview
A healthy uptrend is not made of more green bars than red ones: it is made of advances larger than declines. The distinction is substantial and systematically escapes oscillators that sum all positive changes and compare them with the sum of negative ones, because that sum blends two different pieces of information, the number of changes and their size. Impulse Retrace Ratio separates them. It scans the window grouping consecutive same sign changes into runs, measures the total size of each run and then compares the average size of bullish runs with that of bearish ones. A market rising through three large impulses interspersed with ten small pullbacks correctly reads as bullish, even though red bars outnumber green ones.
### How the calculation works
1. The window is scanned from the oldest bar to the most recent, accumulating consecutive same sign changes into a run.
2. When the sign changes the run closes, its total size is stored and a new one begins.
3. Bars with exactly zero change neither close nor feed the running sequence: they are simply skipped.
4. The run still open at the end of the window is stored as well, so the most recent impulse is not lost.
5. The average size of bullish runs and of bearish runs is computed, along with their percentage ratio.
6. If there are fewer than InpMinRuns runs per side the value is fixed at fifty: comparing averages computed on one or two samples is meaningless.
### How to use it
- Values steadily above the bullish threshold describe a market where buying pullbacks beats selling highs.
- A value near fifty indicates impulses and pullbacks of equivalent size: the statistical signature of a range.
- The ratio can stay bullish even while price falls, if declines come in many small runs: an early sign of resilience.
- Use it to size targets: the average size of favourable runs is a natural estimate of how far the next impulse will travel.
- On short windows the number of runs becomes insufficient and the indicator sticks at fifty: keep InpWindow above forty bars.
### Who it is for and on which timeframes
It suits traders buying pullbacks and selling rallies, that is most discretionary traders, who want to know in advance which side to favour. It works from M15 to D1. No statistical background is needed, since the idea of comparing how large advances are relative to declines is immediately understandable. The difference from classic oscillators emerges clearly on markets that rise slowly and fall quickly, or the reverse.
### Practical example of reading a signal
On an equity index in H4 the bar count is nearly even: 31 green against 29 red over the last sixty. An oscillator summing changes shows a neutral value. Impulse Retrace Ratio instead prints 71: bullish runs have more than double the average size of bearish ones, because the market rises in a few large bursts and falls in many small shavings. The operational message is clear: every decline is statistically a pullback rather than a reversal, and the correct strategy is to wait for the bearish run to exhaust and enter long.
## Input parameters
| Parameter | Default | Description |
|---|---|---|
| `InpWindow` | 60 | Number of bars analysed. It must be wide enough to contain several runs per side, otherwise the comparison is unstable. |
| `InpSignalPeriod` | 9 | Period of the signal average overlaid on the histogram. |
| `InpBiasLevel` | 60.0 | Percentage imbalance beyond which the market is recognised as directional. The opposite threshold is computed automatically by symmetry. |
| `InpMinRuns` | 3 | Minimum number of runs per side for the ratio to be considered valid. Below this threshold the indicator returns fifty. |
## Advantages / strengths
- It separates two pieces of information that classic oscillators blend: the number of changes and their size.
- It correctly reads asymmetric markets that rise slowly and fall abruptly, or the reverse.
- The fixed zero to one hundred percentage scale is immediately interpretable with no calibration.
- The minimum run count check prevents the indicator from producing statistically unfounded values.
## Limitations and warnings
- On short windows or very directional markets one side may have too few runs and the indicator stays stuck at fifty.
- The arithmetic mean of run sizes is heavily influenced by a single exceptional run.
- It ignores run duration and considers only size: two impulses of equal size weigh the same even if one lasted three times longer.
- Like every rolling window measure it lags changes in market behaviour.
**No repaint:** values printed on a closed bar are never modified afterwards.
**Disclaimer.** This product is a technical analysis tool, not an automated trading system, and it offers no profit guarantee whatsoever. Financial markets carry the risk of total loss of the invested capital. Past performance is not indicative of future results. Every signal must be confirmed with your own analysis, a money management plan and prior testing on a demo account. The author is not responsible for trading decisions taken on the basis of this indicator.
## Suggested tags / keywords for MQL5
`momentum`, `impulse`, `retracement`, `oscillator`, `runs`, `pullback`, `no repaint`, `market structure`
