# 1. 70% 止损预警 + 提前平仓
if loss_distance >= stop_distance * 0.7:
if signal_strength < 0.1%:
close_position(position.id)
return
# 2. 信号弱立即止损
if signal_strength < 0.1% and is_trend_flat():
close_position(position.id)
```
### 4. 实时扫描任务
```python
def monitor_positions():
实时监控持仓(每 5 分钟)
while True:
positions = get_open_positions()
for pos in positions:
# 检查反转
if is_valid_reversal(pos.type, get_kline_data(pos.symbol)):
close_position(pos.id)