此主题相关图片如下:qq截图20190427150432.png

请问这个函数是不能在逐K模式下运行,还是我用的方法不对啊?
代码原文如下:
i:=0;//i是序列值,在循环语句中,每个循环会+1.
pen:=0;//当前笔
VARIABLE:s_czsc_high:=0;
VARIABLE:s_czsc_low:=0;
VARIABLE:direction:=0;
s_direction:=ref(direction,1);
s_direction_2:=ref(direction,2);
s_status:=0;
s_pen:=ref(pen,1); ;//前一笔
p:=0;
shan:=FILTERX(p,i+1);
s_czsc_high_1:=ref(s_czsc_high,1);
s_czsc_high_i:=ref(s_czsc_high,(i+2));
s_czsc_low_i:=ref(s_czsc_low,(i+2));
s_czsc_low_2:=ref(s_czsc_low,2);
fb1:=s_status=0;
fb1_1:=i<50;
fb2:=s_pen=11 or s_pen=-11;
fb3:=s_pen=10 or s_pen=-10;
fb4:=s_direction>0;
fb5:=i<3;
fb6:=s_direction=1 and s_pen=11;
fb7:=ref(s_czsc_low,1)<ref(s_czsc_low,(i+2));
fb8:=s_direction=-1 and s_pen=-11;
fb9:=s_czsc_high_1>s_czsc_high_i;
fb10:=s_direction>0;
fb11:=s_czsc_high_1<s_czsc_low_i;
fb12:=s_czsc_low_2>s_czsc_high_i;
//第一组
If fb1 then begin //如果前一K线不是顶或者底儿
pen:=s_direction*10; //赋值pen为前K方向值乘以10.因为s_direction初值为0.所以第一根K线判定时,pen也为0,pen为当前K线所在的趋势。
//但最迟第三根K线开始s_direction就为1或者-1,所以pen的值也成为10或者-10.
end //这个IF语句结束,不参与后边的多层嵌套
//1,2循环判断
While fb1=0 and fb1_1 do begin
If fb2 then BREAK;
i:=i+1;
end //回溯50个处理完包含关系到K线,直至符合条件中断(50可根据周期自定义)
//第二组
If fb1=0 and fb3 and fb4 then begin //如果回溯50个仍没符合条件的则延续状态
pen:=s_direction*10+s_status;
DRAWTEXT(h>0,l,'s_czsc_low'),colorwhite;
ll:=s_czsc_low;//原文是l,但是l是保留字,所以改成了ll
end
//第三 组
If fb1=0 and fb3=0 and fb4=0 then begin
pen:=s_direction*10-s_status;
DRAWTEXT(h>0,H,'s_czsc_high'),colorwhite;
u:=s_czsc_high;
end
//第四组
If fb1=0 and fb3=0 and fb5 then begin
pen:=s_direction_2*10;
end
//第五组
If fb1=0 and fb3=0 and fb5=0 and fb6 and fb7 then begin
pen:=s_direction*10+s_status;
DRAWTEXT(h>0,H,l,'s_czsc_low'),colorwhite;
shan=1;
p:=s_czsc_low;
end
//第六组
If fb1=0 and fb3=0 and fb5=0 and fb6 and fb7=0 then begin
pen:=s_direction_2*10;
end
//第七组
If fb1=0 and fb3=0 and fb5=0 and fb6=0 and fb8 and fb9 then begin
pen:=s_direction*10-s_status;
DRAWTEXT(h>0,H,'s_czsc_high'),colorwhite;
u:=s_czsc_high;
shan=1;
p:=s_czsc_high;
end
//第八组
If fb1=0 and fb3=0 and fb5=0 and fb6=0 and fb8 and fb9=0 then begin
pen:=s_direction_2*10;
end
//第九组
If fb1=0 and fb3=0 and fb5=0 and fb6=0 and fb8=0 and fb10 and fb11 then begin
pen:=s_direction*10+s_status;
DRAWTEXT(h>0,H,l,'s_czsc_low'),colorwhite;
ll:=s_czsc_low;
p:=s_czsc_low;
end
//第十组
If fb1=0 and fb3=0 and fb5=0 and fb6=0 and fb8=0 and fb10 and fb11=0 then begin
pen:=s_direction_2*10;
end
//第十一组
If fb1=0 and fb3=0 and fb5=0 and fb6=0 and fb8=0 and fb10=0 and fb12 then begin
pen:=s_direction*10-s_status;
DRAWTEXT(h>0,H,'s_czsc_high'),colorwhite;
u:=s_czsc_high;
shan=1;
p:=s_czsc_high;
end
//第十二组
If fb1=0 and fb3=0 and fb5=0 and fb6=0 and fb8=0 and fb10=0 and fb12=0 then begin
pen:=s_direction_2*10;
end