ScaleTrader Algo

Introduction

ScaleTrader originates from the notion of averaging down or buying into a declining market at an ever-lower price, or on the opposite side, selling into a toppy market or scaling out of a long position. It evolved to additionally support pair trades and multi-leg combos with built-in profit-taker that runs until canceled. The ScaleTrader can be deployed for all products traded at IB except mutual funds, and it provides three flexible scale templates:

  1. Simple - Create a simple scale trade for a single underlying that helps you buy into a weak, declining market at ever-lower prices or sell into a toppy market, or scale out of a position.
  2. Pair – Create a strategy for two related stocks, basically stock-stock combo, where you buy one and (trade) SELL the other using the price difference between the two.
  3. Combo – Create a multi-leg generic or named strategy for stock, options and futures combos.

In this webinar we’ll take a look at the Simple scale trade and then the ScaleTrader for Pairs. Although I’ll be discussing the algos from the buy perspective, everything we discuss today works in the reverse and for different products.


ScaleTrader Overview

For our first example, we’ll create an algo order to buy into a stock that we believe may be approaching the bottom of its trading range. Scaletrader will buy as the stock approaches the bottom of the range, and sell as it recovers, and then buy again in a subsequent decline. This is called trading from the long side.

You know that for convenience, we provide several different ways to open each TWS tool. Today we’re starting from within the Mosaic, which we’re hoping will become the default starting point for customers going forward. We advertise the Mosaic as IB’s comprehensive order, research and analytics interface and it’s basically powered by the IBIS subscriptions along with the users’ market data packages. We could open the ScaleTrader with the New Window dropdown, you can see that if I scroll all the way to the bottom and click More Advanced Tools you’ll see the ScaleTrader up near the top of the list. But instead we’re going to start from within the Mosaic Market Scanner, which we can use to find a stock trading near the bottom of its trading range.

The Mosaic doesn’t have the 52 week high/low scanner that I wanted, so I’ll quickly create one. From the Watchlist Plus window in the Mosaic, click the New Tab icon and choose “Market Scanner.” Create a custom scan, and select the 52 week high and 52 week low fields from the Add Field list in the Fields and Filters section. I’ll put the 52 week low next to the “Last” field to make it easier to pick a stock whose 52 week low is closest to its current last price. Once I find the symbol I want, I can right click, select Trade and then order ticket, and from the Scale tab open the ScaleTrader.


Simple Scale Order

The ScaleTrader always opens on the Simple tab, and this is where we’ll be starting today. The algo includes two other tabs, Pair and Combo. First we’ll create a simple scale order to help understand the concepts, and then we’ll move on to the Pair tab and create a pair algo.

By default the “Buy” radio button is selected and we’ll leave that as is.

Now we’ll enter Maximum Position, which is the total number of shares we are willing to buy as the price falls. (use 10000). Note that this field applies only to the position as it relates to this algo.

Since we don’t want to submit the entire 10000 share order all at once, we need to define the size of the components we want to send. The initial size is the number of shares you want to buy at the starting price, and the subsequent size is the number of shares the algo will submit to buy at each successive, decreasing price level as defined by the price increment. We’ll specify a 400 share component size for both the initial and subsequent sizes. And we’ll use Randomize size to help keep the algo from begin detected in the market. With a 400 component size, randomized, submitted components could be 200, 300, 400, 500 or 600 (plus or minus 55% rounded to the nearest 100).

Enter the starting price and the price increment. We’ll set the starting price to the bid, and the price increment to 2 cents. This means that each size component will be submitted at 2 cents lower than the preceding component.

Now take a look at the calculated Top and Bottom prices. Because our initial and subsequent sizes are the same, the Starting and Top prices are also identical. If our initial size was greater, the top price would also be greater than the starting price by the number of subsequent component sizes higher than the initial component times the number of price increment differences. For example, if we set the initial component size to 800 which is 2 component sizes higher than the subsequent size of 400, the starting price would be 2 x 0.02, or 4 cents higher than the starting price. This is only important if you’re using the ScaleTrader to sell out of a position and is described in more detail in the TWS Users’ Guide.

