等级: 免费版
- 注册:
- 2022-1-15
- 曾用名:
|
目的是统计最近10笔多头交易中的亏损笔数
VARIABLE:dkcp=0,dpcp=0;
maS:=ma(c,5);
ma20:=ma(c,20);
if cross(maS,ma20) and holding=0 then
begin
buy(1,1,marketr);
dkcp:=c;
END
if cross(ma20,maS) and holding>0 then
begin
sell(1,1,marketr);
dpcp:=c;
END
hold:=holding;
dcount:=0;
dsumLoss:=0;//统计最近10笔多头交易中的亏损笔数
for i=barpos downto 2 do
begin
if hold[i]=0 and hold[i-1]>0 and dcount<10 then
begin
dcount:=dcount+1;
if dpcp[i]<dkcp[i] then
dsumLoss:=dsumLoss+1;
end
else if dcount>=10 then
break;
END
x1:dcount,NODRAW;
x2:dsumLoss,NODRAW;//错误: 输出值始终为0
|
|