Add the Williams %R strategy

New williams_r indicator (in [-100, 0]) exposed as ctx.williams_r(period), and a
long-only mean-reversion strategy: enter when %R is at/below the oversold level,
exit when it reaches the overbought level, with an optional ATR stop. 11
strategies total. Adds indicator and strategy tests; smoke-tested on live
BTC/USDT 5m (backtest + parameter sweep).
This commit is contained in:
matitos committed 2026-09-26 18:44:00 +00:00
1 parent ef895b6b9c
commit d92f152f9b
6 files changed
+171 -2

No files matched your search

+4
View File
@@ -15,6 +15,7 @@ from app.engine.indicators import (
sma,
supertrend,
vwap,
williams_r,
)
from app.models import PositionSide
from app.schemas import Candle, ParamSpec, StrategyOut
@@ -129,6 +130,9 @@ class StrategyContext:
def vwap(self, period: int | None = None) -> float | None:
return vwap(self._candles, period)[-1]
def williams_r(self, period: int = 14) -> float | None:
return williams_r(self._candles, period)[-1]
def supertrend(
self, period: int = 10, multiplier: float = 3.0
) -> tuple[float | None, bool | None]: