依然是互斥
依然是想利用数据数据做策略互斥,但是用日期加时间还是bar索引都没有搞定。大神救命啊Params Numeric FastLength(5);// 短期指数平均线参数 Numeric SlowLength(20);// 长期指数平均线参数Vars Series<Numeric> AvgValue1; Series<Numeric> AvgValue2; Numeric AvgValue3; Dic<Numeric> kk(\"rb\"); Events OnBar(ArrayRef<Integer> indexs) { AvgValue1 = AverageFC(Close,FastLength); AvgValue2 = AverageFC(Close,SlowLength); PlotNumeric(\"MA1\",AvgValue1); PlotNumeric(\"MA2\",AvgValue2); If(MarketPosition <>1 && AvgValue1[1] > AvgValue2[1]) { Buy(0,Open); SetDicValue(\"huci\",\"rb\",CurrentBar,MarketPosition,True); } If(MarketPosition <>-1 && AvgValue1[1] < AvgValue2[1]) { SellShort(0,Open); SetDicValue(\"huci\",\"rb\",CurrentBar,MarketPosition,True); } /*if(MarketPosition<>0) { SetDicValue(\"huci\",\"rb\",SystemDateTime(),MarketPosition,True); }*/ GetDicValue(\"huci\", \"rb\", CurrentBar, AvgValue3); Commentary(\"持仓状态:\"+text(kk)); Commentary(\"状态\"+text(AvgValue3)); }