修复斐波做多盈亏比

This commit is contained in:
dekun
2026-05-19 09:59:51 +08:00
parent 3a06b22142
commit 1c235a57d8
3 changed files with 7 additions and 5 deletions
+1 -1
View File
@@ -22,7 +22,7 @@
|----|------|
| 同币互斥 | 每个币种只能有一条斐波监控(0.618 与 0.786 不可并存) |
| 上下沿 | 上沿 **H**、下沿 **L**(须 H > L |
| 挂单价 E | `E = L + ratio × (H L)`0.618 或 0.786 |
| 挂单价 E | **做多** `E = H ratio × (H L)`(自 H 向下回撤);**做空** `E = L + ratio × (H L)`自 L 向上反弹 |
| 做多 | 限价 @ E,止损 L,止盈 H |
| 做空 | 限价 @ E,止损 H,止盈 L |
| 添加后 | **立即**在 Binance U 本位挂限价单;卡片显示 **挂E**、限价单 ID |
+1 -1
View File
@@ -22,7 +22,7 @@
|----|------|
| 同币互斥 | 每个币种只能有一条斐波监控(0.618 与 0.786 不可并存) |
| 上下沿 | 上沿 **H**、下沿 **L**(须 H > L |
| 挂单价 E | `E = L + ratio × (H L)`0.618 或 0.786 |
| 挂单价 E | **做多** `E = H ratio × (H L)`(自 H 向下回撤);**做空** `E = L + ratio × (H L)`自 L 向上反弹 |
| 做多 | 限价 @ E,止损 L,止盈 H |
| 做空 | 限价 @ E,止损 H,止盈 L |
| 添加后 | **立即**在 Gate 挂限价单;卡片显示 **挂E**、限价单 ID |
+5 -3
View File
@@ -18,8 +18,9 @@ def fib_ratio_from_type(monitor_type):
def calc_fib_plan(direction, upper, lower, ratio):
"""
上沿 H、下沿 L;挂单价 E = L + ratio*(H-L)
多:SL=LTP=H;空:SL=HTP=L
上沿 H、下沿 LH > L
多:自 H 向下回撤 ratioE = H - ratio*(H-L)SL=LTP=H
做空:自 L 向上反弹 ratioE = L + ratio*(H-L)SL=HTP=L。
返回 (entry, stop_loss, take_profit) 或 None。
"""
try:
@@ -31,10 +32,11 @@ def calc_fib_plan(direction, upper, lower, ratio):
if h <= l or r <= 0 or r >= 1:
return None
span = h - l
entry = l + r * span
direction = (direction or "long").strip().lower()
if direction == "short":
entry = l + r * span
return entry, h, l
entry = h - r * span
return entry, l, h