fix: 箱体/收敛突破标记价反向越界时自动撤销监控
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -66,6 +66,30 @@ def auto_confirm_ok(direction: str, cfm_close: float, upper: float, lower: float
|
||||
return c < float(lower)
|
||||
|
||||
|
||||
BOX_BREAKOUT_CLOSE_OPPOSITE = "box_opposite_break"
|
||||
|
||||
|
||||
def box_breakout_invalidate_by_mark(
|
||||
direction: str, mark_price: float, upper: float, lower: float
|
||||
) -> bool:
|
||||
"""箱体/收敛:标记价先突破反向边界则失效。多:mark<=L;空:mark>=H。"""
|
||||
try:
|
||||
m = float(mark_price)
|
||||
h = float(upper)
|
||||
lo = float(lower)
|
||||
except (TypeError, ValueError):
|
||||
return False
|
||||
direction = (direction or "long").strip().lower()
|
||||
if direction == "short":
|
||||
return m >= h
|
||||
return m <= lo
|
||||
|
||||
|
||||
def box_breakout_invalidate_edge_label(direction: str) -> str:
|
||||
direction = (direction or "long").strip().lower()
|
||||
return "下沿" if direction == "long" else "上沿"
|
||||
|
||||
|
||||
def detect_rs_box_break(close: float, upper: float, lower: float) -> Optional[dict[str, Any]]:
|
||||
"""
|
||||
阻力/支撑人工盯盘:最近 5m 收盘突破上沿或下沿(严格 > / <)。
|
||||
|
||||
Reference in New Issue
Block a user