Level Decay Model
- Indicators
- Version: 1.0
- Activations: 5
# Level Decay Model - A level that wears out
*Category: Support and Resistance | Difficulty: advanced | Window: chart window (overlaid on price) | Markets: Universal (Forex, indices, commodities, crypto, stocks) | Suggested timeframes: M30, H1, H4, D1*
## Short description
> Assigns each level a strength that decays over time and with every test it undergoes. The level is abandoned once residual strength falls below the threshold.
## Full description
### Overview
A level does not have unlimited validity, yet nearly every indicator treats it as if it were eternal. In reality it loses strength in two distinct ways: over time, because the orders supporting it are progressively filled or cancelled, and through use, because every test consumes part of the liquidity available at that price. This indicator models both mechanisms. It assigns each level full initial strength and decays it exponentially as bars pass, with a configurable half-life, and reduces it stepwise with every test it undergoes. The level is drawn only while its residual strength exceeds the minimum threshold, after which it is abandoned and the indicator looks for the next one. Residual strength is readable in the MetaTrader data window, so you can always know how loaded a level still is.
### How the calculation works
1. Every confirmed swing is born with strength of one, that is full.
2. The per bar decay factor is derived from the configured half-life, so the parameter stays expressed in bars rather than an abstract coefficient.
3. On every bar the strength is multiplied by that factor: this is the time decay.
4. When price reaches the level within the tolerance, strength is reduced by the InpTouchCost share: this is the consumption per test.
5. Below the InpMinStrength threshold the level is discarded entirely, freeing the slot for a new one.
6. A new swing replaces the stored one only if it is closer to current price, hence more relevant.
### How to use it
- Read residual strength in the data window before relying on a level: a level at strength 0.3 is nearly consumed.
- A newly formed level, at full strength, is the most reliable: that is where attention should concentrate.
- A line disappearing indicates the level has exhausted its strength, through time or tests undergone.
- Lower InpTimeHalf on fast markets, where orders are consumed more quickly.
- Raise InpTouchCost if you believe every test consumes a lot of liquidity: with 0.5 two tests halve the strength twice.
### Who it is for and on which timeframes
It targets traders who have noticed levels work well the first few times and then give way, and want a tool that explicitly models that behaviour. It works from M30 to D1. The parameters correspond to assumptions about the market, not truths: whoever uses them should choose based on their own experience with the instrument, and making those assumptions explicit is precisely the value of the indicator. It is not for those seeking a tool to apply without thinking.
### Practical example of reading a signal
On GBPJPY H4 a swing high forms at 191.20 with full strength. Price tests it a first time after twelve bars: strength falls from 0.93, already reduced by time, to 0.65 through test consumption, and the level holds. A second test twenty bars later brings strength to 0.41 and again price is rejected, but with a visibly weaker reaction. On the third test strength falls below the minimum threshold: the line disappears from the chart on exactly the bar where price crosses the level without stopping. The model had described the progressive weakening before it became visible on price.
## Input parameters
| Parameter | Default | Description |
|---|---|---|
| `InpWing` | 3 | Confirmation bars per side of a swing. |
| `InpAtrPeriod` | 30 | ATR period used for the test tolerance. |
| `InpTimeHalf` | 120.0 | Bars after which strength halves through the passage of time alone. It is the main assumption of the model. |
| `InpTouchCost` | 0.30 | Share of strength consumed by each test. With 0.30 every test removes thirty per cent of residual strength. |
| `InpTouchAtr` | 0.20 | Distance within which a bar counts as a test of the level. |
| `InpMinStrength` | 0.25 | Minimum residual strength to keep drawing the level. Below this threshold it is abandoned. |
## Advantages / strengths
- It explicitly models a real phenomenon that nearly every level indicator ignores entirely.
- The two decay mechanisms are independent and separately configurable.
- The half-life is expressed in bars rather than an abstract coefficient, so the parameter is interpretable.
- Residual strength is always readable, so the model is transparent and verifiable.
## Limitations and warnings
- The decay parameters are assumptions about market behaviour, not measured values: they must be chosen with judgement.
- Exponential decay is a reasonable modelling choice but not necessarily the correct one.
- It shows a single level per side: other active levels stay invisible.
- Residual strength is not drawn graphically but only readable in the data window.
**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
`support resistance`, `decay`, `level strength`, `liquidity`, `aging`, `price action`, `no repaint`, `model`
