Bollinger Mean Reversion

Bollinger Mean Reversion is a strategy that trades EURUSD on 1-hour bars. It holds at most 1 open trade and closes its trade on an opposite signal.

pending orders

bollinger-mean-reversion.abx
1strategy "Bollinger Mean Reversion"
2market: EURUSD
3bars: 1h
4max_open: 1
5opposite: close
6
7input length = 20
8input width = 2.0
9
10bands = bollinger(close, length, multiplier: width)
11
12when crosses_below(close, bands.lower) and rsi(close, 14) < 30:
13buy limit: bands.lower, risk: 1%, stop: bands.lower - atr(14), target: bands.middle, expires: 5 bars
14
15when crosses_above(close, bands.upper) and rsi(close, 14) > 70:
16sell limit: bands.upper, risk: 1%, stop: bands.upper + atr(14), target: bands.middle, expires: 5 bars
17
18plot bands.upper, color: gray
19plot bands.middle, color: blue
20plot bands.lower, color: gray
What this script says

Bollinger Mean Reversion is a strategy that trades EURUSD on 1-hour bars. It holds at most 1 open trade and closes its trade on an opposite signal.

You can change 2 inputs: length (default 20) and width (default 2.0).

It calculates bands as the Bollinger Bands (source the close, length length, multiplier width).

When the close crosses below bands.lower and the 14-bar RSI is below 30, it buys with a limit order at bands.lower, risking 1% of the balance, with a stop at bands.lower minus the 14-bar ATR, with a target at bands.middle and expiring after 5 bars.

When the close crosses above bands.upper and the 14-bar RSI is above 70, it sells with a limit order at bands.upper, risking 1% of the balance, with a stop at bands.upper plus the 14-bar ATR, with a target at bands.middle and expiring after 5 bars.

On the chart, it plots bands.upper, bands.middle and bands.lower.

Try this in the Terminal. AlgoBars is free: $0 a month, no card needed.

Create my free account