Loading…

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

SettingDefaultWhat it does
SymbolSymbol to study, blank = this chart's symbol
TimeframePERIOD_H1Timeframe to study
Max bars3000Most recent bars to include
Indicator nameCustom indicator name (blank = use built-in RSI)
Param10Custom indicator input 1 (unused ones pass 0)
Param20Custom indicator input 2
Param30Custom indicator input 3
Param40Custom indicator input 4
Buffer index0Custom indicator buffer index
Rsi period14Built-in RSI period, used when InpIndicatorName is blank
Applied pricePRICE_CLOSEApplied price for the built-in RSI
ConditionCondLessThanSignal condition
Threshold30.0Threshold the condition compares against
Only first bartrueCount only the first bar of a level condition, not every bar it holds
Horizon bars15Forward horizon 1, in bars (0 = skip)
Horizon bars210Forward horizon 2, in bars (0 = skip)
Horizon bars320Forward horizon 3, in bars (0 = skip)
Save csvtrueWrite every signal and its forward returns to a CSV file
DelimiterDelimiterCommaCSV column separator

How to install

  1. Download the ZIP from your PolyMaria library and unzip it.
  2. In MetaTrader 5 open File → Open Data Folder, then go to MQL5 → Scripts.
  3. Copy the .mq5 file(s) there. Put any .mqh files in MQL5 → Include.
  4. Open the .mq5 file in MetaEditor and press Compile (F7) if MetaTrader does not show it.
  5. Drag the script onto a chart to run it once.

Download the PDF guide

Tags: RSI · Buy/Sell Arrows · Alerts · MT5 Script · MQL5 Source Code

MQL4 & MQL5 scripts · PolyMaria