if cross(a,y) or cross(b,y) then begin
sellshort.......;
buy......;
end
if cross(a,x) or cross(b,x) then begin
sellshort.......;
buy......;
end
if cross(x,a) or cross(x,b) then begin
sell.......;
buyshort......;
end
if cross(y,a) or cross(y,b) then begin
sell.......;
buyshort......;
end
if 开多条件 and type(1)=1 then buy.....;
if 开空条件 and type(1)=3 then buyshort......;
if 平多条件 then begin
sell....;
buyshort.....;
end
if 平空条件 then begin
sellshort.....;
buy...;
end
晕哦,老师既然不到一根烟功夫就搞出来了
老师是单独写的条件,我是把多条件放在一个句子里,难道这就是问题所在?
if cross(a,y) or cross(b,y) then begin
sellshort.......;
buy......;
end
if cross(a,x) or cross(b,x) then begin
sellshort.......;
buy......;
end
if cross(x,a) or cross(x,b) then begin
sell.......;
buyshort......;
end
if cross(y,a) or cross(y,b) then begin
sell.......;
buyshort......;
end
if 开多条件 and type(1)=1 then buy.....;
if 开空条件 and type(1)=3 then buyshort......;
if 平多条件 then begin
sell....;
buyshort.....;
end
if 平空条件 then begin
sellshort.....;
buy...;
end
----------------------------------------------
请问老师,定义多空条件的时,比如把AB上穿Y、和AB上穿X定义在同一个条件里,还是分别定义为两个多头条件?
按照我写的设定即可
手数:=ss;
//---------------------------------------------
jf:INTPART(sum(h-l,n)/n)NOAXIS,LINETHICK0;
jg:INTPART(sum(high,n)/n )LINETHICK0;
jd:INTPART(sum(low,n)/n )LINETHICK0;
//---------------------------------------------
x:INTPART(jd+jf)COLORRED;
y:INTPART(jd-jf)COLORBLUE;
a:(C+jf)COLORGREEN;
b:(C-jf)COLORGREEN;
//------------------------------------------------
开多条件:=cross(a,y) or cross(b,y);
开空条件:=cross(x,a) or cross(x,b);
平多条件:=cross(x,a) or cross(x,b);
平空条件:=cross(a,y) or cross(b,y);
//---------------------------------------
if cross(a,y) or cross(b,y) then begin
sellshort(1,SS,MARKET);
buy(1,SS,MARKET);
end
if cross(a,x) or cross(b,x) then begin
sellshort(1,SS,MARKET);
buy(1,SS,MARKET);
end
if cross(x,a) or cross(x,b) then begin
sell(1,SS,MARKET);
buyshort(1,SS,MARKET);
end
if cross(y,a) or cross(y,b) then begin
sell(1,SS,MARKET);
buyshort(1,SS,MARKET);
end
if 开多条件 and type(1)=1 then buy(1,SS,MARKET);
if 开空条件 and type(1)=3 then buyshort(1,SS,MARKET);
if 平多条件 then begin
sell(1,SS,MARKET);
buyshort(1,SS,MARKET);
end
if 平空条件 then begin
sellshort(1,SS,MARKET);
buy(1,SS,MARKET);
end
仔细对比了,信号没有遵循开平仓规则