开多条件:CC=1做多,CC满足多个条件后赋值为1,
止损:zs,
开空条件:CC=-1,CC满足多个条件后赋值为-1,
止损:ZS,
做多之后,价格触发止损条件,止损之后,CC依然等于1,不再建仓,必须要CC不等于1,后又从新等于1才再次建多单。
比如做多止损之后,CC由多个条件组成,其中一个条件或者多个不成立之后CC就等于0,然后多个条件又成立之后CC再次等于1才再次建立多单。
空单也是如此。
简单的说就是,做多条件成立之后做多,止损之后做多条件依然成立不再开仓,毕业等做多条件不成立,从新再次成立才再次建仓。
语言表达不是很好,不知道是否表达清楚,希望版主们帮忙处理下。
variable:cc=0;
variable:aa=0;
nn1:=barslast(做多条件);
nn2:=barslast(做空条件);
if 做多条件 then cc:=1;
if cc=1 and and aa=0 then begin
buy();
aa:=1;
end
if cc=1 and nn1>nn2 then buy();
if zs then sell();
if 做空条件 then cc:=-1;
if cc:=-1 and aa=0 then begin
buyshort();
aa:=-1;
end
if aa:=-1 and nn2>nn1 then buyshort();
if zs then sellshort();