trader.strategies.bollinger_revert module

Mean reversion on Bollinger bands: buy the lower band, exit at the mean.

class trader.strategies.bollinger_revert.BollingerRevertStrategy(id, period=20, num_std=2)[source]

Bases: object

Buy below the lower band; sell once price recovers to the middle band.

Exiting at the middle rather than the upper band is deliberate: this is a reversion-to-the-mean trade, and the mean is the target.

Parameters:
  • id (str)

  • period (int)

  • num_std (int)

id: str
period: int
num_std: int
backtestable: ClassVar[bool] = True
warmup_bars()[source]
Return type:

int

evaluate(bars, position)[source]
Parameters:
Return type:

Signal