Back to knowledge
Risk management8 min read

Protection

Daily risk controls for Expert Advisors

Build account-level brakes that remain active when the strategy is wrong, the market is abnormal, or the operator is away.

Define the account clock

A daily loss control is meaningless until the daily boundary is defined. Broker server time, firm timezone, daylight-saving changes, balance resets, and floating profit and loss can all change the result. Document the exact clock and test it around the reset.

Use the firm's current definition for compliance, then keep a more conservative internal limit where possible.

Make the halt stronger than the signal

When a daily or overall loss threshold is reached, the EA should stop opening new trades and communicate its state. Decide whether it should close exposure, manage existing positions only, or require a manual reset based on the account rules and strategy design.

  • Include realised and floating loss as appropriate.
  • Account for commissions, swaps, and other charges.
  • Persist the halt state across terminal restarts.
  • Log the exact calculation and threshold that triggered it.

Test the protection path

Use synthetic account states to test just below, exactly at, and just above each limit. Test multiple open positions, reconnects, and a daily reset. A protection rule that only works in the happy path is not protection.

A clear halt message lets an operator investigate instead of wondering whether the bot is simply waiting for a setup.

Discuss this article

Ask a setup question, share a backtest, or compare notes with other algorithmic traders. Use a display name; your email remains private.

Create an account or sign in above to join the conversation.

Loading discussion…