Finishes what d54a2a9's message claimed: schwab/ was never actually removed. Also: comprehensive_backtest.py (crashed on import — research/connection.py does not exist), strategy/universe.py, strategy/backtest/outcomes.py, detect_momentum_ignition (kept _last_higher_low — imported by runner/ premarket_setup/liquid_breakout), milestone3_verify.py, tests/unit/schwab/, SCHWAB_* keys from .env.example. All grep-gated: zero live references. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
20 lines
825 B
Python
20 lines
825 B
Python
"""Shared stop-placement helper for the shadow detectors.
|
|
|
|
Historical note: this module used to host ``detect_momentum_ignition`` (the
|
|
PLSM-class vertical-squeeze detector). It never gained a consumer and was
|
|
deleted in plan 002 (2026-07-13); only ``_last_higher_low`` survives because
|
|
runner.py, premarket_setup.py, and liquid_breakout.py import it.
|
|
"""
|
|
|
|
from __future__ import annotations
|
|
|
|
|
|
def _last_higher_low(lows: list[float]) -> float:
|
|
"""Ride the stop under the last established HIGHER LOW *beneath* the final
|
|
(ignition) bar: scan back from the 2nd-to-last bar for the most recent bar
|
|
whose low is higher than the bar before it. Fallback: the window's min low."""
|
|
for i in range(len(lows) - 2, 0, -1):
|
|
if lows[i] > lows[i - 1]:
|
|
return lows[i]
|
|
return min(lows) if lows else 0.0
|