Page 1 of 1

Equity protection: a kill switch for automated trading

Posted: Tue Nov 03, 2026 10:46 am
by FXS London Scalper
An EA running unattended can lose more than planned if markets behave unusually or if a bug causes repeated trades. A kill switch that stops trading when equity falls below a threshold adds a safety layer.

A simple version: at each tick or bar, compare current equity with the starting equity of the day or week. If the drawdown exceeds a limit, close all positions with the EA's magic number and stop opening new ones until manually reset.

A worked example: an EA has a bug in its position counting after a server restart and opens a new trade every minute. A daily equity limit of 3 percent would stop it before the damage grows.

The kill switch should be independent of the trading logic, ideally in a separate EA or script, so that a bug in the strategy code does not disable it.

Testing the switch on demo, by forcing a drawdown, confirms it works.

Do you run any equity protection alongside your EAs?

Re: Equity protection: a kill switch for automated trading

Posted: Wed Nov 04, 2026 11:23 am
by Amanhasnoname
I run something like this, and what I learned is that the way you reset it matters as much as the threshold. My first version compared against the starting equity of the day, but after a profitable morning it allowed me to hand back all the gains before it triggered. I now use two limits. One is a daily loss from the start of day at two percent, and the other is a drop of one percent from the day's peak equity, whichever comes first.

I also made the switch do more than close trades. It writes a short line to a file with the time, the equity and the number of open positions it closed, and it sends me a push notification. The first time it fired in real life, I was away from the desk and only knew because of that message.

Be careful with the manual reset step. I made mine require restarting the terminal and deleting a flag file, so it can't be turned back on by accident in a hurry after a bad day.