Mongol Forex

News

Equity protector for MT5: a prop-firm daily loss limit

An equity protector for MT5 watches the whole account and closes every position when a loss limit is reached. This guide shows how to set one for a prop firm's daily loss rule, with the arithmetic.

What an equity protector does

A robot's own stop loss guards one trade. An equity protector guards the account: every EA, every manual trade and every pending order, on every symbol. Our Equity Guardian checks them several times per second. When a limit is hit it closes everything, deletes pending orders and keeps the account flat until the next day or until you reset it. It never opens trades itself.

The arithmetic of a daily loss limit

Most firms publish two numbers: a daily loss limit and a maximum loss limit. A common rule is that the daily limit is a percent of the starting balance, counted down from the equity at the start of the day, and the maximum loss is a percent of the starting balance. Check how your firm measures both.

Example: a 100,000 USD account with a 5 % daily limit and a 10 % maximum loss, and equity of 100,000 USD at the start of the day.

  • The firm's line for today is 95,000 USD.
  • The maximum-loss line is 90,000 USD, so today the daily line is the one that binds.
  • With a 1 % buffer the guardian trips at 96,000 USD, before the firm's line.

Our free daily-loss calculator does this arithmetic for your own numbers.

Why a buffer

A close takes time and can slip. A buffer of about a fifth of the daily limit leaves room for both. On a prop-firm demo server a forced trip left the account flat 688 ms later (one measurement).

Settings that match common rules

  • 5 % daily, 10 % max: daily limit 5 with buffer 1, max loss 10 with buffer 1.
  • 4 % daily, 8 % max: daily limit 4 with buffer 0.8, max loss 8 with buffer 1.
  • 3 % daily, 6 % max: daily limit 3 with buffer 0.6, max loss 6 with buffer 1.

The inputs are Daily_Limit_Percent, Daily_Buffer_Percent, Max_Loss_Percent and Max_Loss_Buffer_Percent. Set Percent_Reference_USD to your starting balance and Day_Reset_Server_Hour to the server hour your firm's day starts.

Day one: watch before you switch it on

Leave Close_On_Trip off on the first day. The Journal then prints WOULD TRIP lines with the limits in money, and nothing is closed. Switch it on once those numbers match your firm's.

Keep it running

Run it on a VPS and keep the terminal connected, and your protection works around the clock. Its state survives terminal restarts and disconnects, and push notifications go to your phone.

Equity Guardian is available for MetaTrader 5 and MetaTrader 4: features, video and price. What prop-firm rules mean for a trading robot is on our prop-firm rules page.

Trading forex and CFDs carries a high risk of losing money. This article is general information, not advice, and Mongol Forex is not affiliated with any prop firm.

Send it to someone who needs it:FacebookMessengerTelegramX

← All newsQuestions? Message us on Telegram