Addendum — Scaling In and Out of Trades

ArcTaurus
8 min readApr 12, 2022

Expounding upon our previous post, here we will discuss the automation of our trading strategy using an ArcTaurus trading bot. Visit our website to create an account and copy this strategy!

Be sure to read the previous post before continuing further!

In our previous post we discussed a strategy for scaling into and out of a position, such that we don’t enter with an “all or nothing” mentality. Such strategies are important for managing risk as they allow us to add to our position size as the trade idea confirms, while minimizing downside in case our idea gets invalidated.

However, constantly monitoring a position can be time consuming — ArcTaurus is focused on helping you minimize the amount of time spent staring at charts while maximizing your trading efficiency. Therefore in this post we will program a bot that follows the strategy from the previous post as closely as possible.

Note: none of this should be interpreted as financial advice.

Let’s dive in…

First things first, make sure you have an account set up at ArcTaurus where you can create bots for free with our advanced no-code GUI. After your account is set up, click on “My Bots” and then create a new empty bot.

After you’ve created an empty bot, you’ll see something like this:

This is the default cell for setting up our bot. We want our bot to operate on the 1m timeline, as we want to make sure our order is executed as soon as the price reaches our entry point. We are using the XBTUSDT pair (the Bitcoin ticker on Kraken — XBT and BTC are the same thing) for this entire bot, so we want to click on VARIABLES and then create a new variable called TRADING PAIR which we will then set to XBTUSDT. Do this by choosing the cell for asset pairs, where you can enter XBTUSDT in the search field to select Bitcoin/USDT as the asset pair. (Note: other exchanges usually use the “BTCUSDT” pair for Bitcoin/Tether. Check your linked exchange for exact asset pairs)

Next, we want to create a few more important variables for this trade, which should be familiar to any trader. We need an ENTRY PRICE, TARGET PRICE, POSITION SIZE, and STOP LOSS defined before we begin any trade. Let’s define these by clicking on VARIABLES and creating new variables for each of these. If you refer to the previous blog post, you can see that we have defined each of these:

  • Our (first) entry price is $37674
  • Our target price is $44420
  • Our stop loss is $36911
  • Our initial position size is 0.25 (we will be scaling in by 0.25 BTC increments)

In order to add values to the variables, click on MATH and choose the numerical bubble at the very top, and drag it into each of the newly created SET VARIABLE blocks:

So far so good. Next, we want to enter an order block. You can find this in ORDER TYPES where you will select the largest block and drag it into the Setup Bot cell. After doing so, be sure to include the asset pair XBTUSDT again. Why are we selecting the asset again? Well, with ArcTaurus you can use one asset as a signal for another asset, e.g. buying ETH when the price of BTC reaches a specified level. For this bot, we want XBTSUDT to be both the signal and asset that we are trading.

We want our order to be a buy limit order, so make sure you choose LIMIT ORDER from the order type dropdown menu, and BUY as the order side. We defined our position size variable earlier, so click on VARIABLES and drag the bubble into the VOLUME cell and from the dropdown menu make sure POSITION SIZE is selected. Leave SAVE ORDER ID checked, as this is useful for referencing this order for triggering other bot mechanics. We also defined our entry price variable earlier, so drag the variable cell into the PRICE cell and select ENTRY PRICE 1. Finally, let’s change the name of the order ID by clicking ORDER ID SAVED AS and renaming the variable to “Trade 1” which we will need to reference later.

At this point, this is what we have:

Now that we have our initial limit order set up, we can start adding conditions to our trade to make things more complex. If you refer to the previous blog post, you will see that our strategy was to scale into the trade after confirming the liquidity zone around $37k holds. We want to encode these three conditions:

  1. Close the position if the support doesn’t hold
  2. Let the position ride if it does hold
  3. Add to the position if we see bullish momentum

Condition 1 is satisfied purely via the stop loss order. We can set up a stop-loss order as such:

