止损问题
 // ===== 4.3 时间止损 =====
            if (!OrderSentThisBar && BarsHeld >= TimeStopBars && CurrentProfitLevel == 0 && CurrentPosition > 0) 
            {
                Numeric CloseQty = Max(1, IntPart(CurrentPosition * 0.5));
                
                if (MarketPosition == 1 && Close <= EntryPrice) {
                    Sell(CloseQty, Open);
                    OrderSentThisBar = True;
                    Commentary("时间止损: 平仓50%");
                }
                else if (MarketPosition == -1 && Close >= EntryPrice) {
                    BuyToCover(CloseQty, Open);
                    OrderSentThisBar = True;
                    Commentary("时间止损: 平仓50%");
                }
            }
        }
        
        // ===== 5. 即时止损检查 =====
        if (MarketPosition != 0 && !OrderSentThisBar && CurrentPosition > 0)
        {
            // 多头止损检查
            if (MarketPosition == 1) 
            {
                // 使用更精确的盘中止损检查
                if (Low <= ActiveStop) 
                {
                    // 计算精确止损价格
                    Numeric StopPrice = Max(Low, ActiveStop);
                    StopPrice = IntPart(StopPrice / MinPoint) * MinPoint;
                    
                    // 确保止损价有效
                    if (StopPrice > 0) 
                    {
                        Sell(CurrentPosition, StopPrice);
                        OrderSentThisBar = True;
                        StopLossTriggered = True;
                        Commentary("【止损触发】价格: " + Text(StopPrice) + 
                                  " | 初始: " + Text(InitialStop) +
                                  " | 当前: " + Text(ActiveStop));
                    }
                }
            }
            // 空头止损检查
            else if (MarketPosition == -1) 
            {
                if (High >= ActiveStop) 
                {
                    Numeric StopPrice = Min(High, ActiveStop);
                    StopPrice = IntPart(StopPrice / MinPoint) * MinPoint;
                    
                    if (StopPrice > 0) 
                    {
                        BuyToCover(CurrentPosition, StopPrice);
                        OrderSentThisBar = True;
                        StopLossTriggered = True;
                        Commentary("【止损触发】价格: " + Text(StopPrice) + 
                                  " | 初始: " + Text(InitialStop) +
                                  " | 当前: " + Text(ActiveStop));
                    }
                }
            }
            
            // 止损检查日志
            if (!StopLossTriggered) {
                Commentary("止损监控: " + 
                          "当前止损=" + Text(ActiveStop) + 
                          " | 最低价=" + Text(Low) + 
                          " | 最高价=" + Text(High));
            }
        }
        
        // ===== 6. 状态报告 =====
        Commentary("状态: " + 
                  "持仓=" + Text(MarketPosition) + 
                  " | 天数=" + Text(BarsHeld) +
                  " | 止损=" + Text(ActiveStop) +
                  " | 阶段=" + Text(CurrentProfitLevel) +
                  " | 已发单=" + Text(IIf(OrderSentThisBar, 1, 0)));
        
        PlotNumeric("止损线", ActiveStop);
    }

为什么前跟k线检测到了止损点,而实际到了止损点不会自动止损呢

关于海龟加仓bar不止损问题
止损问题
止损问题
模拟账户执行止损问题
请教实盘出现的错误止损问题
请教进场前的5根K线内最高或最低点止损问题
固定止损锚定问题
止损设置问题
关于空仓自动取消固定止损的问题
跟踪止损

又是ai

代码还不全

不知道你的ActiveStop是什么类型 在每根k线上怎么变动

你可以自己检查下 每根k线的这个值是多少 数据类型是否具有传递性

隔壁大哥更狠

他的帖子

都是极限测试

问题和内容几无关键

或全靠热心的兄弟经验去无限思考


老王略过

老刘抓狂

我也怕了

哈哈哈哈哈哈哈哈哈

这大哥绰号可能叫“逗你玩儿”

刘老师的头发还能不能经得住折腾哦