> For the complete documentation index, see [llms.txt](https://docs.origami.tech/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.origami.tech/grids/recipes/placing-buy-and-sell-orders-based-on-rsi-of-15-minute-candlesticks.md).

# Buy and sell orders based on 15-minute RSI

Grid recipe: place buy orders at the RSI 40 price level and sell orders at RSI 60, based on 15-minute candles.

Explore an Origami Tech example showing how to place automated buy and sell orders based on RSI signals from 15-minute candlestick data.

Orders are placed at levels corresponding to an RSI of 40 for buy orders and an RSI of 60 for sell orders, or at the best bid or ask price if the RSI moves outside the specified range.

```json
{
  "gap": "0.005",
  "min_low": "orderbook().bid[0].price",
  "max_high": "orderbook().ask[0].price",
  "price_low": "min(rsi_to_price(candles_15m, rsi_expected=40), orderbook().ask[0].price, min_low)",
  "price_high": "max(rsi_to_price(candles_15m, rsi_expected=60), orderbook().bid[0].price, max_high)",
  "candles_15m": "candles('m15')",
  "execute_price": "(price_low if side == 'buy' else price_high) * ( 1 + gap * order_pos)",
  "execute_volume": "cached(60, respect='order_pos')(10/execute_price *abs(order_pos))",
  "buy_orders_count": "5",
  "sell_orders_count": "5",
  "sleep_after_seconds": "900"
}
```

In this example, 15-minute candlestick data is used to estimate the price levels that would correspond to an RSI of 40 and 60 in the next period.

`rsi_to_price(candles_15m, rsi_expected=40)`

`rsi_to_price(candles_15m, rsi_expected=60)`

Bids are placed at RSI 40, and asks are placed at RSI 60 with a price increment of 0.5%, which is defined in the parameter "gap".

Buy orders are placed at the RSI 40 level. Sell orders are placed at the RSI 60 level. A price increment is 0.5%, as specified by the gap parameter.

The volume for each order is calculated as the equivalent of 10 counter tokens multiplied by the order's sequence number.

`10/execute_price` `*abs(order_pos)`

The order grid is updated every 15 minutes.

`"sleep_after_seconds": "900"`
