Control of orders and positions

Functionality available in the PRO version.

There are a number of situations when unwanted orders and positions may appear on the exchange:

  • VDS provider maintenance, network failures
  • Software errors in the work of the bot or the exchange
  • In manual trading – interference in the work of the bot, an attempt to close a position through balances or through the exchange application.

When trading manually, it is enough (and necessary!) to simply tick Ignore Replacing Bug (Settings – special), the principle of its operation is explained in more detail at the end of the article.

When trading manually, you can see the orders and positions yourself and can take action to close them.

In autotrading, if for example the bot is installed on a VDS, and there is a network failure on this VPS, the bot will not be able to do anything.

To solve this situation, the control functionality is developed. Monitoring bots and working bots must be located in different regions or at different providers!  

Setup:

1) On the working bot should be ticked “Monitor orders of this bot”, optionally set the IP VDS with the tracking bot (for control by ping).

2) Configuring tracking bots:

  • Open the UDP port specified in the bot (in Fig. it is port 2704). Spot and different futures pairs use different ports. These ports are used for ping control.
  • Fill in the table of keys from working bots. The keys must be from different exchange accounts! If you enter keys from the same account in two lines, the bot will not be able to correctly determine which account should be managed and will mark both lines in the status with the inscription duplicate.
  • If the keys are entered incorrectly, or if no rights or IP whitelist is set for them, the Status column will show an error.
  • The O tick in the table is responsible for controlling orders by time of existence (Time column, seconds) and by distance to the current price (Price column, percent). The order will be cancelled after reaching the specified time or approaching the specified price distance.
  • The P tick is responsible for position control. If it is enabled, the bot will detect positions hanging without take-profits, report about them in Telegram, and with the Autosell tick, will automatically sell. It is possible to set the number of coins excluded from the position control algorithm.
  • Autosell is performed by a special manual strategy called “SafeGuard”. The strategy is created automatically at the first such sale, after which you can edit its settings.
  • The IP tick is responsible for ping control. If the IP of the tracking bot is correctly set in the working bot, and if the ping does not pass within 10 seconds, orders to open positions will be cancelled (this does not apply to takeouts, the control algorithm does not cancel the take-profits).

3) Number of monitoring bots:

 Spot: 1 bot monitors all accounts (and will cancel orders for all pairs; look for and sell hanging positions in the base currency it works on)

Futures: 1 bot per market (will cancel orders and look for hanging positions only for the market on which it works).

Total number of tracking bots required:

1 bot tracking the spot market of Binance exchange

1 bot tracking the USDT futures market on Binance exchange

1 bot tracking the Binance quarter market

1 bot tracking the spot market on Huobi exchange

1 bot tracking the spot market on Bybit exchange

1 bot tracking the futures market on Bybit exchange

You can insert 20-30 API keys into each tracking bot. A larger number of keys can lead to an API ban when the bot starts cancelling all orders on all accounts at once; therefore, if there are more than 30 accounts, it is required to additionally separate the monitoring bots on different servers (since the API load is counted by server IP). So that each bot has no more than 30 keys.

Read more about the Ignore Replacing Bug tick box:

The auto-sell of hanging positions and the Binance ignore replacing bug functions are closely related: if you enable the ignore, there may be hanging positions that need to be sold by the monitoring bot.

If you do NOT enable error ignore, then on the contrary, when the working bot loses an order, the monitoring bot may perceive this as a hanging position and sell it, after which the working bot will find the order and sell it again.

What happens:

Now, if an order is lost due to an error, the bot searches for it (in the order history) for some time. This is the ” replacing” lag – when it is not known whether the take is placed or not.

With this option enabled, if an order is lost due to an error, the bot does not search for anything, but simply places a new one. Sell does not hang in the replaying, because it is immediately placed again, but there is a possibility that this way 2 sells will be placed (instead of 1). This can lead to double buying and position hangs, and the hanging position will be handled by position control.

Brief summary:

When trading manually, it is mandatory to switch on the Ignore Replacing Bug tick box and manually monitor for “extra” positions (via menu-balances).

When auto-trading it is desirable to switch on the Ignore Replacing Bug checkbox and set up monitoring bots.