hh:hhv(openprofit,enterbars+1); variable:n=0,k=0; if 平多条件 and holding>0 then begin sell.......; N:=N+hh; k:=k+1; end
if 平空条件 and holding<0 then begin sellshort........; n:=n+hh; K:=k+1; end
每次最大浮赢是HH 总和是N 平均是N/K |
hh:hhv(openprofit,enterbars+1); variable:n=0,k=0; if 平多条件 and holding>0 then begin sell.......; N:=N+hh; k:=k+1; end
if 平空条件 and holding<0 then begin sellshort........; n:=n+hh; K:=k+1; end
|
if month<>ref(month,1) then n:=0;
这个是每个月开始就把全局变量重置为0,算作是每月独立计算
不是,要判断跨年的。比较复杂,就举个2个月的例子
hh:hhv(openprofit,enterbars+1); variable:n=0,k=0; variable:yuefen=0;
if 开多条件 and holding=0 then begin buy........; yuefen:=month; end
if 开空条件 and holding=0 then begin buyshort.......; yuefen:=month; end
if 平多条件 and holding>0 then begin sell.......; N:=N+hh; k:=k+1; end
if 平空条件 and holding<0 then begin sellshort........; n:=n+hh; K:=k+1; end
首先就如上面写的,加了一个记录月份的全局变量
|
然后判断当前月份:
if (month=3 or month=4 or...........or month=12) and month=yuefen+2 then n:=0 //这里简略的写了,用户一定不能简略,3-12月全部写齐
if month=1 and yuefen=11 then n:=0;
if month=2 and yuefen=12 then n:=0;
这里就要判断跨年,不能和3月-12月写成一样的,1月2月独立判断
类似的3个月,4个月,都是要像这样进行枚举判断