Skip to content
All library documents

Bollinger Band Breakouts Filtered by the Ichimoku Cloud

Article Strategy library · Author: Jesse community

Summary

This long-only strategy uses Bollinger Bands for entry and the Ichimoku cloud as a trend filter. It considers a long when a candle closes above the upper band, provided price is above both cloud spans. The bands use a default configuration and the midpoint of each candle as the price input. The position is liquidated when price closes below the middle band; the description mentions a lower-band exit as an alternative but says the middle band performed better.

The document offers a rule description and implementation, but no backtest results or evidence for the performance claim. It gives no short-entry logic, and the implementation sizes a position using the full available balance, which can create substantial exposure. The rules may lag or produce false breakouts, and the document does not specify how to manage transaction costs, stops, or market conditions. Its stated one-hour timeframe is the only explicit operating context, so results should not be assumed to generalize across assets or periods.

Key ideas

  • The strategy takes long positions only when price is above both Ichimoku cloud spans.
  • A close above the upper Bollinger Band triggers a potential long entry.
  • The position exits when price closes below the middle band.
  • The description offers a lower-band exit as an alternative but favors the middle band based on unspecified results.
  • No backtest evidence or short-selling rules are provided.

Tags

Full text
# SimpleBollinger


# SimpleBollinger









Simple Bollinger Bands Strategy
Timeframe: 1h
Repo: https://github.com/gabrielweich/jesse-strategies
When the price closes above the upperband in an uptrend (determined by the ichimoku cloud),
it gives a long signal indicating a possible continuation of the uptrend.
The position can also be closed when the price closes below lowerband, but the best results
were achieved when using the middleband instead.

## Source (MIT)

```python
"""
Simple Bollinger Bands Strategy
Timeframe: 1h
Repo: https://github.com/gabrielweich/jesse-strategies
When the price closes above the upperband in an uptrend (determined by the ichimoku cloud),
it gives a long signal indicating a possible continuation of the uptrend.
The position can also be closed when the price closes below lowerband, but the best results
were achieved when using the middleband instead.
"""

from jesse.strategies import Strategy
import jesse.indicators as ta
from jesse import utils


class SimpleBollinger(Strategy):
    @property
    def bb(self):
        # Bollinger bands using default parameters and hl2 as source
        return ta.bollinger_bands(self.candles, source_type="hl2")

    @property
    def ichimoku(self):
        return ta.ichimoku_cloud(self.candles)

    def filter_trend(self):
        # Only opens a long position when close is above ichimoku cloud
        return self.close > self.ichimoku.span_a and self.close > self.ichimoku.span_b

    def filters(self):
        return [self.filter_trend]

    def should_long(self) -> bool:
        # Go long if candle closes above upperband
        return self.close > self.bb[0]

    def should_short(self) -> bool:
        return False

    def should_cancel_entry(self) -> bool:
        return True

    def go_long(self):
        # Open long position using entire balance
        qty = utils.size_to_qty(self.balance, self.price, fee_rate=self.fee_rate)
        self.buy = qty, self.price

    def go_short(self):
        pass

    def update_position(self):
        # Close the position when candle closes below middleband
        if self.close < self.bb[1]:
            self.liquidate()
```

Shown in full with attribution under the source's licence. Licence: MIT

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