summaryrefslogtreecommitdiff
path: root/services/strategy-engine/strategies/volume_profile_strategy.py
diff options
context:
space:
mode:
authorTheSiahxyz <164138827+TheSiahxyz@users.noreply.github.com>2026-04-01 18:44:20 +0900
committerTheSiahxyz <164138827+TheSiahxyz@users.noreply.github.com>2026-04-01 18:44:20 +0900
commitcb55c81dbc43df83ef4d5b717fe22b4d04a93d2e (patch)
tree26ef6f6a89233fa8cf74ea6467b07f1158d75ff1 /services/strategy-engine/strategies/volume_profile_strategy.py
parent0b0aace94fa633cd7a90c95ee89658167a8afd35 (diff)
feat(strategy): apply filters, conviction scoring, and ATR stops to all strategies
Diffstat (limited to 'services/strategy-engine/strategies/volume_profile_strategy.py')
-rw-r--r--services/strategy-engine/strategies/volume_profile_strategy.py17
1 files changed, 15 insertions, 2 deletions
diff --git a/services/strategy-engine/strategies/volume_profile_strategy.py b/services/strategy-engine/strategies/volume_profile_strategy.py
index 2cfa87a..324f1c2 100644
--- a/services/strategy-engine/strategies/volume_profile_strategy.py
+++ b/services/strategy-engine/strategies/volume_profile_strategy.py
@@ -43,6 +43,14 @@ class VolumeProfileStrategy(BaseStrategy):
if self._quantity <= 0:
raise ValueError(f"Quantity must be positive, got {self._quantity}")
+ self._init_filters(
+ require_trend=False,
+ adx_threshold=float(params.get("adx_threshold", 25.0)),
+ min_volume_ratio=float(params.get("min_volume_ratio", 0.5)),
+ atr_stop_multiplier=float(params.get("atr_stop_multiplier", 2.0)),
+ atr_tp_multiplier=float(params.get("atr_tp_multiplier", 3.0)),
+ )
+
def reset(self) -> None:
self._candles.clear()
self._was_below_va = False
@@ -106,6 +114,7 @@ class VolumeProfileStrategy(BaseStrategy):
return (poc, va_low, va_high)
def on_candle(self, candle: Candle) -> Signal | None:
+ self._update_filter_data(candle)
close = float(candle.close)
volume = float(candle.volume)
self._candles.append((close, volume))
@@ -124,25 +133,29 @@ class VolumeProfileStrategy(BaseStrategy):
# BUY: was below VA, price bounces back between va_low and poc
if self._was_below_va and va_low <= close <= poc:
self._was_below_va = False
- return Signal(
+ signal = Signal(
strategy=self.name,
symbol=candle.symbol,
side=OrderSide.BUY,
price=candle.close,
quantity=self._quantity,
+ conviction=0.6,
reason=f"Price bounced from below VA low {va_low:.2f} to {close:.2f} (POC {poc:.2f})",
)
+ return self._apply_filters(signal)
# SELL: was above VA, price pulls back between poc and va_high
if self._was_above_va and poc <= close <= va_high:
self._was_above_va = False
- return Signal(
+ signal = Signal(
strategy=self.name,
symbol=candle.symbol,
side=OrderSide.SELL,
price=candle.close,
quantity=self._quantity,
+ conviction=0.6,
reason=f"Price rejected from above VA high {va_high:.2f} to {close:.2f} (POC {poc:.2f})",
)
+ return self._apply_filters(signal)
return None