Lesson 10. Risk Engine for Robots — Rules, Limits, Protections
Bring risk management to automation: per‑trade risk, daily/weekly stops, losing‑streak pauses, ATR/volatility filters, spread/slippage caps, news/rollover blackouts, max open risk/exposure, and a clear stop‑signal model with a shutdown checklist.
10.1. Why robots need a risk engine (concept)
Robots execute rules, not judgment. A risk engine adds 'seatbelts' so one bad day or regime shift doesn't spiral into big losses.
Components:
- Position sizing
- Loss limits (daily/weekly)
- Losing-streak pauses
- Protections (ATR, spread, slippage, news/rollover)
- Shutdown logic
Principle: Small risk first; protect the account; adapt or pause when conditions degrade.
10.2. Per‑trade risk & position sizing (recap + quick tool)
- Keep per‑trade risk small: 0.25–1% (0.5% is a good beginner default).
- Two sizing modes: Fixed lot vs Risk % per trade (safer).
Risk Amount: $50.00 → Lot Size: 0.17
This is for planning; set EA inputs accordingly.
10.3. Daily/weekly stops & losing‑streak pauses
- Daily stop: e.g., −2%. Weekly stop: e.g., −5%. When hit → stop trading until next day/week.
- Max losing trades per day = floor(DailyStop% / RiskPerTrade%).
- Streak pause: pause after N consecutive losses (e.g., 3); cooldown M trades/hours (e.g., 3 trades or 24h).
Summary:
Max losing trades per day: 4
Max losing trades per week: 10
Streak pause: After 3 consecutive losses, pause for 24 hours
10.4. Protections: volatility (ATR), spread/slippage caps, news/rollover blackouts
Only trade when ATR(14) percentile is between low/high (e.g., 20–80th).
Skip entries if spread > X pips or > 1.5× median.
Reject fills > Y pips slippage.
Avoid high‑impact news ±(15–30) minutes.
Avoid broker midnight window (e.g., 23:50–00:10 server time).
PROTECTION POLICY ──────────────── ATR Filter: 20–80th percentile Max Spread: 2.0 pips Max Slippage: 0.5 pips News Blackout: ±20 minutes Rollover Blackout: Enabled (23:50–00:10 server time) ──────────────── Generated: 2025-12-12
10.5. Max open risk/exposure (portfolio guard)
Limit total open risk across positions: e.g., Max Open Risk = 2–3% of balance.
Optionally limit exposure per symbol or direction to avoid concentration.
Max concurrent positions: 5
Based on 0.5% per trade and 2.5% max open risk
Stacking highly correlated symbols counts as higher effective exposure.
10.6. Stop‑signal model: trigger → action map
Define clear triggers and what to do — before emotions enter.
Summary:
1. Daily PnL ≤ −DailyStop% → Stop EA until tomorrow (fixed) 2. Weekly PnL ≤ −WeeklyStop% → Stop EA until next week 3. Losing streak ≥ N → Pause EA; resume after M hours or 1 win 4. ATR outside allowed band → Block entries (allow exits only) 5. Spread > cap or Slippage > cap → Block entries; reduce risk by 50% for 24h 6. Connection loss / repeated 'No prices' errors → Halt EA; investigate; resume after connectivity is stable
10.7. Shutdown checklist (copyable)
10.8. Practice: configure your risk engine and export a policy (10–15 min)
Lesson 10 Quiz
Test your understanding with 3 questions. Pass with 2/3 correct.