Skip to main content
ForexNews24
Risk Management Inside an Expert Advisor — Robots & Automation, ForexNews24

Risk Management Inside an Expert Advisor

A robot executes rules faster and more consistently than a human — including rules that destroy an account. Risk management inside an advisor exists not to raise returns but to ensure that a failure does not cost the whole deposit.

Size is calculated, not set

A fixed lot means money risk varies with stop distance: the same trade costs differently on a calm day and a volatile one. The correct construction is the reverse — set an allowable risk as a percentage of the deposit and derive size from it and from the actual stop distance. That is the only way to keep risk constant while volatility changes.

Limits that are always required

Three built-in ceilings cover most catastrophic scenarios: a maximum daily loss after which the advisor stops until the next day; a maximum total drawdown after which it stops entirely; and a cap on simultaneously open positions. None of them improves results in normal conditions — all of them exist for the abnormal ones.

Behaviour on failure

What does the advisor do if the connection drops with a position open? What if the terminal restarts and a position already exists that the robot does not know about? These scenarios are not theoretical, and handling them is a mandatory part of the code rather than an optional improvement. At minimum: restore state from actual open positions at startup, and place protective stops on the broker's side rather than inside the advisor's logic.

The emergency stop

A separate control that closes everything and forbids new entries must exist and must be tested before real money is involved. Testing it when you need it is too late. The same applies to understanding what happens if the advisor is switched off with positions open — whether stops remain on them.

This material is educational and is not individual investment advice. Trading forex carries the risk of losing capital.

Frequently asked questions

How should an advisor calculate position size?

From an allowable risk percentage and the actual stop distance, not as a fixed lot. Otherwise money risk drifts with volatility.

Which limits are mandatory in an advisor?

A maximum daily loss, a maximum total drawdown and a cap on simultaneously open positions. All three exist for abnormal scenarios rather than for returns.

Where should a robot's stop-loss sit?

On the broker's side, not only in the advisor's logic. A stop that exists solely in code disappears with a dropped connection or a terminal restart.

Digest

New backtest studies — to your inbox

When a new reproducible study comes out or the data is updated, we send a short email. No spam, no "signals", no selling your address.

By leaving your email you agree to receive occasional emails from the portal. Unsubscribe in one click from any of them.

From research to application

In our Allocation product we implemented these algorithms with all the nuances covered across the portal.

Learn about Allocation