Skip to content
All library documents

Bollinger Band Spread Signals with Z-Score Entry and Exit Rules

Code Stratmill research code

Summary

This document describes a trading rule that measures a spread’s latest value against its recent average and standard deviation. It uses separate lookback windows for the mean and standard deviation, then calculates a z-score to identify unusually high or low spread values. A low z-score prompts a long signal, while a high z-score prompts a short signal, provided the spread’s standard deviation is nonzero.

The class also tracks open trades and closes each when the z-score reaches a threshold derived from its entry value, trade side, and configured exit delta. It records timestamps, spread values, trade side, and the z-score at entry and exit. This is implementation guidance rather than empirical evidence: the document provides no performance results, transaction-cost analysis, or risk controls. Its behavior depends on parameter choices and on the spread series being suitable for this mean-reversion approach; the code also assumes enough observations are available for both lookback windows.

Key ideas

  • The rule calculates a spread z-score using separate windows for its mean and standard deviation.
  • A sufficiently low z-score signals a long entry, while a sufficiently high z-score signals a short entry.
  • A zero sample standard deviation suppresses entry signals.
  • Trade exits use a threshold offset from the entry z-score according to the trade side and configured delta.
  • The implementation tracks trade timing and spread values but provides no evidence of profitability.

Tags

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