咨询策略

没有信号执行,条件都满足了啊,问题出在哪?老师

Params Numeric FastLength(12); // 快速移动平均线周期 Numeric SlowLength(26); // 慢速移动平均线周期 Numeric MACDSignalLength(9); // MACD 信号线周期Vars Numeric LAST; Numeric MACDValue; Numeric SignalLine; Numeric MACDDiff; Bool EnterLongCondition(False); Bool EnterShortCondition(False); Numeric MyEntryPrice; Numeric MyStopLoss; Numeric MyTakeProfit;Events OnReady() { Range[0:DataSourceSize() - 1] { MACDValue = XAverage(Close,FastLength)-XAverage(Close,SlowLength); SignalLine = XAverage(MACDValue,MACDSignalLength); MACDDiff = MACDValue - SignalLine; } { // 判断开仓条件 If (MACDValue > REF(MACDValue,1) And REF(MACDValue,1) < REF(MACDValue,2) ) { EnterLongCondition = True; } IF (MACDValue < REF(MACDValue,1) And REF(MACDValue,1) > REF(MACDValue,2) ) { EnterShortCondition = True; } // 开仓操作 If (MarketPosition == 0 And EnterLongCondition) { Buy(1,LAST); MyEntryPrice =LAST; MyStopLoss = MyEntryPrice - 10*MinMove; MyTakeProfit = 0; } Else If (MarketPosition == 0 And EnterShortCondition) { SellShort(1,LAST); MyEntryPrice = LAST; MyStopLoss = MyEntryPrice + 10*MinMove; MyTakeProfit = 0; } // 持仓不为零时的止损和止盈调整 If (MarketPosition!= 0) { If (MarketPosition == 1) { // 多头持仓 If (LAST>= MyEntryPrice + 30*MinMove) { MyStopLoss = MyEntryPrice + 20*MinMove; } Else If (LAST>= MyEntryPrice + 40*MinMove) { MyStopLoss = MyEntryPrice + 25*MinMove; } Else If (LAST>= MyEntryPrice + 50*MinMove) { MyStopLoss = MyEntryPrice + 30*MinMove; } Else If ((LAST- MyEntryPrice) >= ((IntPart((C- MyEntryPrice)/20)+1)*20*MinMove)) { MyStopLoss = MyEntryPrice + ((IntPart((C - MyEntryPrice)/20)+1)*20*MinMove); } If (LAST<= MyStopLoss) { Sell(1,MyStopLoss); } } Else If (MarketPosition == -1) { // 空头持仓 If (LAST<= MyEntryPrice - 30*MinMove) { MyStopLoss = MyEntryPrice - 20*MinMove; } Else If (LAST<= MyEntryPrice - 40*MinMove) { MyStopLoss = MyEntryPrice - 25*MinMove; } Else If (LAST<= MyEntryPrice - 50*MinMove) { MyStopLoss = MyEntryPrice - 30*MinMove; } Else If ((MyEntryPrice - LAST) >= ((IntPart((MyEntryPrice - LAST)/20)+1)*20*MinMove)) { MyStopLoss = MyEntryPrice - ((IntPart((MyEntryPrice - LAST)/20)+1)*20*MinMove); } If (LAST>= MyStopLoss) { BuyToCover(1,MyStopLoss); } } } } }

是没有信号还是有信号不执行?另外你要么就发全文我实在是没有这个时间一句一句把代码敲到编辑器里复现运行一遍况且你这个图片里,还不说变量是什么数据结构这怎么看呢