How to prevent getting liquidated with a crypto trading bot
Introduction
It is the worst nightmare of every crypto trader who uses leverage – receiving a liquidation notice email from their exchange. Every seasoned trader has been there at some point. Questions like “Was I too greedy?” and “Did I forget my stop loss?” pop up in your mind. There are many factors that could cause liquidations, and unfortunately, not all of them can be prevented.
In this article, I will explain what liquidations are, how to prevent them, and how to use them to prevent further losses. Additionally, I will share some of my own experiences.
Using margin while trading crypto with your bot
If you are trading futures, you’ll need to use margin to open positions. It is important to understand the two different kinds of margin that are available.
In crypto futures trading, margin refers to the amount of funds a trader needs to have in their account to open a position. There are two types of margin modes available on most exchanges: isolated margin and cross margin.
Isolated margin allows traders to allocate a specific amount of funds to a particular position, limiting the risk of loss to only that amount. For example, if a trader has $10,000 in their account and they allocate $1,000 to a long BTC/USDT position, they can only lose up to $1,000 if the position gets liquidated.
On the other hand, cross margin combines all of a trader’s available funds to support their open positions, increasing the amount of leverage and risk involved. In this mode, if a position’s losses exceed the allocated margin, the exchange may automatically close other positions to cover the losses.
In summary, isolated margin limits the potential loss to a specific position, while cross margin aggregates all available funds to support open positions, potentially increasing risk and leverage.
Getting liquidated
Getting liquidated happens when your losses exceed the margin you have set aside for your trades, and the exchange automatically closes your position to limit its losses. In addition to losing your investment, getting liquidated can also result in extra costs. This is because exchanges charge a liquidation fee, which can be quite high. Therefore, in every circumstance, you should avoid being liquidated.
There are several reasons why you could get liquidated:
- The price is going down very fast, and your crypto trading bot did not set a stop loss.
- You are in a short position on a trading pair with low liquidity, and a large player hits the market buy button. The price explodes to the upside.
- The leverage you are using is too high. If you are using a leverage of 50X, you could get liquidated with a price movement of less than 2%.
- Technical issues: If an exchange experiences technical issues, such as a sudden loss of liquidity or a trading glitch, it can trigger the liquidation of positions, even if the market is stable.
Using a Stop Loss
To avoid getting liquidated with your crypto trading bot, it is important to use a stop loss while entering a trade. A stop loss is a pre-set order that automatically closes your position when the price of the asset you are trading reaches a certain level. This can help limit your losses and prevent you from being liquidated.
Using Isolated Margin to Protect You in Case of a Flash Crash
Crypto assets can be very volatile. In case of a black swan event, the price can move enormously within a very small time frame. When your stop loss is triggered, your stop loss order is executed as a market order. This causes slippage, and in the event of a flash crash, the slippage could be enormous.
If you use cross margin, getting liquidated could mean you lose all of the assets in your account. Using isolated margin can help limit your losses. It allows you to set aside a specific amount of margin for each individual trade, reducing the risk of losing all of your funds in one go.
For example:
- Your crypto bot trade is using 5% of your total equity for margin.
- You are trading isolated margin.
- Your stop loss gets hit, and the slippage is 7%.
- Your position gets liquidated. You only use 5.5% (your margin + example liquidation costs).
My experiences
In manual trading, I’ve been liquidated a number of times. It is painful, costly, and a reminder that I did, in fact, mess up. It can happen to the best of us, and sometimes it’s unavoidable. On most crypto exchanges, you can’t receive a margin call, and an empty account doesn’t necessarily mean that you need to deposit more funds to add to your margin (as is the case in traditional markets). I’ve seen people get “rekt” that way, losing their homes or increasing their mortgages, etc.
In crypto bot trading, I’ve never been liquidated while trading with significant amounts. This is because, during the initial phases of developing my strategies, I conducted a lot of testing. I found out early on (fortunately) that keeping track of the leverage you use and optimizing the usage of your margin and leverage to trade safely is a crucial key to success in crypto bot trading.
Conclusion
Getting liquidated on a crypto exchange with isolated margin can be a costly mistake. To avoid this, it’s crucial to use a stop loss and manage your margin and leverage carefully. However, you can use isolated margin and getting liquidated to limit your losses if you use it intelligently. Nevertheless, I hope you don’t receive any liquidation emails because they never contain good news.