Loading…

Challenge Pass Optimiser

A prop-firm challenge is a race between two absorbing barriers. Reach the profit target first and the challenge is passed; breach the daily loss limit or the total loss limit first and it is failed. Risk too little per trade and the target may never be reached before the days run out. Risk too much and the loss barrier becomes the more likely one to be hit first. Somewhere between those extremes is a risk level that gives the best chance of passing - this header estimates it. It deliberately does not use a Kelly-criterion closed form. Kelly maximises long-run geometric growth over an unbounded number of bets, which is a different question from "what is my probability of reaching this specific target within this many days, without breaching either loss limit first". Over a short, boundary-constrained horizon like a challenge, the Kelly fraction and the pass-maximising fraction are not the same number, and using Kelly here would answer a question nobody asked. Instead, CChallengePassOptimiser simulates the actual challenge directly: thousands of synthetic attempts at each candidate risk level, each attempt playing out day by day and trade by trade against a win-rate/win-loss-ratio model of the trader's edge, tracking equity against both loss floors and the target ceiling, tallying how often that risk level would have passed. The risk level with the best simulated pass rate is the recommendation, and the full grid of tested risk levels is returned too, so the trader can see how sharply (or gently) the pass probability falls off on either side of the optimum rather than trusting a single unexplained number. This is a genuine tradeoff against a closed-form answer: the result carries Monte Carlo sampling noise (expect a few percentage points of run-to-run variation at the default trial count) rather than being exact, and it is only as good as the win-rate/win-loss-ratio inputs describing the trader's edge. Feeding it flattering, unmeasured numbers produces a flattering, meaningless answer - see NOTES AND LIMITATIONS. Notes and limitations - This is a simulation-based estimate, not an exact calculation. Results vary a little between runs at the default 2000-trials-per-grid-point setting; raise trialsPerPoint for a smoother (but slower) sensitivity curve if needed. - The simulation models trade outcomes as independent Bernoulli draws at a fixed win rate and win/loss ratio. It does not model streaks, correlated losses, changing market regimes, or a strategy whose edge itself depends on the risk taken - all real complications a live trading result will have and this model will not capture. - winRate and winLossRatio must come from the trader's own measured history, not a hope. Supplying an optimistic edge produces an optimistic (and wrong) recommendation - the optimiser cannot tell a real edge from a fabricated one, it only computes what follows from what it is told. - The daily loss floor resets against each day's OPENING equity, and a breached daily floor stops that day's simulated trading but does not end the attempt - only a breached total loss floor, or running out of days, ends it (as a fail). This matches how most funded-account daily-loss rules work, but check the specific prop firm's rules match this model before relying on the number. - tradesPerDay is a simplification - it assumes a fixed number of trade opportunities per day regardless of market conditions. A real trading day may offer more or fewer setups.

Script · MT5 · v1.0 · Free

About Challenge Pass Optimiser

Challenge Pass Optimiser is a script for MetaTrader 5. It has 7 settings, such as Days left, Target pct and Daily loss limit pct. MQL source code included.

Files in the download: ChallengePassOptimiser.mq5.mqh, ChallengePassOptimiser.txt, ChallengePassOptimiserDemo.ex5, ChallengePassOptimiserDemo.mq5.

Settings

SettingDefaultWhat it does
Days left10trading days remaining in the challenge
Target pct10.0profit target, percent of starting balance
Daily loss limit pct5.0max drawdown allowed in a single day
Total loss limit pct10.0max drawdown allowed overall
Trades per day3trades attempted per trading day
Win rate0.45assumed win rate (0.0-1.0)
Win loss ratio1.5assumed average win size / average loss size

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

MQL4 & MQL5 scripts · PolyMaria