# Automated Strategies

Strategies presented further were built with Bookmap API that will also enable users to develop customized strategies.

**NOTE**: The strategies described below were developed just as a demonstration of the API capabilities. They not meant for live trading at all and we recommend not to use them as such. Any use of these strategies outside of simulated environment for demonstration purposes only is at the exclusive responsibility and risk of the user.

## Chase Strategy

Keep the limit order at a distance of N or less levels from the best price.

The Chase strategy is designed to keep the limit order following the market. It can also be combined with other strategies such as Escape or Execute strategies.

### Example: Buy Limit Order, Using Chase And Escape Strategies

**A trader sets the following:**
keep the buy limit order at a distance not bigger than 2 ticks from the best price. In addition, if the buy limit order is within 2 ticks from the best price AND and the total size of the first (1) level at the buy order’s side is less than 60% of the opposite side THEN cancel the limit buy order.

The trader’s buy order will follow the best price distance of 2 or less ticks.

- If the market price will go up, the buy order will follow the best price to maintain a distance of 2 or less ticks.
- If price will go down the order will remain on its last price until execution, as long as the conditions of order book imbalance (total best bid is less than 60% of the best ask) are not met.

## Escape Strategy

Cancel or Move limit order(s) if the limit order is at a distance of M or less ticks from the best price AND the total size of the first N price levels at the limit order’s side is less than X% of the size of the opposite side.

The Escape strategy attempts to cancel / move a limit order away from the market if there is an order book imbalance disadvantaging the order’s side of the book.

**Notes**:

- The higher the X percentage configured the more chances that the strategy will be triggered.
- Using larger M values reduces the risk of undesired execution, because in case of significant order book imbalance it has bigger chances to cancel or move the order before the market sweeps the limit order.
- Using smaller N values increases the chance of order book imbalance reading.

### Example: Buy Limit Order with Escape Strategy

A trader wants to buy ahead of a large Bid liquidity. The trader places a buy limit order 1 tick above this large liquidity and sets the strategy as follow:

- If my limit order is within 3 price levels from the best ask price AND the total size of the first2 price levels at the order side is less than 60% of the opposite side then cancel the order.
- If the price goes down and the bid price within a distance of 3 ticks from the buy limit order, Bookmap will check the order book imbalance (the total of the first 2 bid levels vs. the total of the first 2 ask levels). In case the total size of the first 2 bid levels is less than 60% of the total sum of the first 2 ask levels the buy limit order will be cancelled (or moved away from the market if that option has been configured instead of cancelled).

## Execute Strategy

Move a limit order to K ticks ahead of the best price if the total size of the firstN price levels at the limit order’s side is X% bigger than the size at the opposite side.

This strategy will move the order into the market when there is an order book imbalance favoring the limit order’s side.

**Note**:
If K parameter is set to 1 and the spread is greater than one tick then even if the strategy is triggered the order may fail to execute.

### Example: Buy Limit Order with Execute Strategy

A trader wants to go long. The trader places a buy limit order with the following strategy conditions: if the total size of the first (1) levels at the buy limit order’s side is more than 200% than the size of the opposite side, move the limit buy order 2 ticks above the best bid.

In this scenario the buy limit order will wait at the original price until the best bid size (first level) will be 200% greater than the best ask size (twice the size). When this happens the buy limit order will be replaced 2 ticks above the best bid. Assuming the spread is not large.