Backtesting is a method of testing a trading strategy on historical market data to evaluate its effectiveness before applying it to the real market. In the context of trading bots and automated trading, backtesting allows traders to simulate how their strategy would have performed in the past, analyzing potential profits, losses, and risks without risking real funds. This process is a key tool for developing, optimizing, and validating trading algorithms, especially in the highly volatile cryptocurrency market.
What is Backtesting?
Backtesting is the simulation of a trading bot or strategy’s performance using historical data, such as price charts, trading volumes, indicators, and other market metrics. It enables traders to:
- Evaluate strategy profitability: Understand the results a strategy could have generated in the past.
- Identify weaknesses: Pinpoint scenarios where the strategy may incur losses.
- Optimize parameters: Fine-tune indicators, stop-loss, take-profit levels, and other settings to improve efficiency.
- Reduce risks: Test the strategy in a safe environment before deploying it in the live market.
Backtesting is particularly crucial in automated trading, as bots operate based on predefined algorithms, and their success depends directly on the quality of these algorithms. Without backtesting, traders risk deploying untested strategies, which can lead to significant financial losses.
Why is Backtesting Important?
- Reducing financial risks: Backtesting allows traders to test a strategy without using real funds, minimizing the risk of losses in the live market. This is especially critical in cryptocurrency trading, where volatility can be extreme.
- Optimizing strategies: Analyzing historical data helps identify optimal parameters for indicators, take-profit, stop-loss levels, and other bot settings, enhancing strategy performance before launch.
- Validating strategy reliability: Backtesting shows how a strategy performs under various market conditions—bullish, bearish, or sideways trends—helping determine its long-term viability.
- Time efficiency: Instead of testing a strategy in real-time on a demo account, which can take weeks or months, backtesting analyzes results on months or years of data in minutes or hours.
- Confidence in trading: Successful backtesting results give traders confidence that their strategy has the potential to perform in the live market, reducing emotional stress and fostering discipline.
- Risk and reward analysis: Backtesting provides metrics such as maximum drawdown, profit-to-loss ratio, percentage of profitable trades, and other indicators to assess the balance between risks and potential returns.
Limitations of Backtesting
Despite its importance, backtesting has limitations that traders should consider:
- Historical data does not guarantee future results: The cryptocurrency market is constantly evolving, and past performance does not always predict future outcomes. Economic events, regulatory changes, or technological updates can impact market behavior.
- Data quality: Backtesting results depend on the quality and accuracy of historical data. Gaps or errors in the data can distort results.
- Slippage and fees: Some backtests may not account for real-world trading fees, spreads, or slippage (the difference between expected and actual order execution prices), which can affect actual profitability.
- Over-optimization (overfitting): Fine-tuning a strategy too closely to historical data can make it perform perfectly in the past but fail in the live market due to a lack of flexibility.
Backtesting on the Veles platform
Veles is a platform for creating and managing trading bots for the cryptocurrency market, integrated with popular exchanges such as Binance, Bybit, OKX, Gate.io and others. One of Veles’ key features is its powerful backtesting tool, which allows users to test strategies on historical data with high accuracy. The platform provides access to its own database of minute-by-minute candlestick data, enabling detailed analysis.
Advantages of Backtesting on Veles
- Access to historical data: Veles maintains its own repository of minute candlesticks, containing billions of bars for various assets, allowing for precise high-resolution tests.
- Flexible settings: Users can customize bot parameters, including indicators (RSI, MACD, Bollinger Bands, etc.), take-profit, stop-loss levels, order sizes, and more.
- Intuitive interface: Veles offers a user-friendly interface suitable for both beginners and professionals, with clear visualization of test results and easy navigation.
- Free tests: Each user gets 10 free backtests every 24 hours. For more intensive use, the Backtests PRO subscription offers unlimited tests for 30 days.
- Exchange integration: Veles supports API connections to major cryptocurrency exchanges, enabling strategy testing in conditions closely resembling live trading.
- Public and private tests: Users can share test results publicly or keep them private (with a Backtests PRO subscription).
Step-by-Step Guide to Backtesting on Veles
Below is a detailed guide to creating and testing a trading strategy using backtesting on the Veles platform.
- Step 1: Registration and Account Setup. Create an account: Visit veles.finance and click “Register” in the top right corner. Enter your email and password, then confirm registration. No email verification is required, and you’ll be directed to your personal dashboard immediately. Connect an exchange: In the dashboard, go to the “API” section. Generate an API key on your chosen exchange (e.g. Binance, Bybit, OKX) with trading-only permissions (no withdrawal rights). Follow the instructions in the “How to work with exchange” section for proper setup.
- Step 2: Creating a Bot. Go to the bot creation section: In your dashboard, select “My Bots” or “Create Bot.” Choose the exchange, trading pair (e.g., BTC/USDT), and trading type (spot or futures). Spot trading is recommended for beginners as it is less risky. Set up the strategy: Select indicators: For example, RSI, MACD, Bollinger Bands, or a combination of multiple indicators to define entry points.
Define entry conditions: For instance, for a moving average (SMA) strategy, set the condition: “Short SMA (10 periods) crosses above long SMA (50 periods)” for buying, and the reverse for selling.
Set take-profit and stop-loss: A take-profit of 0.5–1% is recommended for frequent exits. The stop-loss should exceed the longest candlestick shadow (available in test results) to avoid false triggers.
Set filters: For example, “RSI 1 min > 0” or “Price > 0” for strategies without strict entry conditions. Set budget and leverage: Specify the bot’s deposit. Use no more than 30% of your total balance to minimize risks. For futures trading, set moderate leverage (x2–x5) to avoid liquidation during sharp market moves. Save the bot: After configuring the parameters, click “Create Bot” and name it. The bot will appear in the “My Bots” section. - Step 3: Running a Backtest. Select the bot for testing: In the “My Bots” section, locate the created bot and click “Analysis” or “Backtest.” Ensure proper settings: Verify that all filters are set to “Bar close” (the “Once per minute” method is not supported for backtesting). Set test parameters: Test period: Up to 3 months in the free version, or up to 1 year with Backtests PRO. Data may be limited for recently added assets or exchanges. Public or private test: With Backtests PRO, you can disable the “Public test” option to keep your strategy confidential. Verify settings: On the second screen, ensure all parameters (indicators, take-profit, stop-loss) are correctly configured. Start the backtest: Click “Start Backtest.” Processing time depends on the complexity of the settings and the selected period. Monitor progress in the veles.finance/cabinet/backtests section. If 5 tests are already in progress or pending, new tests cannot be started.
- Step 4: Analyzing Results. Review test results: After the backtest completes, you’ll receive a results screen showing: Gross Profit: Total profit/loss in the asset or USDT (excluding fees and funding costs).
Maximum Drawdown: The largest loss from peak to trough. Number of trades: Total profitable and unprofitable trades. Risk/reward ratio: A measure of strategy efficiency.
Share results: Use the “Share” button to generate a link to discuss results with friends or experienced traders. Evaluate performance: Check the percentage of profitable trades. For example, a strategy with 60% profitable trades and 15% annual return (e.g., SMA strategy) is moderately successful but may need refinement. Assess drawdown: A high drawdown (e.g., 8%) suggests the need to optimize stop-losses or filters. Optimize the strategy: If results are unsatisfactory, adjust indicator parameters, take-profit, or stop-loss levels and run a new backtest. For example, for an SMA-based strategy, reduce moving average periods or add an RSI filter to eliminate false signals. - Step 5: Launching the Bot on the Live Market. Verify backtest results: Ensure the strategy shows stable results across multiple test periods to confirm its robustness. Start the bot: In the “My Bots” section, select the tested bot and click “Start.” Monitor its performance via the dashboard, which displays open and closed positions, profitability, and risks. Monitor and adjust: Regularly check the bot’s performance, especially during high volatility. Make adjustments to the strategy or pause the bot manually if needed.
Example of Backtesting a Strategy on Veles
Let’s consider an example of testing a simple moving average (SMA) strategy for the BTC/USDT pair:
Bot Setup:
- Trading pair: BTC/USDT
- Indicators: Short SMA (10 periods), long SMA (50 periods)
- Entry conditions:Buy: Short SMA crosses above long SMA.
- Sell: Short SMA crosses below long SMA.
- Take-profit: 0.8%
- Stop-loss: 1.5%
- Budget: 1000 USDT, no leverage
Backtest Setup:
- Test period: 3 months
- Test type: Public
- Filters: “Bar close”
Results:
- Profit: 15% annually
- Maximum drawdown: 8%
- Number of trades: 50
- Profitable trades: 60%
Conclusions:
The strategy shows moderate profitability, but the high drawdown suggests the need for optimization. For example, adding an RSI < 30 filter to confirm buy signals or increasing the take-profit to 1% could improve results.
Recommendations and Common Mistakes
Recommendations:
- Start with simple strategies: Beginners should use pre-built bots from the “Showcase” section or simple strategies based on one or two indicators (e.g., RSI or SMA).
- Test across different periods: Run backtests on various timeframes (1 month, 3 months, 6 months) to assess strategy stability.
- Account for fees: Veles charges 20% of profits (up to $50/month). Ensure your strategy accounts for these costs and exchange fees.
- Diversify: Don’t allocate your entire deposit to one bot. Use no more than 30% of your balance across all bots.
- Explore Veles Academy: The Veles Academy section offers tutorials and videos to better understand bot setup and backtesting.
Common Mistakes:
- Ignoring stop-loss: Without a stop-loss, bots can incur significant losses during high volatility.
- Over-optimization: Over-tuning a strategy to historical data can lead to poor live market performance.
- Short test periods: Testing on a short period (e.g., 1 week) may not reflect the strategy’s true effectiveness.
- Ignoring market conditions: Ensure the strategy is tested across trending and sideways markets.
- Incorrect filters: Using “Once per minute” instead of “Bar close” makes backtesting impossible.
Additional Tips for Backtesting on Veles
- Use on-chain analytics: Veles supports integrating on-chain metrics (e.g., MVRV, SOPR) to enhance strategies. For example, configure a bot to buy when assets are undervalued based on MVRV signals.
- Test with a small deposit: Start with a modest budget (e.g., 100–300 USDT) to minimize risks when launching a bot in the live market.
- Check candlestick shadows: Ensure the stop-loss exceeds the longest candlestick shadow (available in test results) to avoid false triggers.
- Use pre-built bots: Beginners can start with optimized bots from the “Showcase” section to familiarize themselves with the platform.
- Contact support: Veles’ technical support is available at help.veles.finance to assist with bot setup and interpreting backtest results.
Conclusion
Backtesting is an indispensable tool for traders using trading bots and automated trading. It minimizes risks, optimizes strategies, and boosts confidence in trading decisions. The Veles platform provides powerful and flexible backtesting tools suitable for both beginners and experienced traders. With its intuitive interface, access to historical data, and integration with leading exchanges, Veles simplifies the process of creating and testing strategies.
By following this guide, you can set up and test a trading strategy, minimize risks, and increase your chances of success in cryptocurrency trading. Remember that backtesting is not a guarantee of future profits but a powerful tool for making informed decisions. Use it wisely, study the market, and regularly optimize your strategies.
Additional Resources on Veles:
Subscribe to our Telegram channel.