Threshold Sweep Visualiser
Backtesting a single RSI threshold - "buy when RSI crosses above 70" - answers only one question: did that exact number work historically. It cannot tell you whether 70 was a genuinely robust level or a spike surrounded by much worse neighbours at 65 and 75, which is the difference between a real edge and overfitting to noise. This indicator replays every threshold from InpThresholdMin to InpThresholdMax in steps of InpThresholdStep across the last InpLookbackBars closed bars. For each level it counts how many times RSI crossed above it and what percentage of those crosses were followed by a higher close InpForwardBars later. The results are drawn as a row of coloured bars in the indicator subwindow - one per threshold - with the win rate and sample count printed under each bar, so a plateau of similar green bars reads very differently from one green bar standing alone between two red ones. The sweep recomputes once per closed bar, not every tick, since it is a structural snapshot of history rather than a live signal. Notes and limitations - Only tests crosses ABOVE a threshold (breakout-style entries), not crosses below or mean-reversion setups. - "Win" means a higher close InpForwardBars later, with no allowance for spread, slippage, or where a stop or target would have been hit first - this is a directional-bias sweep, not a strategy backtest. - A threshold near the edge of the grid can have a small sample count even over a long lookback; the printed n= figure should always be checked before trusting a bar's win rate. - Objects are pixel-anchored to the subwindow corner, so resizing the window narrower than the full bar row will clip the rightmost bars.
Indicator · MT4 · v1.0 · Free
About Threshold Sweep Visualiser
Threshold Sweep Visualiser is an indicator for MetaTrader 4 based on RSI. It has 11 settings, such as Rsi period, Threshold min and Threshold max. MQL source code included.
Files in the download: ThresholdSweepVisualiser.mq4, ThresholdSweepVisualiser.txt.
Settings
| Setting | Default | What it does |
|---|---|---|
| Rsi period | 14 | RSI period used for the swept oscillator |
| Threshold min | 55.0 | Lowest threshold in the sweep grid |
| Threshold max | 85.0 | Highest threshold in the sweep grid |
| Threshold step | 5.0 | Spacing between swept threshold levels |
| Forward bars | 10 | Bars ahead used to judge the outcome of a cross |
| Lookback bars | 2000 | How many closed bars are replayed for each threshold |
| Good color | clrLimeGreen | Bar colour when win rate looks favourable |
| Bad color | clrOrangeRed | Bar colour when win rate looks poor |
| Neutral color | clrSilver | Bar colour in between |
| Good win rate | 55.0 | Win rate %% at/above which a bar is coloured "good" |
| Bad win rate | 45.0 | Win rate %% at/below which a bar is coloured "bad" |
How to install
- Download the ZIP from your PolyMaria library and unzip it.
- In MetaTrader 4 open File → Open Data Folder, then go to MQL4 → Indicators.
- Copy the .mq4 file(s) there. Put any .mqh files in MQL4 → Include.
- Open the .mq4 file in MetaEditor and press Compile (F7) if MetaTrader does not show it.
- Drag the indicator from the Navigator onto a chart and adjust the settings.
Tags: Grid · Breakout · RSI · MT4 Indicator · MQL4 Source Code