Common Mistakes
Even experienced traders can run into issues when writing automated bots. Here are some common mistakes to watch out for:
1. Skipping Simulation Mode
Section titled “1. Skipping Simulation Mode”Running untested scripts live can lead to unexpected losses.
✅ Always validate in simulation mode before enabling live trading.
2. Ignoring Exchange Fees
Section titled “2. Ignoring Exchange Fees”Small frequent trades can quickly be eaten up by fees.
✅ Factor in trader.exchangeFee and avoid over-trading.
3. Overfitting to Historical Data
Section titled “3. Overfitting to Historical Data”Building a strategy that works only on past data often fails live.
✅ Use realistic conditions and forward-test in simulation.
4. Trading Too Large, Too Soon
Section titled “4. Trading Too Large, Too Soon”Starting with big positions without proof of performance is risky.
✅ Begin with minimal amounts and scale gradually.
5. Not Handling Missing or Invalid Data
Section titled “5. Not Handling Missing or Invalid Data”Sometimes indicators or candles can return null (e.g., new markets).
✅ Check values before using them in logic:
if (candle.close !== null) { /* ... */ }6. Forgetting to Monitor Bots
Section titled “6. Forgetting to Monitor Bots”Even automated bots require oversight. ✅ Check logs regularly and be ready to pause if something is off.
7. Over-Complicating Strategies
Section titled “7. Over-Complicating Strategies”Combining too many indicators or complex logic can lead to confusion and poor results. ✅ Start simple and iterate step by step.
8. Ignoring Risk Management
Section titled “8. Ignoring Risk Management”Failing to limit losses can wipe out gains. ✅ Include safety mechanisms like:
- Position sizing limits
- Stop-loss conditions
- Manual abort via
trader.abort()
9. Forgetting to Handle Network or Exchange Issues
Section titled “9. Forgetting to Handle Network or Exchange Issues”APIs can fail, data may lag, or markets can behave unexpectedly.
✅ Design scripts to fail safely and avoid placing unintended orders.
10. Leaving Bots Unattended for Long Periods
Section titled “10. Leaving Bots Unattended for Long Periods”Markets change rapidly.
✅ Review performance regularly and adjust strategies if conditions shift.
By avoiding these mistakes and following the best practices, you’ll significantly increase your chances of running safe and effective trading bots.