As you can see above we create a stop loss order at the predefined stop loss price. Once the initial entry is hit, this condition will automatically place a stop-loss order for the total amount of BTC in the wallet AT THE TIME OF THE TRADE BEING OPENED. This means that a stop-loss for 0.25 XBT will be opened, meaning any new trades opened after this condition is met will need a new stop-loss order as well. If you are running multiple bots through the same wallet (we don’t advocate doing this unless you are an experienced bot engineer) you will need to create a specific variable for sizing positions within each bot.

Moving on, we know that Condition 2 is satisfied just by letting the trade reach its target. For this we need to set a take-profit order:

Condition 3 can be enforced in a number of ways. For the sake of simplicity, let’s say that Condition 3 means buying any dip after our entry.

We will first need to create a conditional statement to trigger further orders, which we can do by selecting the WAIT UNTIL in the LOGIC menu and dragging it under our current existing order cell. We want multiple conditions to be true before triggering a new order, so we insert the ALL OF THESE ARE TRUE cells into the WAIT UNTIL cell.

The two sub-conditions we want to be true are thus:

  1. We want our initial limit order to be filled
  2. We want the price to go up a bit (bullish momentum) before setting a new limit order

For sub-condition 1 we select the ORDER IS CLOSED cell from EVENTS, then drag in ORDER ID from ORDER TYPES and select ENTRY 1 as our order. In this context, an order being “closed” means that it has been filled and no longer exists on the order books.

For sub-condition 2 we select the MATH COMPARISON cell from LOGIC:

and drag it below the currently previous condition. On the left side of the equivalence we insert from MARKET INFORMATION the ORDER BOOK cell and choose the Last Price of XBTUSDT, and on the right side of the equivalence we select the NUMERICAL CELL from MATH. We want to pick a price level that we expect the price to pump to before dipping again, so for the sake of this tutorial let’s choose an even $40000. This isn’t our exit target price, this is just a reasonable price (it’s short-term resistance at this point) that we can expect a pump to before a dip occurs. Your WAIT UNTIL block should look like this:

With this WAIT UNTIL block we will wait until our entry order is filled and the price of BTC pumps to $40k before executing additional orders to scale us further into the trade. At this point we need another ORDER BLOCK where we define the next conditions to increase our position size. If we want to “buy the dip” we will want to set a new limit order above our previous order to ensure that it gets hit. Let’s choose $39000 as the next entry level, called Entry 2, and set it below the WAIT UNTIL block:

We’re almost there! At this point, our bot will enter a position of 0.25 BTC at $37674, set a stop loss at $36911, and will “buy the dip” if it pumps to $40k and then back down to $39k. Since this new order will not be counted in our previous stop-loss order, we need to set another stop-loss order for the “buy the dip” order:

The last step we need is to close the position, regardless of the size, at the exit target of $44420. We do this just by adding another order block and setting it to TAKE PROFIT:

Finally adding this to the bottom of our bot stack, with a final END OF TRADE condition attached:

Let’s review what we’ve done: We have set an entry, stop loss, and target price for our trade. Once the entry is hit, we set another limit order to “buy the dip” if the price pumps to $40k and then dips to $39k. If the price ever goes to our stop loss level, it will sell 100% of the BTC in our wallet. If the price reaches our exit price, it sells 100% of the BTC in our wallet.

Finally, we want to uncheck REPEAT FOREVER and set REPEAT 0 TIMES, otherwise this bot will continue to enter positions as long as the entry conditions are met.

Congratulations! You now have automated the entire trading strategy from our previous post!

If you have any questions, feel free to pop into our Discord server to ask either the community or ArcTaurus team for advice. You can also the rest of our links here, or send us an email at info@arctaurus.com.

See you next time!

--

--

ArcTaurus

A no-code automated trading platform for cryptocurrency traders. Follow us for automated trading strategies and tips for using our platform!