哪位老师帮忙改一下不知道哪里出问题了

ParamsNumeric SLPercent(3); // 止损百分比Numeric TPPercent(6); // 目标利润百分比Numeric ReservePercent(80); // 预留百分比Numeric MA_Length(20); // 均线长度Numeric CCI_Period(14); // CCI指标周期Numeric TrailSLBars(3); // 止损跟踪Bar数VarsSeries <Numeric> AvgClose;Series <Numeric> CCI_Value;Numeric StopLossPrice;Numeric TargetPrice;Numeric EntryPrice;EventsonBar(ArrayRef<Integer> indexs) { // 计算指标值AvgClose = AverageFC(Close, MA_Length);CCI_Value = CCI(CCI_Period); // 多单开仓 if (MarketPosition == 0 and AvgClose[1] > AvgClose[2] and CCI_Value[1] > 100 and CCI_Value[2] <= 100) { EntryPrice = Open[1]; StopLossPrice = EntryPrice * (1 - SLPercent/100); TargetPrice = EntryPrice * (1 + TPPercent/100); buy(1, Open); } // 空单开仓 if (MarketPosition == 0 and AvgClose[1] < AvgClose[2] and CCI_Value[1] < -100 and CCI_Value[2] >= -100) { EntryPrice = Open[1]; StopLossPrice = EntryPrice * (1 + SLPercent/100); TargetPrice = EntryPrice * (1 - TPPercent/100); sellShort(1, Open); } // 止损跟踪 if (MarketPosition == 1 and Close[1] < StopLossPrice) { StopLossPrice = Close[1]; } else if (MarketPosition == -1 and Close[1] > StopLossPrice) { StopLossPrice = Close[1]; } // 平仓 if (MarketPosition == 1 and Low[1] <= StopLossPrice) { sell(1, StopLossPrice); } else if (MarketPosition == 1 and High[1] >= TargetPrice) { sell(1, TargetPrice); } else if (MarketPosition == -1 and High[1] >= StopLossPrice) { buyToCover(1, StopLossPrice); } else if (MarketPosition == -1 and Low[1] <= TargetPrice) { buyToCover(1, TargetPrice); }}