我写的止损程序代码在回测的时候不触发什么原因,请老师给指点一下
If(CurrentPosition != 0) { Numeric stopPrice; Bool needStop(False); Numeric triggerPrice; If(CurrentPosition == 1) // 多单止损检查 { // 精确止损价计算(含4位小数) stopPrice = Round(AvgLongPrice * (1 - 0.006),4); // 改进触发逻辑:考虑盘中价格波动 If(Low <= stopPrice) { needStop = True; // 确定实际触发价(考虑跳空情况) triggerPrice = IIF(Open < stopPrice, Open, Min(Close, stopPrice)); triggerPrice = Min(Low, triggerPrice); } }