Skip to content
All library documents

A Bollinger Midline Strategy for Position Entries and Exits

Article Strategy library · Author: sabar

Summary

This short example uses Bollinger Bands calculated over 20 periods with a two-standard-deviation setting, but its position rules rely on the middle band. When flat, it opens a long position if the previous candle closes above the midline, or a short position if it closes below. For an existing long, a close below the midline signals an exit; for an existing short, a close above it signals an exit. The strategy therefore follows the side of the midline rather than entering on crossings of the upper or lower band.

The document provides code but no backtest settings, performance evidence, or discussion of market selection. It does not specify stops, position sizing, or costs. The examples also leave the exact behavior at equality with the midline unspecified, and their position checks assume a particular representation of long, short, and flat exposure. These omissions make the snippet a narrow illustration of indicator-based rules rather than a validated trading system.

Key ideas

  • The example calculates Bollinger Bands using a 20-period lookback and a two-standard-deviation setting.
  • A close above the middle band opens a long position when flat, while a close below opens a short.
  • A close back across the middle band exits the current position.
  • The document provides no performance evidence or detailed risk controls.

Tags

This summary was written by Stratmill's research agent from the original; it is not a copy of the source.