Watch how to download trading robots for free
Find us on Twitter!
Join our fan page
Interesting script?
So post a link to it -
let others appraise it
You liked the script? Try it in the MetaTrader 5 terminal
Experts

Prop Firm Risk Manager - daily loss and trailing drawdown guard - expert for MetaTrader 5

Real author
Published by:
Views:
66
Rating:
(1)
Published:
MQL5 Freelance Need a robot or indicator based on this code? Order it on Freelance Go to Freelance

An account guard for prop-firm challenges and funded accounts. It does not open trades: it watches the whole account (manual trades and any other EA) and closes everything before the firm's limits are broken.

How it works

  • Daily loss limit - today's loss is measured from the day's starting balance (or equity). When it reaches the limit minus a safety buffer, all positions are closed, pending orders are deleted and trading stays blocked until the next day.
  • Max drawdown - static (from the starting balance) or trailing (from the highest equity). The trailing floor can lock at the starting balance, as most firms do. At the floor plus the buffer everything is closed and the account stays locked.
  • Profit target (optional) - closes everything when equity reaches start + target, so a passed challenge is not given back.
  • Exposure limits (optional) - maximum total lots and maximum open positions; the newest positions are closed first.
  • Friday close (optional) - closes everything at a set server time to avoid weekend gaps.
  • Panel and alerts - equity, today's P/L, daily room left, drawdown floor and room left; phone push notifications.
  • Restart-safe - the equity peak and the lock are saved per account in Global Variables, so a terminal or VPS restart does not reset the protection.

Inputs

  • StartBalance - challenge starting balance.
  • DailyLossUSD, DailyFromEquity, DayResetHour, DailyBufferUSD - daily loss rule (check whether your firm measures from balance or equity at the day start).
  • DDMode, MaxDDUSD, LockAtStart, MaxDDBufferUSD - overall drawdown rule (static or trailing).
  • TargetUSD - profit target lock (0 = off).
  • MaxOpenLots, MaxOpenPositions - exposure limits (0 = off).
  • FridayCloseOn, FridayCloseHHMM - weekend protection (server time).
  • Push, ShowPanel - notifications and panel.
  • ResetLock - set to true once when starting a new challenge to clear a saved lock.

Usage: attach to any one chart (any symbol, any timeframe) and keep Algo Trading enabled so the EA can close positions. Set the limits slightly tighter than your firm's real limits. It works alongside any other EA or manual trading on the same account.

Robustness Lab: Optimisation robustness map with plateau score for the Strategy Tester Robustness Lab: Optimisation robustness map with plateau score for the Strategy Tester

Draws a live heatmap of two optimised inputs while the Strategy Tester optimises your EA, and scores every cell by its neighbourhood: the plateau score is the mean minus k times the standard deviation of the surrounding cells. It shows whether your best parameters sit on a stable plateau or on a single lucky cell, and writes an HTML report, a CSV and a picture of the map. Includes a Monte Carlo drawdown criterion and a small demo EA. Part of the free Robustness Lab set.

Robustness Lab: Monte Carlo drawdown analysis of your trading history Robustness Lab: Monte Carlo drawdown analysis of your trading history

Takes the closed trades of your account (all, or filtered by magic number and symbol), reshuffles or resamples them thousands of times and shows how deep the drawdown could realistically get. You get drawdown percentiles, the probability of a drawdown above your limit, the spread of final equity, an equity fan chart and a drawdown histogram, on the chart and as an HTML report. Part of the free Robustness Lab set.

Accelerator Oscillator (AC) Accelerator Oscillator (AC)

The Acceleration/Deceleration Indicator (AC) measures acceleration and deceleration of the current driving force.

MACD Signals MACD Signals

Indicator edition for new platform.