"Price is stretched, it will come back to the average" is one of the most common ideas in trading, and one of the least measured. How stretched is stretched? How often does the return really happen? And how long does it take, five bars or fifty? Without numbers, a stretch is only a feeling, and a trader who waits for the return of a stretch that never returns pays for it. This indicator measures it on your own symbol, your timeframe and your broker's data.
The definitions are short:
A stretch can be followed by a return, or by a bigger stretch, and the share of each is exactly what a trader needs to know before betting on the return. The "further" column is the price of being early, the "return" column is the reward, and the median shows how long you wait.
There is no look-ahead. An event enters the table only when its outcome is known, so the panel counts only settled events. Events that are still waiting are not counted. The newest bar, which is still forming, is shown in the histogram but never changes the statistics. The calculation is incremental: the EMA and the ATR are running values, the events that wait for an outcome sit in a short list (at most one per level every other bar, for at most InpMaxBars bars), and the history is never rescanned.

Fig. 1. The last 100 bars of a simulated H1 series that is pulled back towards a slowly moving mean. The dashed line on the price chart is the EMA(50), added to this mockup (the indicator draws only the distance histogram, so add a standard moving average with the same period to see it on the chart). The histogram shows the distance in ATR with dotted lines at zero and at 1, 2 and 3 ATR. The panel counts all 5,052 closed bars, and the "now" line says that the close has been 2.85 ATR below the EMA for 11 bars. The numbers come from simulated data and say nothing about any real market. Black and white screenshot, per the Code Base image guidelines.
| Input | Default | Purpose |
|---|---|---|
| InpMaPeriod | 50 | EMA period of the mean (5-500). |
| InpAtrPeriod | 14 | Wilder ATR period, the unit of the distance (5-200). The first bars of the analysis, twice the longer of the two periods, build the EMA and the ATR and are not used. |
| InpLevel1 | 1.0 | Stretch level 1 in ATR (0.25-10). |
| InpLevel2 | 2.0 | Stretch level 2 in ATR. It is raised to be at least 0.25 above level 1. |
| InpLevel3 | 3.0 | Stretch level 3 in ATR. It is raised to be at least 0.25 above level 2. |
| InpMaxBars | 30 | Longest wait for an outcome, in bars (5-100). |
| InpExtendAtr | 1.0 | A stretch has run further when the close is this many ATR beyond its level (0.25-5). |
| InpHistoryBars | 50000 | Newest bars analysed when the indicator loads or is fully recalculated. 0 analyses all bars. New bars are added as they arrive. |
| InpMinCases | 30 | Fewest events before a row shows percentages (5-1000). |
| InpShowPanel | true | Show the statistics panel. |
| InpColorNormal | clrGray | Histogram color inside the first level. |
| InpColorStretch | clrWhite | Histogram color beyond the first level. |
| InpTextColor | clrSilver | Panel text color. |
| InpFontSize | 8 | Panel font size (Consolas). The line height follows the size. |
| InpPanelX , InpPanelY | 8, 14 | Panel offset from the upper left corner of the chart, in pixels. |
Prop Firm Risk Manager - daily loss and trailing drawdown guard
Account guard for prop-firm challenges. It does not open trades: it watches the whole account (manual trades and any EA) and closes everything before the firm's limits are broken. - Daily loss limit: closes all and blocks trading until the next day. - Max drawdown: static or trailing (can lock at the start balance); closes all and locks the account. - Optional profit-target lock, max lots / max positions, Friday close. - On-chart panel (equity, today's P/L, daily and drawdown room left) and push alerts. - Equity peak and lock are saved per account, so a restart does not reset the protection. Main inputs: StartBalance, DailyLossUSD, DDMode, MaxDDUSD, LockAtStart, safety buffers, TargetUSD, MaxOpenLots, MaxOpenPositions, FridayCloseOn, ResetLock. Attach to any one chart, any symbol and timeframe, with Algo Trading enabled.
Robustness Lab: Optimisation robustness map with plateau score for the Strategy Tester
Draws a live heatmap of two optimised inputs while the Strategy Tester optimises your EA, and scores every cell by its neighbourhood: the plateau score is the mean minus k times the standard deviation of the surrounding cells. It shows whether your best parameters sit on a stable plateau or on a single lucky cell, and writes an HTML report, a CSV and a picture of the map. Includes a Monte Carlo drawdown criterion and a small demo EA. Part of the free Robustness Lab set.
Daily loss and max loss guard - prop firm rules in one include
Watches the equity like a prop firm does: daily loss limit and max loss limit, static or trailing, floating profit included. Stops new trades at a warning level, closes everything on a breach and remembers it after a restart.
MACD Signals
Indicator edition for new platform.