当前周期到40个周期前的最高价的K线数-当前周期到5个周期前的最高价的K线数
难道不是35吗?
。。可能是我说的有点问题吧。
前40个周期里的最高价可能在前20个周期上出现。前5个周期里的最高价也可能在前3个周期就出现了。
runmode:0;
h40:=hhv(h,40);
h5:=hhv(h,5);
if islastbar then hh:=h40;
h1:hh;
if islastbar then hh1:=h5;
h2:hh1;
nn:barslast(h=h1)-barslast(h=h2);
l5:=ref(llv(low,5),1);
h5:=ref(hhv(h,5),1);
h40:=ref(hhv(h,40),1);
l40:=ref(llv(l,40),1);
if islastbar then hh:=h40;
h1:hh;
if islastbar then hh1:=h5;
h2:hh1;
nn:barslast(h=h1)-barslast(h=h2);
还请问老师这么写也对吧?
开仓时计算(H40-H5)/NN这些写对么
if cond and holding=0 then
begin
buy(1,1,limitr,c);
d1:=(H40-H5)/NN;
end
PS:就是求开仓时(40天前的最高价-5天前的最高价)/(当前周期到40个周期前的最高价的K线数-当前周期到5个周期前的最高价的K线数)
谢谢