Source: https://hamster-bot.com/en/algo/rsipullback

[← All strategies](https://hamster-bot.com/en/algo)

# RSI Pullback

Entry on a pullback in the direction of the trend (`rsipullback`). The direction is set by a moving average (EMA 200 by default): long only when the closed bar is above it, short only below. Inside the trend the strategy waits for a pullback shown by RSI and enters when the pullback ends.

- Long: price above the trend MA and RSI coming back from oversold - crossing `oversold` upwards
- Short: price below the trend MA and RSI coming back from overbought - crossing `overbought` downwards
- With `entry_on_cross` off, the strategy enters right away while RSI is in the zone, without waiting for the return
- Entry with a market order on a closed-bar signal
- Exit: RSI reached `exit_long_rsi` / `exit_short_rsi`; a closed bar crossed the trend MA against the position (`exit_on_trend_break`); stop, target and trailing stop in ATR. The common exits from the `options` block work too

The bot chart shows the trend MA.

**ATR stop, target and trailing stop.** At entry the bot stores the ATR and computes the levels: stop = entry price ∓ `stop_atr` × ATR, target = entry price ± `take_atr` × ATR. The trailing stop follows the best price since entry at a distance of `trail_atr` × ATR and works together with the stop - whichever is closer to the price triggers. Levels are checked on every tick against the current price and the position is closed with a market order. Levels are saved in the bot state and survive a restart. If the position was opened manually or by another strategy, the levels are computed from its entry price and the current ATR.

**⚠️ Weak spot - trend change: the pullback the strategy bought may turn out to be the start of a reversal. The ATR stop and the exit on a trend MA break protect against it.**

#### Parameters

The `rsi_pullback` block in the bot settings, `basic.strategy`: `rsipullback`

- `rsi_len`, `rsi_source` - RSI period and source (default 14, close)
- `oversold` - oversold level for long (default 30)
- `overbought` - overbought level for short (default 70)
- `entry_on_cross` - enter when RSI comes back from the zone (default). When off - enter while RSI is in the zone
- `exit_long_rsi` - close long when RSI rises to this level (default 55). 0 - don't close by RSI
- `exit_short_rsi` - close short when RSI falls to this level (default 45). 0 - don't close by RSI
- `trend_ma_type`, `trend_ma_source`, `trend_ma_len` - trend MA (default EMA, close, 200)
- `exit_on_trend_break` - close the position when a closed bar crosses the trend MA against it (on by default)
- `atr_len` - ATR period for the stop, target and trailing stop (default 14)
- `stop_atr` - stop distance from the entry price in ATR (default 2). 0 - no strategy stop
- `take_atr` - target distance from the entry price in ATR (default 0 - no target)
- `trail_atr` - trailing stop from the best price in ATR (default 0 - no trailing stop)

**Entry filters** (MA trend, ADX, liquidity, time) are now set in the common `filter` block and work the same way in most other strategies - see «Position filters» in the «Position closing and common options» section. The old `entry_filter` block in the strategy settings is moved there automatically on load.

---

Backtest the strategy on historical data in the [tester](https://hamster-bot.com/en/tester) and run it in [hamster-bot](https://hamster-bot.com/en/download).
