Loading…

Reward To Risk Reality Check

A target chosen because it "looks reasonable" on a chart is an eyeball estimate, not a measurement. This script replays the symbol's own history to turn that eyeball estimate into a hit rate: every historical bar's close is treated as a hypothetical entry, and the following bars, up to a chosen holding window, are checked for whether the target level (and, if set, the stop level) would have been touched first. When both a target and a stop are set inside the same bar's range, the stop is assumed to have been hit first - the conservative assumption, since a bar-range replay genuinely cannot know the order ticks occurred within that bar. The report states this plainly rather than implying tick-level precision it does not have. Alongside the target/stop hit rates, the script reports the average number of bars taken to reach the target when it was reached, and the average best favourable excursion across every tested entry (capped once the target level is reached), giving a second, independent view of how far price typically travels regardless of whether the exact target number was hit. Notes and limitations - This replays bar ranges (high/low), not individual ticks. Intrabar order when both levels sit inside one bar's range is an assumption, not a known fact - always resolved conservatively toward the stop. - Results depend entirely on how much local history is available; a short history produces a smaller, noisier sample than the requested InpLookbackBars. - Overlapping test windows (each entry starts one bar after the last) are not statistically independent samples - consecutive entries in a strong trend will correlate, which the reported hit rate does not adjust for. - This tests a fixed pip target against history; it does not account for a target that itself depends on current volatility (such as an ATR-scaled target), which would need re-running with different pip inputs at different times.

Script · MT5 · v1.0 · Free

About Reward To Risk Reality Check

Reward To Risk Reality Check is a script for MetaTrader 5. It can alert you with a pop-up, sound, email or push message. It has 7 settings, such as Symbol, Timeframe and Direction is long. MQL source code included.

Files in the download: RewardRiskRealityCheck.ex5, RewardRiskRealityCheck.mq5, RewardRiskRealityCheck.txt.

Settings

SettingDefaultWhat it does
SymbolSymbol to test (blank = current chart symbol)
TimeframePERIOD_H1Timeframe to test
Direction is longtrueTrue = long plan, false = short plan
Target pips30.0Planned target distance, pips
Stop pips0.0Planned stop distance, pips (0 = ignore stop, target only)
Holding bars20Bars held forward before giving up on the target
Lookback bars1000How many historical entries to test

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: Alerts · MT5 Script · MQL5 Source Code

MQL4 & MQL5 scripts · PolyMaria