超简单的均线策略,也能给我闪烁,为什么啊啊啊
//------------------------------------------------------------------------// 简称: MA_Offset_Strategy// 名称: 基于5日均线偏移的买卖策略(带止损)// 类别: 公式应用// 类型: 用户应用// 输出: Void//------------------------------------------------------------------------Params Numeric Lots(3); // 每次交易手数 Numeric OffsetBuyIn(6); // 偏移点数 Numeric OffsetSellIn(6); Numeric OffsetSellCover(6); // 偏移点数 Numeric OffsetBuyCover(8); Numeric StopLoss(10); // 止损点数Vars Numeric MA5; // 5日均线 Numeric BuyInLevel; // 买入价格 Numeric SellCoverLevel; // 卖出价格 Numeric SellInLevel; // 做空价格 Numeric BuyCoverLevel; // 平空价格 Numeric EntryPrice; // 开仓价(用于止损计算)Events OnInit() { Commentary("基于5日均线偏移的买卖策略启动(带止损)"); } OnBar(ArrayRef<Integer> indexs) { MA5 = Average(Close, 5); BuyInLevel = MA5 - OffsetBuyIn; SellCoverLevel = MA5 + OffsetSellCover; SellInLevel = MA5 + OffsetSellIn; BuyCoverLevel = MA5 - OffsetBuyCover; // 开仓 if (MarketPosition == 0) { if (High >= SellInLevel) { SellShort(Lots, SellInLevel); EntryPrice = SellInLevel; Commentary("做空开仓,价格:" + Text(SellInLevel)); } if (Low <= BuyInLevel) { Buy(Lots, BuyInLevel); EntryPrice = BuyInLevel; Commentary("做空开仓,价格:" + Text(BuyInLevel)); } } // 持有多仓时 if (MarketPosition == 1) { // 原有平仓逻辑 if (High >= SellCoverLevel) { Sell(Lots, SellCoverLevel); Commentary("卖出平多,价格:" + Text(SellCoverLevel)); } // 止损逻辑(当前价低于开仓价 StopLoss 点) else if (Low <= EntryPrice - StopLoss) { Sell(Lots, EntryPrice - StopLoss); Commentary("多仓止损,价格:" + Text(EntryPrice - StopLoss)); } } // 持有空仓时 if (MarketPosition == -1) { // 原有平仓逻辑 if (Low <= BuyCoverLevel) { BuyToCover(Lots, BuyCoverLevel); Commentary("平空仓,价格:" + Text(BuyCoverLevel)); } // 止损逻辑(当前价高于开仓价 StopLoss 点) else if (High >= EntryPrice + StopLoss) { BuyToCover(Lots, EntryPrice + StopLoss); Commentary("空仓止损,价格:" + Text(EntryPrice + StopLoss)); } } }以上,看了一圈没有可以闪烁的地方啊,都是high和low,没有多图层,请各位大神们解答