The bottom price is the price at which the last buy order will be filled if the price goes out of range on the down side. If we change the bottom price, you can see that the price increment changes automatically to compensate. You can change prices by dragging lines in the chart or by manually entering a price.

Now we pick an order type, and we can choose from a limit or a relative order. If we use the relative order with no offset, the orders will always peg to bid even if the price increment for a component calls for a higher price. If we add an offset of 0.01, we will bid a penny higher than the best bid as long as it is equal to or lower than the next buy price on the scale. Using the penny offset gives a much better chance of getting filled, but at a potentially lower price than the scale price.


Profit Offset

At this point, we could transmit a valid scale order and the Scaletrader will attempt to achieve our maximum position and then the scale will be finished. Traders often use that strategy to “scale into” a long position.

But that’s not what we’re looking for here. We can sell into periodic surges or liquidate our position once we reach a specific profit objective by electing to Create profit taking orders and specifying a profit offset.

The profit offset is the amount of profit we require on a turn-around trade. So if we set the offset to 20 cents, the first sell order will be submitted at 20 cents higher than the price for the first buy component. Now here’s an important point. If the buy order fills at a better price that what’s on the scale per the relative order pegging to the bid, the associated sell order will still define its price using the static price increments; it doesn’t adjust the sell price off the price of the actual fill. We keep the extra profit we get at any time the stock gaps.

As the stock advances, the position will be sold out in the Subsequent Component Sizes and at the successive Price Increments that we set when we started buying it. The last sale will be at the top price plus the 20 cent profit offset.


Restore Size

If we submit the order at this point with only the Profit offset feature, the algo will buy and sell at each price level only once and the algo will be finished.

However, we can also tell the algo to Restore the order size after taking a profit. This means it will attempt to repurchase the shares that were just sold for a profit at the price at which we originally bought them. This allows us to buy and sell repeatedly in a fluctuating market just like a market maker would. This strategy will be most effective if we set the price increment and profit offset to low enough levels. So let’s change the profit offset from 20 cents to 4 cents.

With this scenario, the algo will remain active as long as the stock price stays in the range defined by the (top price + Profit offset) and the bottom price.


Create a Pair Trade

Now let’s look at creating a pair trade. Pair trading in the ScaleTrader involves trading the price difference of a two-leg, non-guaranteed stock/stock combo. Once the pair is set up, we treat the price difference just as we treated the actual stock price of the simple trade.

Today we’ll look at a pair trade on two stocks that have displayed a close price relationship in the past, in this case Wal-Mart and Target, but whose prices have diverged. We’ll buy the higher priced stock as it comes down, and sell the lower as it rises although we’re doing this as a two-leg combo, which we will buy. And although we’ll discuss the pair trade from the buy perspective, as I mentioned earlier, everything we discuss works in the reverse and for different products.

First we need to click the Pair tab, and then Edit Pair. Now we can enter the tickers for the two legs. We’re setting this up to to buy the higher priced stock and sell the lower priced stock, which we believe to be overvalued relative to the other.

The Net amount is the difference between the legs (leg size x price difference) and the Price difference shows the difference between the underlying prices. We’ll select Price Difference and then click Create to create the pair.

First we have to acknowledge that IB cannot guarantee this combo, which means that it is possible, although very unlikely, that only one leg of the pair will fill. If this happens, the order on the other leg may be fill at a worse price, but you will not be left with an unhedged position.

Now let’s look at the ScaleTrader chart. You might expect that it would be charting the two tickers in our combo, but it’s actually showing the price difference between the two, which is what we’ll be trading. You can click the time periods to see the chart over 3 months, 6 months and a year.


Set up the pair order

The basic order parameters are similar to those we created for the simple example we created first. We’ll create a buy order, and note that the component size comes before the Max Position field when we create the pair.


Profit Taking Order

Although we could submit the scale order with just these parameters, we’re looking for a different result. We will continue specifying parameters that instruct the algo to buy and sell, to better help us capitalize on any fluctuations in the market.

