Skip to content
All library documents

Bollinger Breakouts with ATR Trailing Stops

Code Quant course library

Summary

This strategy builds 15-minute bars and uses Bollinger Bands to place stop entries at the upper band for a long position and the lower band for a short position when flat. It calculates the middle band as a simple moving average and also computes ATR. Once positioned, it tracks the highest high during a long trade or the lowest low during a short trade. The stop trails those extremes by an ATR-based distance, then is constrained by the moving average: the long stop cannot be below it, and the short stop cannot be above it.

The document is an implementation example, not a performance study. It reports no backtest results or market-specific evidence, and it does not explain order fills, transaction costs, slippage, or risk-based sizing. The tracked extremes are initialized while flat and updated on subsequent bars, so practical behavior depends on the framework's position and order handling. The code alone cannot show whether the approach is profitable or robust.

Key ideas

  • Stop entries at the Bollinger Bands establish long and short positions when flat.
  • The strategy trails long stops from the highest high and short stops from the lowest low.
  • ATR sets the distance between each tracked extreme and its protective stop.
  • The moving average constrains the long and short stop levels.
  • No backtest, execution analysis, or transaction cost assessment is provided.

Tags

From a private course collection; the original is not published.