Skip to content
All library documents

Bollinger Band Entries with a Selectable Backtest Date Window

Article Strategy library · Author: ChaoZhang

Summary

This strategy calculates Bollinger Bands from a simple moving average and a standard-deviation envelope. It enters long when price crosses above the lower band and short when price crosses below the upper band. Its other feature is a user-selected start and end time, allowing the strategy to restrict when orders are eligible during a backtest. The published code also places stop-entry orders beyond the bands using fixed percentage offsets.

The document gives adjustable date and band inputs and a BTC/USDT futures backtest configuration, but supplies no performance statistics. Its description presents band crossings as potential reversal signals and warns that band settings and the chosen test period can influence conclusions. A code-level caveat is that the stated time-window variables are calculated, but the shown order conditions call a window function that always returns true; therefore, the provided code does not appear to enforce the selected dates as described. The suggested improvements include testing varied periods, adding stop rules or confirmation filters, and assessing robustness before drawing conclusions.

Key ideas

  • The band center is a simple moving average, with upper and lower bands offset by a multiple of standard deviation.
  • The described entry rules go long on an upward cross of the lower band and short on a downward cross of the upper band.
  • The published code uses stop-entry prices offset from the bands by fixed percentages.
  • The code calculates selected date boundaries, but its order window function always returns true.
  • The supplied backtest settings do not include outcome metrics for evaluating profitability or robustness.

Tags

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