
等级: 标准版
- 注册:
- 2021-12-10
- 曾用名:
|
我这段指标的代码,最后一段的循环这里,程序提示有未来,有二次计算的东西,麻烦老师看看,怎么改,谢谢
input:length(14,1,50);
VARIABLE:PlusDM:=0,MinusDM: = 0,DMSum:= 0,coef:= 0,EMA_dmh:=0;;;
SF:=1/length;
UpperMove := High - High[1];//高点变化
LowerMove := Low[1] - Low;//低点变化
If UpperMove > LowerMove and UpperMove > 0 Then begin
PlusDM := UpperMove;
end;
If LowerMove > UpperMove and LowerMove > 0 Then begin
MinusDM := LowerMove;
end;
EMA_dmh: =SF*(PlusDM - MinusDM) + (1 - SF)* EMA_dmh[1];
//这个循环有问题,程序提示有未来引用;
For ccount = 1 to Length do Begin
DMSum = dmsum + (1 - Cos(360*ccount / (Length + 1)))*EMA_dmh[ccount-1];
coef = coef + (1 - Cos(360*ccount / (Length + 1)));
end;
If coef <> 0 Then DMH: DMSum / coef;
|
|