summaryrefslogtreecommitdiff
path: root/services/strategy-engine/strategies/bollinger_strategy.py
diff options
context:
space:
mode:
Diffstat (limited to 'services/strategy-engine/strategies/bollinger_strategy.py')
-rw-r--r--services/strategy-engine/strategies/bollinger_strategy.py40
1 files changed, 22 insertions, 18 deletions
diff --git a/services/strategy-engine/strategies/bollinger_strategy.py b/services/strategy-engine/strategies/bollinger_strategy.py
index a195cb8..ebe7967 100644
--- a/services/strategy-engine/strategies/bollinger_strategy.py
+++ b/services/strategy-engine/strategies/bollinger_strategy.py
@@ -102,27 +102,31 @@ class BollingerStrategy(BaseStrategy):
if price > sma:
# Breakout upward
conv = min(0.5 + squeeze_duration * 0.1, 1.0)
- return self._apply_filters(Signal(
- strategy=self.name,
- symbol=candle.symbol,
- side=OrderSide.BUY,
- price=candle.close,
- quantity=self._quantity,
- conviction=conv,
- reason=f"Bollinger squeeze breakout UP after {squeeze_duration} bars",
- ))
+ return self._apply_filters(
+ Signal(
+ strategy=self.name,
+ symbol=candle.symbol,
+ side=OrderSide.BUY,
+ price=candle.close,
+ quantity=self._quantity,
+ conviction=conv,
+ reason=f"Bollinger squeeze breakout UP after {squeeze_duration} bars",
+ )
+ )
else:
# Breakout downward
conv = min(0.5 + squeeze_duration * 0.1, 1.0)
- return self._apply_filters(Signal(
- strategy=self.name,
- symbol=candle.symbol,
- side=OrderSide.SELL,
- price=candle.close,
- quantity=self._quantity,
- conviction=conv,
- reason=f"Bollinger squeeze breakout DOWN after {squeeze_duration} bars",
- ))
+ return self._apply_filters(
+ Signal(
+ strategy=self.name,
+ symbol=candle.symbol,
+ side=OrderSide.SELL,
+ price=candle.close,
+ quantity=self._quantity,
+ conviction=conv,
+ reason=f"Bollinger squeeze breakout DOWN after {squeeze_duration} bars",
+ )
+ )
# Bandwidth filter: skip sideways markets
if sma != 0 and bandwidth < self._min_bandwidth: