Overbought Duration Tracker
- Indicators
- Version: 1.0
- Activations: 5
# Overbought Duration Tracker - How long the extreme has lasted
*Category: Oscillators | Difficulty: intermediate | Window: separate window below the chart | Markets: Universal (Forex, indices, commodities, crypto, stocks) | Suggested timeframes: M15, M30, H1, H4, D1*
## Short description
> Measures how many bars the oscillator has spent in the extreme zone and compares it with the average duration of past stays. It avoids the error of selling on the first overbought touch.
## Full description
### Overview
The most costly error made with oscillators is selling on the first touch of the overbought zone. In a strong trend that zone is reached and held for dozens of bars, and every counter entry is a loss. This indicator does not look at the oscillator value but at the duration of the stay in the extreme zone, and compares it with the average duration of past stays on the same instrument. The question it answers is simple and practical: has this overbought condition just started, or has it already lasted longer than normal? A stay just begun signals strength and should be gone along with; a stay well beyond the typical duration justifies caution, but is still not a reversal signal, because the most profitable trends are precisely those staying extreme longer than usual.
### How the calculation works
1. A reference oscillator measures the close position within the recent range and is smoothed.
2. The state is plus one in the high zone, minus one in the low zone, zero in the central band.
3. The duration increases on every bar confirming the state and restarts from one when the state changes.
4. When a stay ends its duration enters the statistic, but only if it exceeds InpMinRun bars.
5. The minimum duration filter prevents single bar random touches from artificially lowering the average.
6. The typical duration is shown only after at least three completed stays, because before that the average is not meaningful.
### How to use it
- A stay just begun, with the histogram well below the dashed line, signals strength: go along with the move.
- A stay beyond the typical duration justifies caution and tighter stops, not a counter entry.
- The histogram returning to zero signals the oscillator has left the extreme zone: that is where the condition ended.
- The typical duration varies a lot between instruments: comparing it helps understand which markets have more persistent trends.
- Use it as a corrective to your own oscillator strategy, not as a standalone tool.
### Who it is for and on which timeframes
It targets anyone who has lost money selling an overbought reading in a trend, that is most oscillator users. It works from M15 to D1. The duration statistic becomes reliable only after enough completed stays, so loading deep history is advisable. The concept requires no technical background: counting how many bars a condition has lasted is immediate, and precisely for that reason the indicator is usable by less experienced traders too.
### Practical example of reading a signal
On NASDAQ100 D1 the typical duration of overbought stays settles around five bars. The oscillator enters the high zone and the histogram rises to one, then two, then three: we are still below the typical duration and the trend is young. Anyone selling here is betting against the instrument own statistics. The histogram reaches five, then eight, then twelve: the stay now lasts more than twice the normal. This is not a sell signal, but from here on anyone long moves the stop below the low of the last three sessions and stops adding. On the sixteenth bar the oscillator leaves the high zone and the histogram returns to zero.
## Input parameters
| Parameter | Default | Description |
|---|---|---|
| `InpOscPeriod` | 14 | Period of the reference oscillator. |
| `InpSmooth` | 3 | Oscillator smoothing, without which it would enter and leave the extreme zone constantly. |
| `InpUpperLevel` | 75.0 | Threshold defining the overbought zone. |
| `InpLowerLevel` | 25.0 | Threshold defining the oversold zone. If the two thresholds are inverted, the indicator reorders them. |
| `InpMinRun` | 2 | Minimum duration for a completed stay to enter the statistic, excluding single bar random touches. |
## Advantages / strengths
- It directly addresses the most common and most costly error made with oscillators.
- The reference is the instrument own history, not an arbitrary duration: it adapts to markets with different persistence.
- The minimum duration filter prevents random touches from distorting the statistic.
- An immediate concept requiring no technical background.
## Limitations and warnings
- The typical duration depends entirely on the chosen thresholds: changing them changes the whole statistic.
- On short histories the duration average is unstable and early values can be misleading.
- The arithmetic mean is heavily affected by exceptionally long stays.
- It says nothing about future direction: a long stay can become a very long one.
**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
`oscillator`, `duration`, `overbought`, `trend filter`, `position management`, `statistics`, `no repaint`, `persistence`