Learn
Risk rules that keep an account alive
A bot does exactly what you told it, including breaching a prop firm rule it does not know about. The firm's risk engine will then enforce the rule for you, by closing the account. So the job is to encode every rule that can end an account as a hard limit inside the bot, and to make the bot stop itself before the firm has to. These are the six that matter, in roughly the order they kill accounts.
I encode these as hard constraints in my own bot before it goes live, because a rule the bot can break is a rule it eventually will.
The drawdown, as a self-halt
The trailing or end-of-day max loss is the line that ends the account, so the bot tracks its own distance to it and flattens and stops before it gets close, not at the line. If the trailing drawdown is 2,000 dollars, the bot might halt for the day at 1,500 down, leaving room for the spread and slippage on the exit. Hitting the firm's exact number is already too late, because the fill is not instant.
The bot has to know which kind of drawdown it is. A trailing intraday drawdown moves with unrealized profit, so the self-halt level moves too. Hardcode the type and the figure for the specific account, and re-check them when the firm changes plans, which they do.
The daily loss limit
Most firms set a maximum loss per day separate from the overall drawdown. The bot tracks the day's realized and open loss and stops trading for the session when it nears the limit, again with a buffer. This is the rule that saves you from a bad morning turning into a dead account, and it is the easiest one to encode and the easiest one to forget.
Pair it with a daily profit stop if your firm has a consistency rule, because banking too much in one day can be as much of a problem as losing too much. More on that below.
The flat-by time and session windows
Every firm has a time by which open positions must be closed, often tied to the futures session close, and some accounts cannot hold overnight at all. The bot flattens before that cutoff on its own, with a margin, rather than trusting it to the last second. It also should not be opening new trades right before the cutoff that it will only have to close at a loss.
Build the trading window in explicitly: the earliest the bot may enter, the latest, and the hard flatten time. A bot left running into a half day or a holiday close is a common way to take an avoidable loss or a rule breach.
The consistency rule
Many firms require that no single day be more than 30 to 50 percent of your total profit before they pay you. A bot that has one huge session can lock its own payout. So the bot caps its daily gain relative to its running total, taking the foot off once a day is carrying too much of the profit. This is counterintuitive, telling a winning bot to stop winning, but it is what clears the payout.
Encode the firm's exact percentage and measure it against the trailing total, not a guess. This rule does not end the account, it delays the money, which for a working bot is the same problem.
Contract limits and trade frequency
Firms cap the maximum contracts for the account size, and some scale that cap during the eval. A bot that sizes off the strategy without checking the cap will get a trade rejected or the account flagged. Several firms also limit trade frequency or ban high-frequency behavior outright, like MyFundedFutures capping trades above 200 a day. The bot has to respect both.
These are simple checks that are easy to skip and expensive to miss. The order layer should refuse any order that exceeds the contract cap or the frequency limit, rather than sending it and hoping.
Build them as one risk layer, not scattered checks
The clean way to do all of this is a single risk layer that sits between the strategy and the order, and every order passes through it. The strategy proposes a trade, the risk layer checks it against the drawdown buffer, the daily loss limit, the time window, the consistency cap, and the contract limit, and only then does it go to the firm. If any check fails, the trade does not happen and the bot logs why.
The actual code for that risk layer, the part that enforces all six as hard constraints and self-halts cleanly, is what I keep for the paid build doc. The list above is the free part, and it is the checklist that decides whether your bot survives a funded account or just a backtest.
FAQ
What rules does a trading bot need to follow on a prop firm?
At minimum: the max drawdown, the daily loss limit, the flat-by time and any overnight restriction, the consistency rule on payouts, the contract cap for the account size, and any trade-frequency limit. Each has to be encoded as a hard limit the bot checks before sending an order, because the firm's risk engine enforces them by closing the account.
How do I stop my bot from breaching the drawdown?
Have the bot track its own distance to the trailing or end-of-day max loss and flatten and halt for the day before it reaches the line, with a buffer for slippage. Hitting the firm's exact number is too late, because the exit fill is not instant. The bot also has to know which kind of drawdown the account uses, since a trailing intraday limit moves with open profit.
What is the consistency rule and why does it matter for a bot?
It is a firm requirement that no single day be more than a set share of your total profit, often 30 to 50 percent, before they pay you out. A bot that banks one huge session can lock its own payout, so it should cap its daily gain relative to its running total. The rule does not end the account, it delays the money.
Where should risk checks live in a trading bot?
In a single risk layer between the strategy and the order, so every proposed trade passes through the same checks for drawdown, daily loss, time window, consistency, and contract limits before it reaches the firm. Scattering the checks through the strategy code makes it easy to miss one, and one missed check is enough to lose an account.