Indicator Signal Base Rate Tester
Turning "RSI below 30 tends to bounce" into an EA just to find out whether it is true is a lot of work for a question that has a direct answer. This script gives the direct answer: it scans the loaded history for every bar where a chosen condition on an indicator's value fires, then measures the forward percentage return from that bar's close to the close several bars later, across up to three horizons, and reports the sample count, win rate, mean and median return for each. The indicator itself is not hard-coded. Leaving InpIndicatorName blank drives the built-in RSI, so the script runs and produces a real result with zero setup. Filling in a name switches to a custom indicator with up to four generic numeric parameters and a chosen buffer index, which covers most custom indicators already sitting in the Indicators folder without writing a dedicated tester for each one. Level conditions - greater than or less than a threshold - can stay true for many consecutive bars. Counting every one of those bars as its own signal would count one real event many times over and inflate the sample with near-duplicate, heavily correlated observations. InpOnlyFirstBar keeps only the bar where the condition first became true, matching how a cross condition already behaves by definition. Notes and limitations - If every sampled indicator value came back identical, the script prints a warning rather than a silent, meaningless result - this usually means the indicator name, a parameter or the buffer index is wrong. - Forward return is close-to-close percentage change, with no allowance for spread, slippage or the cost of actually entering the trade the signal implies. - Overlapping signals are not merged. If the condition fires on several bars close together, their forward-return windows overlap and the samples are not statistically independent - treat the win rate as descriptive, not as a hypothesis test with a clean sample size. - The named custom indicator must already be compiled and present in this terminal's Indicators folder (matching the platform), or the built-in RSI fallback is what actually gets tested.
Script · MT5 · v1.0 · Free
About Indicator Signal Base Rate Tester
Indicator Signal Base Rate Tester is a script for MetaTrader 5 based on RSI. It can alert you with a pop-up, sound, email or push message. It has 19 settings, such as Symbol, Timeframe and Max bars. MQL source code included.
Files in the download: IndicatorSignalBaseRateTester.ex5, IndicatorSignalBaseRateTester.mq5, IndicatorSignalBaseRateTester.txt.
Settings
| Setting | Default | What it does |
|---|---|---|
| Symbol | Symbol to study, blank = this chart's symbol | |
| Timeframe | PERIOD_H1 | Timeframe to study |
| Max bars | 3000 | Most recent bars to include |
| Indicator name | Custom indicator name (blank = use built-in RSI) | |
| Param1 | 0 | Custom indicator input 1 (unused ones pass 0) |
| Param2 | 0 | Custom indicator input 2 |
| Param3 | 0 | Custom indicator input 3 |
| Param4 | 0 | Custom indicator input 4 |
| Buffer index | 0 | Custom indicator buffer index |
| Rsi period | 14 | Built-in RSI period, used when InpIndicatorName is blank |
| Applied price | PRICE_CLOSE | Applied price for the built-in RSI |
| Condition | CondLessThan | Signal condition |
| Threshold | 30.0 | Threshold the condition compares against |
| Only first bar | true | Count only the first bar of a level condition, not every bar it holds |
| Horizon bars1 | 5 | Forward horizon 1, in bars (0 = skip) |
| Horizon bars2 | 10 | Forward horizon 2, in bars (0 = skip) |
| Horizon bars3 | 20 | Forward horizon 3, in bars (0 = skip) |
| Save csv | true | Write every signal and its forward returns to a CSV file |
| Delimiter | DelimiterComma | CSV column separator |
How to install
- Download the ZIP from your PolyMaria library and unzip it.
- In MetaTrader 5 open File → Open Data Folder, then go to MQL5 → Scripts.
- Copy the .mq5 file(s) there. Put any .mqh files in MQL5 → Include.
- Open the .mq5 file in MetaEditor and press Compile (F7) if MetaTrader does not show it.
- Drag the script onto a chart to run it once.
Tags: RSI · Buy/Sell Arrows · Alerts · MT5 Script · MQL5 Source Code