循环BUG,求解答
复权的888指数合约和具体的合约,第二三根K线,在公式里的循环少算了一步,如图:for循环的bug还是指数复权的bug?公式如下:Params Vars Bool IsRollover(True);//是否后复权 Bool IsRolloverRealPrice(True);//是否映射真实价格 Bool IsAutoSwapPosition(True);//是否自动换仓 Bool IgnoreSwapSiganlCalc(True); //是否忽略换仓信号计算 //---------------------------- Numeric Minpoint; Numeric count; Global Array<Numeric> everypArr; Global Array<Numeric> countArr; Events OnInit() { Range[0:DataCount-1] { If(IsRollover) { AddDataFlag(Enum_Data_RolloverBackWard());//设置后复权 } If(IsRolloverRealPrice) { AddDataFlag(Enum_Data_RolloverRealPrice());//是否映射真实价格 } If(IsAutoSwapPosition) { AddDataFlag(Enum_Data_AutoSwapPosition());//设置自动换仓 } If(IgnoreSwapSiganlCalc) { AddDataFlag(Enum_Data_IgnoreSwapSignalCalc());//设置忽略换仓信号计算 } } } OnBar(ArrayRef<Integer> indexs) { Minpoint=MinMove*PriceScale*Rollover; count=(High-Low)/Minpoint; //更新数组 If(CurrentBar<3) { Numeric i; Commentary(count=+Text(count)); For i= 0 To count { Numeric arrlength; arrlength=GetArraySize(everypArr); Commentary(i=+Text(i)); Commentary(arrlength=+Text(arrlength)); everypArr[arrlength]=Low+ i*Minpoint;//复权和不复权少算一步??????? } } }