GROK/DESK
← All guides

Risk rules every AI trading bot needs (enforced in code)

Mandatory stops, size caps, daily loss limits, drawdown shutdown and one shot per setup: the rules that keep an AI trading desk alive.

Why rules belong in code

Language models can be wrong, confident and fast at the same time. A rule written in a prompt can be ignored; a rule written in code cannot. The AI proposes, the code disposes.

Every order has a stop

MetaTrader 5 accepts orders without a stop loss. Your gateway must not. It should also refuse any attempt to move a stop further away from the entry.

Cap size, cap the day, cap the drawdown

A maximum size per order, a maximum loss per day after which no new trades open, and an automatic shutdown when equity falls a set percentage from its peak — closing the desk's positions and waiting for a human to resume.

One shot per setup

After a setup loses once, it is done for the day. Re-entering seconds after a stop is one of the most expensive habits an automated system can have.

What a desk must never do

No martingale (doubling after a loss), no averaging down, no grids of orders, no removing a stop. Write a test for each that must fail.

Lessons may only tighten

When the desk learns from its mistakes, a new lesson can make the rules stricter — smaller size, a skipped hour, a retired setup — but never looser.

Want the complete setup?

Every prompt, file and command, step by step, in one course.

See the course