Backtest
Trading Pair
Time Period
Initial Capital
USDT
Buy Strategy
Sell Strategy
Take Profit
Stop Loss
How backtesting works?
When you select and execute your strategy, our platform retrieves the data related to price and trading volume of your desired trading pair from Binance exchange for the specified time period and then calculates the values of your selected indicators for each candle. For example, if you have selected the RSI (Relative Strength Index) indicator, the RSI value for each candle in the selected time period is calculated according to the chosen timeframe. With the help of this process and comparing its output with your chosen strategy, entry points are identified. Note that if you have used multiple indicators to define the strategy, this step is calculated separately for each indicator and then their combination is used to identify entry points, meaning that all conditions must be met simultaneously for entering a trade.
The next stage is dedicated to simulating trades based on your selling strategy. Our platform allows you to adjust various parameters such as Take Profit and Stop Loss. Using these settings, you can carefully examine how your strategy performs under different market conditions. Therefore, using the entry points identified in the previous stage along with your selling strategy, our platform simulates positions for you and displays the results. These results include metrics such as the number of executed positions, percentage of successful positions, average profit and loss per trade, and other key performance indicators of the strategy. With these results, you can identify the strengths and weaknesses of your strategy and make necessary improvements.
Backtesting Time Period
Note that there is no strategy that is profitable in all markets; you should consider different strategies depending on the type of market. For example, some strategies perform better in bullish market conditions, others in bearish market conditions, and some in neutral or sideways market conditions. Therefore, you should be aware of the time period and the type of market you are analyzing your strategy in. Bitcoin, as the main indicator of the crypto market, plays a significant role in shaping different markets. During the selection of the time period, months when Bitcoin had an upward trend are marked with a green indicator, and months with a downward trend are marked with a red indicator to represent the overall market condition in that month.
Simultaneous Selection of Indicators and Candlestick Patterns
Note that for backtesting or creating a bot, you can use multiple indicators or candlestick patterns simultaneously across different timeframes. For example, you can specify that if a Bullish Hammer candlestick pattern is observed in the 4-hour timeframe, and the price is between the middle and lower bands of the Bollinger Bands indicator in the 8-hour timeframe, it should be considered as a buy condition. However, keep in mind that if you use multiple candlestick patterns in a single timeframe, the platform will not show any output, or in other words, it’s logically impossible for multiple candlestick patterns to occur simultaneously. For instance, if you select both Doji and Bullish Engulfing patterns simultaneously for buy conditions, these two patterns cannot occur in the same candle. Therefore, you should be mindful of this when selecting candlestick patterns and indicators.
How does backtesting help improve strategies?
Backtesting is one of the important tools for optimizing trading strategies. This process allows traders to evaluate the performance of their strategies under various market conditions without using real capital. Using historical data, you can identify market behavior patterns and adjust your strategies to increase efficiency and reduce risk. It can help identify flaws and weaknesses in the strategy and allow the trader to make necessary changes before entering the real market.
One of the key points that successful traders and prominent analysts like Jim Simons emphasize is the importance of backtesting in developing and improving trading strategies. Jim Simons, the founder of Renaissance Technologies, says: "We’re looking for models that can explain historical data well and be predictive." According to him, it helps traders discover different patterns in the data and use them to increase efficiency.
The Importance of Selecting the Right Data for Backtesting
One of the key points in performing successful backtesting is selecting correct and up-to-date data. Our platform, with access to reliable and current data from Binance exchange, allows you to ensure the accuracy and validity of your backtest results. Choosing an appropriate time frame is also very important, as financial markets are constantly changing and evolving, and strategies that have been successful in the past may not be effective in the future. By selecting diverse data from different time periods, you can evaluate the performance of your strategy under various market conditions. Note that if your chosen strategy has been suitable for a selected time frame, be sure to test it also in Bitcoin bearish markets, which are marked with a red indicator during the time period selection.
Advantages and Disadvantages of Backtesting
Backtesting is a powerful tool for evaluating and optimizing trading strategies, but it should be used with care and sufficient knowledge. Traders should be aware of its limitations and consider its results as an initial guide, not a definitive guarantee of success.
- Risk-free strategy evaluation: It allows traders to examine their strategies using historical data without putting their actual capital at risk. This process can help identify the strengths and weaknesses of the strategy.
- Identifying market patterns: Traders can identify market behavioral patterns that may repeat in the future. This information can help improve strategies and lead to better decision-making.
- Strategy optimization: It allows traders to optimize their strategy parameters. By changing various parameters and observing their results, one can achieve an optimal combination of settings that yields higher returns.
- Skill development and education: It is a useful educational tool for traders. By analyzing past data and examining results, traders can strengthen their knowledge and skills in technical analysis and trading strategies.
- Difficulty in predicting the future: One of the biggest drawbacks is that past market performance is not a guarantee for the future. Markets are constantly changing and evolving, and new conditions may be completely different from historical data.
- Overfitting error: Overfitting occurs when a strategy is perfectly matched to historical data but performs poorly in real market conditions. This error can lead to incorrect results and unrealistic expectations.
- Neglecting transaction costs and liquidity: Many backtests ignore transaction costs such as fees and spreads. These costs can have a significant impact on the profitability of a strategy. Additionally, in real market conditions, liquidity may be limited, which can affect the execution of trades.
The Importance of Adaptation and Forward Testing
Overfitting is a common problem in backtesting that can produce inaccurate and misleading results. Overfitting occurs when a trading strategy is perfectly aligned with historical data but performs poorly in real market conditions. To prevent this problem, forward testing or simulating trades in real-time market conditions is crucial. Forward testing allows traders to evaluate their strategies in a more realistic environment with live data. This method helps identify the strengths and weaknesses of the strategy in real market conditions and prevents overfitting. Using our platform, forward testing is available to users, and you can initially run your strategies in DEMO mode for forward testing for a period of time and ensure their performance under real conditions.
What is the "Best Strategy"?
There is no specific strategy that can be considered the "Best Strategy" in financial market trading. The best strategy depends on your trading personality, overall goals, and level of experience. Each trader should carefully evaluate their needs and priorities, then test and optimize strategies that align with them. Additionally, using various technical and fundamental analysis methods, as well as considering market conditions and economic trends, can help you improve your strategies and achieve better results. Utilizing reputable educational resources and consulting with experienced traders can also play an important role in selecting and optimizing strategies. Moreover, adapting strategies to market changes and using advanced tools for data analysis can help increase the accuracy and efficiency of trading strategies. Continuous review and evaluation of strategy performance, especially under different market conditions, and making necessary changes to improve them is of high importance. Employing risk management techniques and using advanced software and platforms can also help you better manage capital and reduce trading risks. Ultimately, maintaining flexibility and readiness to adapt to new market conditions is one of the keys to success in financial trading.
Common Errors
- Lack of trading pair price data on Binance exchange: We retrieve price and volume data from Binance for our calculations. Therefore, this data must be available on the exchange. For example, if you select a trading pair for backtesting that was listed on the exchange in 2020, and set the time period to 2019, you will encounter an error.
- Prerequisites for calculations: To calculate indicator values, we must also consider data from before your selected time period. For example, to calculate SMA (Simple Moving Average), which by default has a Length value of 9, we need price information for 9 candles to calculate the SMA on the tenth candle (the SMA value on the tenth candle is calculated based on the price value of the previous 9 candles). Now, suppose you’ve set a buy strategy in the daily timeframe for April 2023 to buy when the SMA is below the price. Therefore, as mentioned above, considering the first 9 candles, the SMA value is calculated on the tenth candle. In this case, buy points in the first 9 days are lost. To cover this error, for any time period you select for backtesting, the platform must automatically retrieve values from the past 2 months from Binance. Now, it’s possible that your selected backtesting time period is correct, but the 2-month historical data doesn’t exist on the exchange, in which case you’ll encounter an error again. In simpler terms, for any time period you select for backtesting, the price data for that period and the price data for the 2 months preceding that period must be available on Binance.
- Extended backtesting time: Note that the backtesting process is very complex and time-consuming, especially in lower timeframes like 5 minutes. For example, to calculate the RSI value in this timeframe for one month involves calculations for 8640 candles (a 30-day month includes 8640 5-minute candles). Therefore, if your strategy uses multiple indicators in this timeframe, its calculations may take up to several minutes. Conversely, in higher timeframes, such as daily, calculations will be simpler and faster because for each month, calculations are performed for 30 candles (one month includes 30 daily candles).
Final Tips for Successful Backtesting
For success in backtesting, be sure to pay attention to small details as well. Using accurate data, selecting appropriate time periods, and careful analysis of results are key factors in achieving desirable outcomes. It is also recommended that after this process, you examine your strategies in forward testing mode to ensure their performance under real conditions. By following these tips and using the advanced tools of our platform, you can achieve greater success in financial markets.