Risk Management Cho Trading Bots — 10 Nguyên Tắc Thiết Yếu
Risk management là yếu tố #1 phân biệt trader thành công và trader blow account. Strategy tốt không cứu được risk management tệ. Tutorial này có 10 nguyên tắc thiết yếu, Kelly Criterion, drawdown math, và position sizing rules.
⚠️ Sự Thật Tàn Nhẫn
90% retail traders mất tiền. Không phải vì strategy tệ — mà vì risk management tệ. Bot với 60% win rate vẫn blow account nếu position sizing sai. 10 nguyên tắc dưới = sống sót long-term.
10 Nguyên Tắc Risk Management
2% Rule — Risk Per Trade
Không bao giờ risk > 2% balance trên 1 trade. Với $1,000 → max $20/trade. Survive 50 losses liên tiếp. Conservative traders pakai 1%.
Daily Loss Limit — 5%
Stop bot khi daily loss đạt 5% balance. $1,000 → stop sau -$50. Reset sáng hôm sau. Tránh “revenge trading” sau bad day.
Weekly Loss Limit — 10%
Nếu tuần lỗ 10%, pause bot cuối tuần. Review strategy. Có thể market regime thay đổi. Đừng để 1 tuần xấu thành 1 tháng xấu.
Fixed Fractional Sizing
Stake = constant % balance, KHÔNG tăng sau loss (Martingale = chết). Balance giảm → stake tự động giảm. Balance tăng → stake tăng. Compounding tự nhiên.
Stop Loss Mọi Trade
Mỗi trade phải có exit plan trước khi vào. Binary options: duration là “stop loss” tự động. CFDs: hard SL. Không có “hope it recovers”.
Cooldown Sau Losing Streak
Sau 3 losses liên tiếp, pause bot 1 giờ. Có thể market conditions thay đổi, hoặc strategy đang mismatch. Cooldown = reset, re-evaluate.
Max Trades Per Day
Limit 5-10 trades/day. Quality > quantity. Overtrading = more exposure to variance, more fees, more emotional fatigue.
Diversification
Đừng all-in 1 asset/strategy. Run 2-3 strategies hoặc assets. Correlation thấp = drawdowns không cùng lúc. Spread risk.
Withdraw Profits Regularly
Mỗi tháng profitable, withdraw 30-50% profits. “House money” psychology dangerous. Lock in gains. Đừng để greed compound risk.
Never Trade Money You Need
Chỉ trade với capital bạn có thể accept loss 100%. Tiền vay, tiền học phí, tiền sinh hoạt = NO. Financial cushion là psychological cushion.
Drawdown Math — Recovery Reality
Drawdown lớn cần recovery disproportionate:
| Drawdown | Recovery Cần | Severity |
|---|---|---|
| -5% | +5.3% | Easy |
| -10% | +11.1% | Manageable |
| -20% | +25% | Hard |
| -30% | +42.9% | Very Hard |
| -50% | +100% | Brutal |
| -75% | +300% | Near Impossible |
| -90% | +900% | Account Dead |
📊 Lesson
Drawdown -50% cần +100% chỉ để break even. Đây là lý do prevent drawdowns > protect against them. 2% rule + daily limit = drawdowns thường < 20%, recoverable.
Kelly Criterion — Optimal Sizing
Kelly Criterion calculates mathematically optimal position size:
Kelly % = W - [(1 - W) / R]
Where:
W = Win Rate (decimal, e.g. 0.60 for 60%)
R = Avg Win / Avg Loss ratio
Example:
Win Rate = 60% (0.60)
Avg Win = $50, Avg Loss = $40
R = 50 / 40 = 1.25
Kelly % = 0.60 - [(1 - 0.60) / 1.25]
= 0.60 - [0.40 / 1.25]
= 0.60 - 0.32
= 0.28 = 28%
⚠️ Full Kelly 28% is TOO aggressive!
Use 1/4 Kelly: 28% / 4 = 7% per trade
Even safer: stick to 2% rule
⚠️ Full Kelly Quá Aggressive
Full Kelly maximizes long-term growth nhưng variance cực cao — drawdowns 50%+ common. Pakai 1/4 Kelly hoặc đơn giản stick 2% rule. Boring nhưng survivable.
Position Sizing Code (Python)
def calculate_position_size(balance, risk_pct=2.0):
"""Fixed fractional position sizing (recommended)."""
return round(balance * risk_pct / 100, 2)
def kelly_position_size(balance, win_rate, avg_win, avg_loss, fraction=0.25):
"""Kelly Criterion sizing with safety fraction."""
if avg_loss == 0:
return calculate_position_size(balance) # fallback
R = avg_win / avg_loss
kelly_pct = win_rate - ((1 - win_rate) / R)
# Apply safety fraction (1/4 Kelly recommended)
safe_kelly = max(0, kelly_pct * fraction)
# Cap at 5% maximum for safety
safe_kelly = min(safe_kelly, 0.05)
return round(balance * safe_kelly, 2)
# Example usage
balance = 1000
print(f"Fixed 2%: ${calculate_position_size(balance)}")
print(f"1/4 Kelly: ${kelly_position_size(balance, 0.60, 50, 40)}")
# Output:
# Fixed 2%: $20.0
# 1/4 Kelly: $50.0 (capped logic applies)
Risk Management Plan Template
📋 Daily Risk Plan
Account balance: $1,000
Risk per trade: 2% = $20
Daily loss limit: 5% = $50 → stop bot
Daily profit target: 3% = $30 → withdraw & restart tomorrow
Max trades/day: 8
Cooldown trigger: 3 consecutive losses → 1 hour pause
Weekly review: Sunday — analyze P/L, win rate, drawdown
Monthly: Withdraw 40% profits
Psychological Risk Management
Risk management không chỉ là numbers — còn là tâm lý:
Revenge Trading
Sau loss lớn, urge “win it back” mạnh mẽ. Đây là cách nhanh nhất blow account. Daily loss limit + cooldown = circuit breaker.
FOMO (Fear of Missing Out)
“Bot không trade, tôi đang miss opportunities!” — Skipped trades không phải losses. Patience là edge.
Overconfidence Sau Win Streak
5 wins liên tiếp → urge increase stake. Đây là khi traders blow account. Stick to plan, win streak không change math.
Loss Aversion Paralysis
Sợ loss đến mức không deploy bot. Calculated risk với proper sizing = acceptable. Inaction cũng là decision.
Common Risk Management Mistakes
⛔ Avoid These
1. Martingale/doubling: #1 account killer (xem tại sao)
2. No daily loss limit: 1 bad day → catastrophic
3. Stake quá lớn: 10%+ per trade = vulnerable to variance
4. All-in 1 asset: No diversification
5. Trade money cần thiết: Psychological pressure phá discipline
6. Never withdraw: “House money” effect
7. Ignore drawdown psychology: -30% drawdown breaks most traders mentally
Implement Trong Bot
Mọi bot phải có risk management built-in:
- Deriv Bot: Risk Management blocks (daily limit, cooldown) — tutorial
- Python: RiskManager class — code complete
- MT5 EA: CalculateLotSize function + position limits — tutorial
🚀 Test risk management trên Deriv demo (KHÔNG risk real money):
Mở Demo Deriv Miễn PhíBài Liên Quan
- Tại Sao Martingale Fail
- Deriv Bot Risk Setup
- Python RiskManager Class
- Backtest & Drawdown Analysis
- Real Test với Risk Management
