你这样讲让人能难懂
这样吧,你把写好的代码贴出来,然后要实现什么目的说一下
nh:=ref(hhv(high,n),1);
ml:=ref(llv(low,m),1);
variable:bj=0,sckd=0,sckk=0;
当前持仓:holding,colorgray,linethick0;
当前资产:asset,noaxis,colorgray;
if bj=0 and holding=0 and h>nh then begin
buy(holding=0,1);
bj:=1;
sckd:=close;
end
if bj=0 and holding=0 and l<ml then begin
buyshort(holding=0,1);
bj:=1;
sckk:=close;
end
//==============================
if high>nh and bj=1 then
begin
//平空开多
sellshort(holding<0 and high>nh,0);
if holding=0 then begin
buy(holding=0 and high>sckd,1);
sckd:=close;
end
end
if low<ml and bj=1 and holding>0 then
begin
//平多开空
sell(holding>0 and low<ml,0);
if holding=0 then begin
buyshort(holding=0 and low<sckk,1);
sckk:=close;
end
end
用全局变量来判断是否是第一次的开仓然后赋值变量
再用全局变量来给SCKK和SCKD记录开仓时的数值