How to test your crypto trading bot

Are you ready to test a crypto trading bot? Testing is an important step in the development process that can help ensure your bot is making profitable trades in real-world conditions. In this article, we’ll walk through some of the key steps you can take to test your trading bot, from sending signals from TradingView to Binance to using the Binance testnet to see if orders are coming through.

Testing a crypto trading bot is important for trading bot developers, but if you are considering using a crypto bot as a service, it’s also important to understand how the testing process works and what points to check.

I will also share my own experiences, let’s dive in!

Sending signals from TradingView to Binance

One common way to send signals to your trading bot is by using TradingView. TradingView is a popular charting platform that allows you to create custom trading indicators and strategies. Once you have created your strategy, you can send signals to your trading bot using a middleware, which is a software program that acts as an intermediary between TradingView and your exchange. For more information about order execution please click here to go to my article about this.

To send signals from TradingView to Binance, you will need to set up a middleware that is compatible with both platforms. Some popular middleware options include Alertatron, Cornix, and Zignaly. These middleware programs allow you to create custom signals based on your TradingView strategy, and send them directly to your exchange account. However we at Oxido Solutions use our own self hosted middleware.

Our middleware is called Alpha Shifter, it is a swiss knife for algo traders. It receives Tradingview alerts and executes the orders. It has a live position overview, extensive customisation options and really low latency. Because it is self hosted you have full control. If you’d like more information about Alpha Shifter, let me know!

Using the Binance Testnet to test your trading bot

Once you have set up your middleware and connected it to Binance, you can begin testing your bot using the Binance Testnet. The Binance Testnet is a simulated trading environment that allows you to test your trading strategies and bots without using real funds.

To use the Binance Testnet (https://testnet.binancefuture.com/en/futures/BTCUSDT), you will need to create a separate account that is specifically designated for testing purposes. This account will be funded with testnet coins, which are not real cryptocurrencies but rather simulated versions that have no real-world value.

Once you have set up your testnet account, you can begin running your bot in the simulated trading environment. This will allow you to see if your bot is able to execute trades according to your strategy, and to evaluate its performance under different market conditions.

In my experience the testnet is a great tool to see if your orders, stop losses and take profits are being placed the right way. However since it is a testnet the liquidity is really low and it is fake money. This causes strange things to happen on the testnet exchanges. Crazy price spikes and dips. Your stop losses will be hit and your trades will probably not work out the right way.

Sometimes the testnet exchanges are buggy, and often slow. Keep this in mind while testing

Using a small testing account to test real-life trading

While the Binance Testnet is a great way to test your bot in a simulated trading environment, it’s important to also test your bot in real-life trading conditions. One way to do this is by using a small testing account that is funded with a small amount of real cryptocurrency.

By using a small testing account, you can test your bot in real-world market conditions without risking a significant amount of funds. This will allow you to evaluate its performance under real-world trading conditions, and to make any necessary adjustments to improve its performance.

When testing your bot with real funds, it’s important to start with a small amount and to monitor its performance closely. Keep in mind that trading involves risk, and that it’s important to have a solid understanding of the market and your trading strategy before investing significant amounts of funds.

What is important to check while testing my crypto trading bot?

Order logic

  • Is your middleware placing the right order type for the right price?
  • Is your stop loss placed correctly, using the right order type?
  • Are your take profits placed correctly, using the right order type and price?

Position management

  • Is your stop loss updated correctly? Is your old order removed?
  • Are new take profit orders placed correctly with the right order type for the right price?
  • Is your position closed completely when you get stopped out?

Order execution

  • Are your orders filled at the right price?
  • Are your take profits filled at the right price?
  • Are your stop losses executed at the right price?
  • How much slippage do you experience on entries?
  • How much slippage do you experience on take profit orders?
  • How much slippage do you experience while getting stopped out?
  • What is the execution time from signal generation to execution on your crypto exchange? Is it 500 milliseconds, 5 seconds, 50 seconds?
  • How does this time slippage affect your results?

Trading fees and funding

  • How much trading fees do you pay per trade?
  • Is your trading strategy still profitable while paying those fees?
  • How much funding are you paying or receiving per trade?
  • Is your trading strategy still profitable while paying or receiving that funding?
Backtest VS real life

In my experience, it is important to check if your backtest is showing roughly the same results as real-time trading. A backtest will never be 100% the same as the real-life result because it is almost impossible to factor in all variables while trading. Trading fees, funding, and slippage are factors that will influence your real-life results.

So, check if the entries and exits in your backtest match those in your real-life trading. And check what the impact of trading fees, funding, and slippage on your real-life results is. The best way to do this is to trade with a small testing account on a real exchange after you have tested it on a testnet. After that, leave it running for a minimum of a month and cross-check the results of your live account with your backtest.

If the difference is very low (0 – 10%), then you are ok to go. Always try to make the difference smaller by incorporating slippage and fees into your backtest.

Even if your strategy is not profitable, if the difference between your backtest and real-life account is small, the orders are placed correctly, and everything works the way it should, this counts as a great win!

Because now you can focus on improving your trading strategy, make it profitable, knowing that the execution part of your crypto trading bot works.

My own experiences

When I first created my crypto trading strategies on Tradingview, they showed great results, making me feel like I had a money-making machine or a chicken that lays golden eggs. However, the real-life results were nothing like the backtest, and I soon discovered the issue of indicator repainting, which can lead to misleading signals and trading decisions based on past values that change based on future price action.

After going back to the drawing board, I made a new strategy with renewed knowledge and tried various third-party platforms, but I faced issues with slow order execution and using the right order types. Eventually, I found a good middleware solution that allowed me to set up order execution precisely to match my trading strategy.

Countless months of testing and going back to the drawing board, followed by testing with real money, revealed a significant difference between real-life trading and the backtest. After a year of tweaking, customizing, and switching from market to limit orders, I finally got it under control. It is a continuous learning curve to understand my trading system and how middleware and exchanges work. It was frustrating at times, but it is rewarding when the machine works like clockwork.

Conclusion

Testing your crypto trading bot is an essential step in the development process that can help ensure your bot is making profitable trades in real-world conditions. By sending signals from TradingView to middleware to Binance, using the Binance Testnet to test your bot, and using a small testing account to test real-life trading, you can evaluate your bot’s performance and make any necessary adjustments to improve its performance. Good luck, and happy trading!

The opinion expressed in this blog article is for general informational purposes only and is not intended to provide specific advice or recommendations for any individual or on any specific security or investment product.