First we will create a profit taking order, which instructs the algo to submit an opposite side order, in this example that will be a sell order, when the current order fills. As we noted for the basic order, the profit taker price is based on the current order component price plus the profit offset, not the current order FILL price.

Let’s enable this feature and set the profit offset to 2.00. Here’s an example of how this feature might work. For the sake of simplicity, we’re ignoring the “Randomize Size” setting. Let’s say the first 400 share buy order component is submitted at the starting price of five dollars. Once that order fills, a 400 share SELL order is submitted at $7.00, which is the component price plus our specified profit offset. At the same time, the next 400 share buy component is submitted at $4.95, since we set our price increment to 0.05. When this next component fills, the next sell order for 400 shares is submitted at $6.95 (again, the component price of 4.95 plus the two dollar profit offset) and the next 400 share buy component is submitted at the next lower price level. This pattern will continue until all components have filled, or the order is canceled.


Restore Size

As we already noted, if we submit the order with only the Profit offset feature defined, the algo will buy and sell at each price level only once and the algo will be finished.

Again, let’s tell the algo to Restore the order size after taking a profit. This means it will attempt to repurchase the shares that were just sold for a profit at the price at which we originally bought them, allowing us to buy and sell repeatedly in a fluctuating market just like a market maker would. This strategy will be most effective if we set the price increment and profit offset to low enough levels. So let’s change the profit offset from two dollars to 20 cents.

With this scenario, the algo will remain active as long as the stock price stays in the range defined by the (top price + Profit offset) and the bottom price.

Here’s how the algo might work with both the Profit Taker and the Restore Size features defined, again ignoring the “Randomize Size” setting for the example. The first 400 share buy order component is submitted at the starting price of five dollars. Once that order fills, a 400 share SELL order is submitted at $5.20, which is the component price plus our specified profit offset. At the same time, the next 400 share buy component is submitted at $4.95, since we set our price increment to 0.05. This may all sound familiar because up to this point it’s the same as the Profit Offset example we just discussed. But now, once the profit taker order has filled at 5.20, the second component size that was submitted at 4.95 is canceled, and the size is restored at the original price, which means that another 400 share buy order is submitted at $5.00. Or it could happen that the profit taker order for $5.20 doesn’t fill, but the buy order at $4.95 does. In this case, a sell order is submitted for $5.15, and if that order fills the size will be restored at the $4.95 level.

This feature allows the algo to continue to run as long as the price difference moves up and down within the valid price range.

With all of the features we want to use set, we can submit the scale order.

If the algorithm stops and needs to be restarted, check the Restart ScaleTrader box, and in the Initial Position fields enter the positions that had been attained when the algo stopped. If the price difference is much higher or lower that it was when the algo stopped, the ScaleTrader may have a lot to buy or sell and may move the market as a result. You can correct for this by changing the Initial Price when you start up, and then move it back gradually using the Auto price adjustment feature.


Conclusion

Today we looked at the ScaleTrader algo using a simple scale order and a more complex scale for pairs. Remember that the ScaleTrader supports all products traded at IB except mutual funds. For both orders, we defined the Profit Taker feature which submits an opposite side order with a user-specified profit amount. We also enable the Restore Size feature so that the trade would continue to run, buying and selling at a profit, while the price (or the price difference for the pair) stayed in the range defined by our price increment and profit offset.

The SCALE TRADER FOR PAIRS is the best tool to manage a LONG SHORT PORTFOLIO.

Scale trading can be a very rewarding strategy as long as you are comfortable holding the specified maximum position should the price decline to that level or further. In this respect it’s similar to writing an option, which is a good strategy as long as you are comfortable sitting with the position you will get, should the option by exercised. And as always, it’s smart to test the features and capabilities of the ScaleTrader in PaperTrader or using the TWS demo.

Any symbols displayed are for illustrative purposes only and do not portray a recommendation.

Interactive Brokers LLC is a member of NYSE, FINRA, SIPC